When using psycopg2 from my local machine, there are options for sslmode and sslrootcert:
conn = psycopg2.connect(host=host, dbna