私はHerokuとasyncpgを使用してPostgreSQLデータベースを実行しています。私のURLはpostgres://user:[email protected]:5432/db_name
です。証明書検証失敗PostgreSQL Heroku
私はこれを実行すると、私はエラーを取得:このデータベースのURLは間違いなく動作します
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
私はpsycopg2を使用する場合、それが有効です。 asyncpgを使用すると、このエラーが発生します。
私は接続プールを使用しないようにしましたが、どちらも動作しません。手動でユーザー、パスワードなどを渡しても動作しません。
class Database:
"""Accessing database functions"""
def __init__(self, bot):
self.bot = bot
try:
self.dsn = os.environ["DATABASE_URL"]
except KeyError:
database_file = open('database_secret.txt', mode='r')
self.dsn = database_file.read()
database_file.close()
self.pool = None
self.prefix_conn = None
self.prefix_stmt = None
print(self.dsn)
lop = asyncio.get_event_loop()
lop.run_until_complete(self.init())
async def init(self):
self.pool = await asyncpg.create_pool(self.dsn, ssl=True)
# It fails here