
March 2nd, 2004, 05:23 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
Hi Pasha,
This rather untidy example used to work fine but with the recent update to Devsheds forums it could very well be broken
Code:
#!/usr/bin/env python
import urllib, urllib2
def update(link, username, password, email, signature):
param1 = urllib.urlencode({'action': 'login', 'username': username, 'password': password})
param2 = urllib.urlencode({'action': 'updateprofile', 'email': email, 'emailconfirm': email, 'signature': signature})
cookie = urllib.urlopen(link, param1).info()['Set-Cookie']
cookie = [c for c in cookie.split() if c.endswith(';')][::2]
urllib.urlopen(urllib2.Request(link, param2, {'Cookie': ''.join(cookie)}))
update('http://forums.devshed.com/member.php', 'netytan', 'passwd', 'netytan@somewhere.com', 'www.python.org')
If you hadn't guessed it already, this script updates a users signature. But it does show how you can pass arguments to pages etc.
Not for the weak heated and it usually takes some time to figure out jsut what a page needs. especially if you can't look at the source code!
Mark.
__________________
programming language development: www.netytan.com – Hula
|