Created
December 9, 2017 05:53
-
-
Save Beomi/4dd14699ee5daa825167b2503b8e59d1 to your computer and use it in GitHub Desktop.
파이썬 2017 연말 세미나 트롤러
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 time | |
from multiprocessing import Pool | |
def troll(_): | |
with requests.Session() as s: | |
s.headers = { | |
'DNT': '1', | |
'Accept-Encoding': 'gzip, deflate', | |
'Accept-Language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7,la;q=0.6,da;q=0.5', | |
'Upgrade-Insecure-Requests': '1', | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', | |
'Referer': 'http://review.printf.kr:5000/', | |
'Connection': 'keep-alive', | |
} | |
s.get('http://review.printf.kr:5000/') | |
res = s.get('http://review.printf.kr:5000/thumbs/34') | |
print(res.ok) | |
time.sleep(1) | |
if __name__=='__main__': | |
pool = Pool(processes=8) | |
pool.map(troll, range(1000)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
크롤링을 배워 쓰는 잘못된 예...(?!)