0

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.

My python script reads as follows:

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. I've thought somehow the proxy is at fault. I've added the 'proxies = prox' statement with the following definition"

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:

ConnectionError: ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it'))

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.

I am a N00b to python, and haven't coded in 20 years. 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.

Harvey
  • 617
  • 8
  • 18
  • Without revealing personal information, what's the contents of r.__dict__, it may give you helpful hints in what's going on. – AdriVelaz Feb 04 '15 at 22:22
  • Are you sure that proxy port is correct? Try: [http://stackoverflow.com/a/8287752/3710490](http://stackoverflow.com/a/8287752/3710490) and the next comment suggestion with urllib – Valijon Feb 04 '15 at 22:23
  • Is any web server running on localhost? Trying running a simple `node.js` webserver on localhost and try it again - you aren't going to get a response if there isn't a server listening at the other end. – Gillespie Feb 04 '15 at 22:39
  • Also, most corporate proxies use port `8080`, not port `80/443`, just throwing that out there. – Gillespie Feb 04 '15 at 22:42
  • Thanks - all this is useful. I missed Valijon's reference, its helpful. And RPGillespie, I'll try 8080 tomorrow and see what happens. The 80 and 443 were all I saw on the network trace... but I wasn't sure if that was what I needed to enter. Thanks all and stay tuned for live debuggering... – Harvey Feb 04 '15 at 22:49
  • Check your browser configuration to get the proxy ports – Juan Fco. Roco Feb 05 '15 at 02:22
  • Ran the code from home and it works as expected, so its something on my corporate network. Oddly, nothing is shown in my procy config on my workstation. – Harvey Feb 05 '15 at 13:05

1 Answers1

-1
  1. Doing a GET request on localhost won't do anything unless there is a webserver running on localhost:80. Setup a node.js webserver running on localhost and then try again.

  2. Most corporate proxies use port 8080 for all traffic.

Gillespie
  • 5,780
  • 3
  • 32
  • 54