您应该在调用class
set_proxy()的 实例
Request,而不是调用类本身:
from urllib import request as urlrequestproxy_host = 'localhost:1234' # host and port of your proxyurl = 'http://www.httpbin.org/ip'req = urlrequest.Request(url)req.set_proxy(proxy_host, 'http')response = urlrequest.urlopen(req)print(response.read().depre('utf8'))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)