[Pywikipedia-l] SVN: [6069] trunk/pywikipedia/wikipedia.py

nicdumz at svn.wikimedia.org nicdumz at svn.wikimedia.org
Thu Nov 6 01:49:18 UTC 2008


Revision: 6069
Author:   nicdumz
Date:     2008-11-06 01:49:17 +0000 (Thu, 06 Nov 2008)

Log Message:
-----------
Raising CaptchaError when a ReCaptcha is found, instead of spitting out HTML

Modified Paths:
--------------
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-11-06 01:00:13 UTC (rev 6068)
+++ trunk/pywikipedia/wikipedia.py	2008-11-06 01:49:17 UTC (rev 6069)
@@ -4379,6 +4379,9 @@
                 url = self.protocol() + '://' + self.hostname() + self.captcha_image_address(id)
                 answer = ui.askForCaptcha(url)
             return {'id':id, 'answer':answer}
+        Recaptcha = re.compile('<script type="text/javascript" src="http://api\.recaptcha\.net/[^"]*"></script>')
+        if Recaptcha.search(data):
+            raise wikipedia.CaptchaError('We have been prompted for a ReCaptcha, but pywikipedia does not yet support ReCaptchas')
         return None
 
     def postForm(self, address, predata, sysop=False, cookies = None):





More information about the Pywikipedia-l mailing list