爬虫2 urllib3用法

import urllib3
import json

# 实例化一个连接池
# http = urllib3.PoolManager()
# res = http.request('get','http://httpbin.org/get')
# res_json = res.data.decode()
# res_dict = json.loads(res_json)
# print(res_dict)

# 代理池
proxy = urllib3.ProxyManager('http://123.101.207.160:9999')
res = proxy.request('get','http://httpbin.org/ip')
print(res.data)

 

转载于:https://www.cnblogs.com/cxhzy/p/10241699.html

你可能感兴趣的:(爬虫2 urllib3用法)