[Tutor] Logging In To Forum

Alex Krycek agent.krycek at gmail.com
Fri Aug 1 20:47:52 CEST 2008


I would like to have my script log in to a vBulletin forum. My script does
seem to do this (as I can check my control panel, etc.). But although I can
get access to my account, the forum fails to update the date when I last
visited. That date updates just fine when I do it manually through a
browser. I was wondering if I was maybe messing something up with cookies.
Any suggestions would be appreciated. Thanks!

# forumlogin.py
#         Logs into vBulletin forum

import urllib2, time
import cgitb; cgitb.enable()

def main():
     print "Content-type: text/html\n"

     url = "http://forums.x10hosting.com/login.php?do=login"
     queryString = "..."

     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
     response = opener.open(url, queryString)

def logfile():
     fileIn = open("../logfile.txt", "a")

*if* __name__ == "__main__":
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080801/d074b35f/attachment.htm>

More information about the Tutor mailing list