爬虫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)