I m trying to run the following simple code:
import urllib2
import base64
username = "some_user"
password = "some_pass"
url = "some_url"
req = urllib2.Request(url)
authheader = "Basic %s" % base64.encodestring('%s:%s' % (username, password))
req.add_header("Authorization", authheader)
req.add_header('User-agent', 'Mozilla/5.0')
resp = urllib2.urlopen(req)
print resp.read()
It works fine on windows, but on the same machine under Linux it doesnt work, it gives URL exception with code 503. I m sure there is no problem with the server, because it works fine with Mozzila and curl (both under lin and win). What can cause this problem?