1. 程式人生 > >爬蟲2 urllib3用法

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