I'm currently working my way through the excellent Python Challenge (http://www.pythonchallenge.com/). The current problem I'm tackling involves the use of the urllib library but I'm having issues. I'm attempting to use this library to connect to the site through my company's firewall. Let's start with some code:
proxy = {'http':'http://my.companys.proxy/proxy.pac'}
urllib.urlopen('http://www.pythonchallenge.com', proxies=proxy).read()
This yields an http response, but strangely its the Apache HTTP server test page:
...Red Hat Enterprise Linux Test Page... This page is used to test the proper operation of the Apache HTTP server after it has been installed, etc...
So, I appear to be successfully acheiving an http connection outside our firewall but getting a different http resposne than my browser. Another clue (or not) is when I try to connect to the about.php page:
urllib.urlopen('http://www.pythonchallenge.com/about.php', proxies=proxy).read()
This, however, yields:
404 Not found... Apache 2.2.3 Red Hat Server at www.pythonchallenge.com Port 80
Both addresses above work just fine in my browser (using the same proxy). Any ideas where I'm going wrong?