python-requests-proxies判断学习

 1 # coding:utf8
 2 import requests
 3 def prox():
 4     url = 'http://115.159.33.177/images/ip.php'
 5     ip_list = [
 6         'http://111.13.7.122:80',
 7         'http://183.136.218.253:80',
 8         'http://121.41.31.215:80',
 9         'http://113.107.112.210:8101',
10         'http://219.141.189.236:3128',
11         'http://47.89.30.218:80'
12     ]
13     for i in ip_list:
14         ip_list1={'http':i}
15         html = requests.get(url,proxies=ip_list1).text
16         if '<html>' in html:
17             pass
18         else:
19             print i
20 if __name__=='__main__':
21     prox()

 

成功了4个代理

ip.php代码

1 <?php
2 $ip = $_SERVER['REMOTE_ADDR'];// www.hi-docs.com/php/$_SERVER.html
3 echo "$ip";
4 ?>

 

posted @ 2017-08-15 14:35  archie’s  阅读(1432)  评论(0编辑  收藏  举报