简体   繁体   English

Python v2.7请求v2.5.1-所有获取请求均返回HTTP错误503

[英]Python v2.7 Requests v2.5.1 - all get requests return HTTP Error 503

I'm running anaconda python 2.7 and the latest Requests library on a Windows 7 desktop connected to a corporate network with an outbound proxy server at 10.0.0.255. 我在Windows 7桌面上运行anaconda python 2.7和最新的Requests库,该Windows 7桌面使用出站代理服务器位于10.0.0.255连接到公司网络。

My python script reads as follows: 我的python脚本内容如下:

import requests
r = requests.get("http://google.com")

I've also tried many different intranet and internet urls, HTTP and HTTPs all with the same result: 503 error. 我还尝试了许多不同的Intranet和Internet URL,HTTP和HTTPS,它们都具有相同的结果:503错误。 I've thought somehow the proxy is at fault. 我以为代理服务器有问题。 I've added the 'proxies = prox' statement with the following definition" 我用以下定义添加了“ proxies = prox”语句”

prox={
    "http" : "10.0.0.255:80" 
    "https" : "10.0.0.225:443"
} 

Which made no difference, but its entirely possible that my ports are wrong as the documentation is a bit sparse on the statement (only one example). 这没有什么区别,但是完全有可能我的端口是错误的,因为文档在该语句上有点稀疏(仅一个示例)。

I did try localhost and it gave me a different error: 我确实尝试了localhost,它给了我一个不同的错误:

ConnectionError: ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it')) ConnectionError :(“连接异常终止。”,错误(10061,“由于目标计算机主动拒绝连接而无法建立连接”))

My machine hates me. 我的机器讨厌我。 Great. 大。

At this point I'm stumped. 在这一点上,我很沮丧。 Its probably something related to all the security c_rp on this machine, but I'm not sure what my next move is. 它可能与这台计算机上的所有安全性c_rp有关,但是我不确定下一步是什么。

I am a N00b to python, and haven't coded in 20 years. 我是python的N00b,并且20年来没有编码。 That said, I wrote hard core C and ran memory debugs deep in architecture to find leaks, so I'm not completely dumb, just very, very rusty. 就是说,我写了硬核C并在体系结构中进行了内存调试,以发现泄漏,所以我并不完全傻,只是非常非常生锈。

  1. Doing a GET request on localhost won't do anything unless there is a webserver running on localhost:80 . 除非在localhost:80上运行网络服务器,否则在localhost上执行GET请求不会做任何事情。 Setup a node.js webserver running on localhost and then try again. 设置在本地主机上运行的node.js Web服务器,然后重试。

  2. Most corporate proxies use port 8080 for all traffic. 大多数公司代理使用端口8080进行所有通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM