Сам только изучаю Python, в документации так же есть вот такая штука:
Request.set_proxy(host, type)
Prepare the request by connecting to a proxy server. The host and type will replace those of the instance, and the instance’s selector will be the original URL given in the constructor.
И вот еще в той же документации:
ProxyHandler Objects
ProxyHandler.protocol_open(request)
The ProxyHandler will have a method protocol_open() for every protocol which has a proxy in the proxies dictionary given in the constructor. The method will modify requests to go through the proxy, by calling request.set_proxy(), and call the next handler in the chain to actually execute the protocol.
Либо вот такая конструкция, взятая со StackOverflow (используется модуль requests, а не urllib)
http_proxy = "http://10.10.1.10:3128"
https_proxy = "https://10.10.1.11:1080"
ftp_proxy = "ftp://10.10.1.10:3128"
proxyDict = {
"http" : http_proxy,
"https" : https_proxy,
"ftp" : ftp_proxy
}
r = requests.get(url, headers=headers, proxies=proxyDict)
Либо для Вашего кода нечто подобное:
prox={"http": "http://107.170.106.64:8888"}
hnd = request.ProxyHandler(prox)
opn = request.build_opener(hnd)
request.install_opener(opn)