Python googletrans 错误汇总

2021-01-26  本文已影响0人  小杰杰杰

1、httpcore._exceptions.ConnectError: [Errno 61] Connection refused
此问题需要在命令行设置代理
例:

export HTTP_PROXY=http://127.0.0.1:8080; #换成你自己的代理地址
export HTTPS_PROXY=http://127.0.0.1:8080; #换成你自己的代理地址
export ALL_PROXY=socks5://127.0.0.1:8081#换成你自己的代理地址

2、ValueError: Unknown scheme for proxy URL URL('socks5://127.0.0.1: 8081')
这是因为googletrans依赖的httpx 不支持 socks5代理
解决方案是把ALL_PROXY换为http代理:

export HTTP_PROXY=http://127.0.0.1:8080; #换成你自己的代理地址
export HTTPS_PROXY=http://127.0.0.1:8080; #换成你自己的代理地址
export ALL_PROXY=http://127.0.0.1:8080 #换成你自己的代理地址

3、httpcore._exceptions.ConnectTimeout: _ssl.c:1106: The handshake operation timed out
如果你配置代理了。这是代理出问题了,请检查你的代理

上一篇 下一篇

猜你喜欢

热点阅读