昨晚写一个的小程序,用到requests-future库。本来好好的,今天突然报这样的错误:
`Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 330, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 599, in urlopen
'Socket error: %s.' % e)
urllib3.exceptions.ProxyError: Cannot connect to proxy. Socket error: [Errno 111] Connection refused.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 467, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 381, in send
raise ProxyError(e)
requests.exceptions.ProxyError: Cannot connect to proxy. Socket error: [Errno 111] Connection refused.`
代码则很简单:
`
from requests import Session
s = Session()
one = s.get('http://www.baidu.com/')
`
我不知道为什么突然会这样子报错,怀疑是不是我安装shadowsock后设置了全局代理,但我已经关闭了代理,也没有启动ss,在系统设置也设置了代理为无。
目前使用的系统: elementary os
1
Septembers 2015-06-16 20:13:44 +08:00 via Android
> printenv
|
2
yeelone OP @Septembers 谢谢。已使用 unset http_proxy 和 unset https_proxy 去除代理。但仍然报错。
|
3
funagi 2015-06-16 20:18:17 +08:00
根据这个: http://docs.python-requests.org/en/latest/user/advanced/#proxies
检查环境变量HTTP_PROXY或HTTPS_PROXY是否被设置了 |
5
Septembers 2015-06-17 05:58:44 +08:00 via Android
@yeelone 好像 Bash环境变量 区分大小写(写脚本的时候好像是这样的
|