【发布时间】:2020-09-15 02:07:31
【问题描述】:
我正在使用 asyncpg 在 Heroku postgresql 中使用 python 连接我的数据库:
import asyncpg
async def create_db_pool():
bot.pg_con = await asyncpg.create_pool(dsn="postgres://....", host="....amazonaws.com", user="xxx", database="yyy", port="5432", password="12345")
它一直运行良好,直到我收到来自 heroku 的电子邮件,建议我进行维护:Maintenance (DATABASE_URL on myappname) is starting now. We will update you when it has completed.
然后出现这个错误:
asyncpg.exceptions.InvalidAuthorizationSpecificationError: no pg_hba.conf entry for host "123.456.789.10", user "xxx", database "yyy", SSL off
我试图寻求一些帮助,比如把ssl=True
但是出现了这个错误:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1108)
与输入ssl="allow"相同
asyncpg.exceptions.InvalidPasswordError: password authentication failed for user "xxx"
我能做些什么来解决这个问题?
【问题讨论】:
-
您尝试过this issue 中提出的一些解决方案吗?
-
是的,我尝试了这些解决方案但没有奏效
-
您可以使用
psql或psycopg2成功连接吗? -
用 psycopg2 是的,但不能用 asyncpg,仍然是同样的错误
标签: python ssl heroku discord.py asyncpg