Created
April 27, 2016 09:36
-
-
Save swshan/849adbfc492809b7f8e67d6ce4eccaac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import requests | |
import random | |
def getproxy(): | |
foo = ['124.200.33.146:8118', '112.90.72.83:80'] | |
rand = random.choice((foo)) | |
''' Get a dict format proxy randomly ''' | |
proxy= rand | |
proxies={'http':'http://'+proxy} | |
r = requests.get('http://www.douban.com',proxies=proxies,timeout=1) | |
print r.text | |
if __name__ == '__main__': | |
getproxy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment