我只用过 Python3 里面的 urllib.request.urlopen。
下面这段话来自 Python 自己的文档:
http://docs.python.org/3/library/urllib.request.html#module-urllib.requestIn addition, if proxy settings are detected (for example, when a *_proxy environment variable like http_proxy is set), ProxyHandler is default installed and makes sure the requests are handled through the proxy.
我做过一个 PyQt 应用,VocVoc@github。其中用到了 urlopen, 用下来的效果是确实会自动检测代理设置。
当时的情形是这样的:
我处于教育网内利用 IPV6 + GAgent 免费上网(IPV4 要收费), export http_proxy='127.0.0.1:8087',而 VocVoc 用到 urlopen 的功能完全正常(可以联网)。
记得要 export http_proxy 这个变量才能起效哦。
====
我不熟悉 Py2 的 http库。。
不过我也在 urllib 和 urllib2 的官方文档里面都搜到关于代理的一段话,和上面的类似,可以自动利用 http_proxy 这个变量。
另外, 建议你的
Readme.md 小题目也按照 md 的格式来。