2011-12-12, 15:47
TobiasTheCommie Wrote:If you don't mind getting from trunk, i could probably hook up POST pretty quick.
We already have it supported in our fetchPage in the YouTube plugin(It uses it's own function for various reasons, same name though. Just for the added confusion it brings.)
The function definitely needs more features, but if you want to convert from urllib to fetchPage, feel free to post a code snippet with what you want done in urlilb2, and i'll see if i can integrate it into fetchpage in a non stupid way.
That is basically the only requirement i have for functions in fetchPage. They must not require a stupid implementation to work, or cause problems/complexities there are no use for. (Hence why the YouTube plugin uses its own function, that version is stupid and complex).
I use the mechanize lib now not urllib2
Basically I post the first of 3 forms on the page with filled in user and password and get back the querystring from the resultpage.
br = mechanize.Browser()
r = br.open(url)
br.select_form(nr=1)
# User credentials
br.form['username'] = self.username
br.form['password'] = self.password
# Login
br.submit()
result = br.geturl()