Python urllib2 proxy setting issue
<p>I've looked through some of the other posts on this and I hope I'm not duplicating, but I'm stuck on a real headscratcher with setting a proxy server for urllib2. I'm running the below: </p>

<pre><code>    file, site = argv
    uri = 'https://'+site
    http_proxy_server = "http://newyork.wonderproxy.com"
    http_proxy_port = "11001"
    http_proxy_user = "user"
    http_proxy_passwd = "password"

    http_proxy_full_auth_string = "http://%s:%s@%s:%s" % (http_proxy_user,
                                                          http_proxy_passwd,
                                                          http_proxy_server,
                                                          http_proxy_port)

    proxy_handler = urllib2.ProxyHandler({"http": http_proxy_full_auth_string})
    opener = urllib2.build_opener(proxy_handler)
    urllib2.install_opener(opener)
    html = opener.open(uri).read()
    print html, 'it opened!'
</code></pre>

<p>I'm running this against an IP info site, but try as I might the response always comes out with my non-proxy IP address. When I manually set my proxy through system settings I do get a different response, so I've confirmed it's not an issue with the proxy criteria itself.</p>

<p>Any help that could be offered would be much appreciated!</p>

<p>Your question sets the proxy URL to</p>

<p><code>http://user:password@http://newyork.wonderproxy.com:11001</code></p>

<p>which isn't valid. If you changed <code>http_proxy_server</code> to <code>newyork.wonderproxy.com</code> then your first solution might work better.</p>

python proxy urllib2