[pyKoL-users] SF.net SVN: pykol: [5]
Brought to you by:
scelis
From: <mi...@us...> - 2007-03-31 20:03:42
|
Revision: 5 http://pykol.svn.sourceforge.net/pykol/?rev=5&view=rev Author: misza13 Date: 2007-03-31 13:03:44 -0700 (Sat, 31 Mar 2007) Log Message: ----------- login.py -> test.py (more appropriate name) Modified Paths: -------------- kolsite.py Added Paths: ----------- test.py Removed Paths: ------------- login.py Modified: kolsite.py =================================================================== --- kolsite.py 2007-03-31 19:51:56 UTC (rev 4) +++ kolsite.py 2007-03-31 20:03:44 UTC (rev 5) @@ -47,11 +47,10 @@ def getPage(self, address, data=''): - #print 'Getting %s...' % address conn = httplib.HTTPConnection(self.hostname) conn.putrequest('GET', '/' + address) - #conn.putheader('Cookie', self.cookie) + conn.putheader('Cookie', self.cookie) conn.endheaders() conn.send('') @@ -71,7 +70,6 @@ conn.putrequest('POST', '/' + address) conn.putheader('Content-Length', str(len(data))) - #conn.putheader('Content-type', 'application/x-www-form-urlencoded') conn.endheaders() conn.send(data) @@ -83,7 +81,6 @@ def doLogin(self, nick, password): challenge = self.getChallenge() - #print 'Challenge: "%s"' % challenge formFields = {} formFields['loggingin'] = 'Yup.' Deleted: login.py =================================================================== --- login.py 2007-03-31 19:51:56 UTC (rev 4) +++ login.py 2007-03-31 20:03:44 UTC (rev 5) @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- - -from kolsite import KoLSite - - -if __name__ == '__main__': - Site = KoLSite('www.kingdomofloathing.com') - config = {} - execfile('misha.conf') - cookie = Site.doLogin(config['nick'],config['password']) - response, data = Site.getPage('main.html') - print response.status - print data Copied: test.py (from rev 4, login.py) =================================================================== --- test.py (rev 0) +++ test.py 2007-03-31 20:03:44 UTC (rev 5) @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +import sys +from kolsite import KoLSite + + +def main(): + if len(sys.argv) < 2: + print 'Please specify a config file!' + return + config = {} + execfile('misha.conf') + if not config.has_key('nick') or not config.has_key('password'): + print 'Nick or password not specified in config!' + return + + Site = KoLSite('www.kingdomofloathing.com') + Site.doLogin(config['nick'],config['password']) + + response, data = Site.getPage('main.html') + print response.status + print data + +if __name__ == '__main__': + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |