title: Proxy authentication error - python
body: <p>Hi I have written a few simple lines of code. But I seem to be getting a Authentication error. Can anyone please suggest , what credentials are being looked for python here ?</p>
  
  <p>Code:</p>
  
  <pre><code>import urllib2
  response = urllib2.urlopen('http://google.com')
  html = response.read()
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required
  </code></pre>
  
  <p>PS: I do not have acces to IE -->Advanced settings or <code>regedit</code></p>
  
  <p>As advised I've modified the code :</p>
  
  <pre><code>import urllib2
  proxy_support = urllib2.ProxyHandler({'http':r'http://usename:psw@IP:port'})
  auth = urllib2.HTTPBasicAuthHandler()
  opener = urllib2.build_opener(proxy_support, auth, urllib2.HTTPHandler)
  urllib2.install_opener(opener)
  response = urllib2.urlopen('http://google.com')
  html = response.read()
  </code></pre>
  
  <p>Also I have created two environment variables :</p>
  
  <pre><code>HTTP_PROXY = http://username:password@proxyserver.domain.com
  HTTPS_PROXY = https://username:password@proxyserver.domain.com
  </code></pre>
  
  <p>But still getting the error .</p>
  
  <p><code>urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required</code></p>