検索

ホームページ  >  に質問  >  本文

python - 让requests不走系统 全局 代理

做的是wifi自动验证登录脚本。

用的是Python的requests库。

File "/home/c/.local/lib/python2.7/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/home/c/.local/lib/python2.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/c/.local/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/c/.local/lib/python2.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/home/c/.local/lib/python2.7/site-packages/requests/adapters.py", line 485, in send
    raise ProxyError(e, request=request)


requests.exceptions.ProxyError: 
HTTPConnectionPool(host='127.0.0.1', port=1080): 
Max retries exceeded with url: 
http://www.baidu.com/ 
(Caused by ProxyError('Cannot connect to proxy.', NewConnectionError(
'<requests.packages.urllib3.connection.HTTPConnection object at 0x7fb9fb043810>: 
Failed to establish a new connection: [Errno 111] Connection refused',))
)

在当挂了代理后无法正常跳转(代理可用没坏),必须关闭代理才可以使用脚本,很不方便。

希望做到就是像firefox代理配置里那样可以直接连网络免疫系统代理。

求大佬指点一下……

PHPzPHPz2803日前866

全員に返信(1)返信します

  • PHP中文网

    PHP中文网2017-04-18 09:52:30

    Stackoverflow で解決されました

    返事
    0
  • キャンセル返事