我使用Python库请求为我公司的服务器软件编写一个API包装器。我在Windows764上使用Python2.7编写一个测试脚本。我们用一个代理来连接我的工作网络,我们称之为IP x.x.x.x:8080。我的脚本如下:
import requests
ssHost = 'localhost'
ssPort = 3700
aci_Action = 'GetStatus'
aci_params = {'Action':aci_Action}
aci_RequestUrl = 'http://' + ssHost + ':' + str(ssPort)
aci_response = requests.get(aci_RequestUrl, params=aci_params)
print(aci_response.text)
这应该发送一个GET请求到http://localhost:3700/Action=GetStatus
,当我在我的工作网络上时,它可以正常工作。但是,当我回到家并且不使用代理进行连接时,我在运行脚本时会得到以下结果:
ConnectionError: HTTPConnectionPool(host='x.x.x.x', port=8080): Max retries exceeded with url:
http://localhost:3700/?Action=GetStatus
(Caused by : [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)
我确定我已经使用Internet Explorer中的设置关闭了代理,但仍然收到此错误。问题是,错误显示的代理地址是我不再使用的旧地址。我想弄清楚这个代理设置在哪里。这里有些事情我不明白,如果有人能为我指出正确的方向,排除故障,我将不胜感激。谢谢!在
请仔细检查“Internet选项”中的代理设置,并检查环境变量
http_proxy
是否存在。在相关问题 更多 >
编程相关推荐