import urllib2
proxy = urllib2.ProxyHandler({ "http" : "http:proxyIp1", "https" : "proxyIp2"})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
try:
a = urllib2.urlopen("corporate internal link")#, proxies=proxy)
b = a.read()
except urllib2.HTTPError as e:
error = e.read() # this will be your error message
print error
This gives an error:
401 - Unauthorized: Access is denied due to invalid credentials.
I know that i have to give "username" and "password" but can any1 tell how i can give the credentials in this case?? Thanks