Created
July 19, 2017 02:30
-
-
Save anonymous/5675cf38b29cb522452024ae92c33097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = requests.get('http://127.0.0.1:8000/?types=0&count=5&country=国内') | |
ip_ports = json.loads(r.text) | |
print(ip_ports) | |
i = random.randint(0,4) | |
print(i) | |
ip = ip_ports[i][0] | |
port = ip_ports[i][1] | |
proxies={ | |
'http':'http://%s:%s'%(ip,port), | |
'https':'http://%s:%s'%(ip,port) | |
} | |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel… Gecko/20100101 Firefox/54.0'} | |
r = requests.get('http://ip.chinaz.com/', headers=headers, proxies=proxies) | |
r.encoding='utf-8' | |
print(r.status_code) | |
print(proxies) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment