I am trying to connect to my postgres database using psycopg2 with sslmode=\'required\' param; however, I get the following error
psycopg2.OperationalError:
As I can not comment: Adding to Brideau's answer that this only worked for me after changing my version of Postgres.
brew uninstall postgres brew update brew install postgres --with-openssl
Then run the code provided by Brideau and it should work.