Last active
August 29, 2015 14:06
-
-
Save paulw54jrn/b98dda3e8be2c95661d9 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
def get_content_length(dic): | |
length = 0 | |
for key,value in dic.iteritems(): | |
length += len(key) + len(value) | |
return length | |
def bump(session): | |
r = session.get('http://someurl') | |
formhash = re.findall(r'<input type="hidden" name="formhash" value="(.*)" />',r.text)[0] | |
param = { | |
'mod':'post', | |
'action':'reply', | |
'fid':'626', | |
'tid':'12345678', | |
'extra':'', | |
'replysubmit':'yes', | |
'infloat':'yes', | |
'handlekey':'fastpost', | |
'inajax':'1' | |
} | |
data = { | |
'message':'bumpbumpbumpbump', | |
'formhash':formhash, | |
'subject':'' | |
} | |
headers = { | |
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', | |
'Accept-Encoding':'gzip,deflate', | |
'Accept-Language':'en-US,en;q=0.8', | |
'Cache-Control':'no-cache', | |
'Connection':'keep-alive', | |
'Content-Type':'application/x-www-form-urlencoded', | |
'Content-Length': get_content_length(data), | |
'DNT':'1', | |
'Host':'www.yeeyi.com', | |
'Origin':'http://www.yeeyi.com', | |
'Pragma':'no-cache', | |
'Referer':'http://www.yeeyi.com/bbs/forum.php?mod=viewthread&tid=12345678', | |
'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36' | |
} | |
r = session.post('http://www.yeeyi.com/bbs/forum.php',params=param,data=data,headers=headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment