最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - psycopg_pool.ConnectionPool conninfo WARNING error connecting in 'pool-1': [Errno -2] Name or service n

programmeradmin2浏览0评论
with ConnectionPool(
    conninfo = app.config["POSTGRESQL_DATABASE_URI"],
    max_size = app.config["DB_MAX_CONNECTIONS"],
    kwargs = connection_kwargs,
    ) as pool:

With a connection string of postgresql://username:password@ipaddress:5432/database, I get the error:

WARNING  error connecting in 'pool-1': [Errno -2] Name or service not known

I can connect to it from psql CLI with exactly the same parameters without any problem. Note that the password contains special characters such as @ and $

with ConnectionPool(
    conninfo = app.config["POSTGRESQL_DATABASE_URI"],
    max_size = app.config["DB_MAX_CONNECTIONS"],
    kwargs = connection_kwargs,
    ) as pool:

With a connection string of postgresql://username:password@ipaddress:5432/database, I get the error:

WARNING  error connecting in 'pool-1': [Errno -2] Name or service not known

I can connect to it from psql CLI with exactly the same parameters without any problem. Note that the password contains special characters such as @ and $

Share Improve this question edited Mar 18 at 7:05 snakecharmerb 56.2k13 gold badges134 silver badges187 bronze badges asked Mar 18 at 4:40 khtehkhteh 4,05410 gold badges59 silver badges104 bronze badges 1
  • This question is similar to: How to handle special characters in the password of a Postgresql URL connection string?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – snakecharmerb Commented Mar 18 at 7:07
Add a comment  | 

1 Answer 1

Reset to default 0
from urllib import parse
parse.quote("the password which contains special characters")
发布评论

评论列表(0)

  1. 暂无评论