post3
ip代理
从http://www.data5u.com/free/gnpt/index.shtml获取免费代理
测试代码
import requests proxies = {'http': 'http://124.193.37.5:8888'} response = requests.get('http://www.ip.cn/',proxies=proxies) print(response.content.decode('utf-8'))
<div id="result"><div class="well"><p>您现在的 IP:<code>118.184.180.46</code></p><p>所在地理位置:<code>江苏省常州市 PubYun</code></p><p>GeoIP: Changzhou, Jiangsu, China</p><p>内部 IP: <code>124.193.37.5</code></p><p>来自:北京市 鹏博士</p><p>GeoIP: Beijing, China</p></div></div>
本机为杭州电信,可以看到ip已经成功切换