Revision: 5645 Author: btongminh Date: 2008-06-27 21:22:00 +0000 (Fri, 27 Jun 2008)
Log Message: ----------- Better login detection
Modified Paths: -------------- trunk/pywikipedia/login.py
Modified: trunk/pywikipedia/login.py =================================================================== --- trunk/pywikipedia/login.py 2008-06-27 01:48:59 UTC (rev 5644) +++ trunk/pywikipedia/login.py 2008-06-27 21:22:00 UTC (rev 5645) @@ -149,12 +149,14 @@ if m: L.append(m.group(1))
- got_token = False + got_token = got_user = False for Ldata in L: if 'Token=' in Ldata: got_token = True - - if got_token: + if 'User=' in Ldata or 'UserName=' in Ldata: + got_user = True + + if got_token and got_user: return "\n".join(L) elif not captchaAnswer: captchaR = re.compile('<input type="hidden" name="wpCaptchaId" id="wpCaptchaId" value="(?P<id>\d+)" />')