Python Requests script to login to a phpbb forum

Leo ttdhead at
Wed Feb 19 12:46:31 CET 2014

Hi there,

I have decided to jump in at the deep end to try and learn python. I 
have been able to get requests to pull the login page off the server 
and I think send the login request. I don't get logged in though. 
Please let me know if I would be better off asking in a phpBB related 
group or forum.

Here is my code without username and password included:
import requests

payload = {'username': 'username', 'password': 'password'}
r ="",data=payload)
sidStart = r.text.find("sid")+4
sid = r.text[sidStart:sidStart+32]
parameters = {'mode': 'login', 'sid': sid}
r ="",params=parameters,data=payload)
if "Logout" in r.text: print("We are in")

Thank you

ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at

More information about the Python-list mailing list