This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chuang Cao
Recipients Chuang Cao
Date 2015-09-11.08:46:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When use a urllib2.ProxyHandler to set a proxy, if the proxies's key is an upper string, like "HTTP", "HTTPS". The proxy url can't be used, because they can't find the <type>_open function.

Two way can sovle the issue.
1. Specify it in document to let users to use a lower string like "http".

2. Add a patch in

diff -up ./ ./
--- ./	2015-09-11 15:06:55.686927934 +0800
+++ ./	2015-09-11 16:56:48.306138898 +0800
@@ -102,6 +102,7 @@ import sys
 import time
 import urlparse
 import bisect
+import string
     from cStringIO import StringIO
@@ -713,6 +714,7 @@ class ProxyHandler(BaseHandler):
         assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
         self.proxies = proxies
         for type, url in proxies.items():
+            type = string.lower(type)
             setattr(self, '%s_open' % type,
                     lambda r, proxy=url, type=type, meth=self.proxy_open: \
                     meth(r, proxy, type))

I think the second way is a good way.
Date User Action Args
2015-09-11 08:46:13Chuang Caosetrecipients: + Chuang Cao
2015-09-11 08:46:13Chuang Caosetmessageid: <>
2015-09-11 08:46:13Chuang Caolinkissue25068 messages
2015-09-11 08:46:12Chuang Caocreate