[Pywikipedia-l] SVN: [6588] trunk/pywikipedia/copyright.py

cosoleto at svn.wikimedia.org cosoleto at svn.wikimedia.org
Sat Apr 11 11:15:22 UTC 2009


Revision: 6588
Author:   cosoleto
Date:     2009-04-11 11:15:22 +0000 (Sat, 11 Apr 2009)

Log Message:
-----------
Don't print search engine server response when a 'limit exceeded' error is detected due to security issues.

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

Modified: trunk/pywikipedia/copyright.py
===================================================================
--- trunk/pywikipedia/copyright.py	2009-04-11 11:05:21 UTC (rev 6587)
+++ trunk/pywikipedia/copyright.py	2009-04-11 11:15:22 UTC (rev 6588)
@@ -866,7 +866,7 @@
         exec('config.copyright_' + engine + ' = False')
     # Sleeping
     if config.copyright_exceeded_in_queries == 2:
-        error("Got a queries exceeded error. Sleeping for %d hours..." % (config.copyright_exceeded_in_queries_sleep_hours))
+        error("Got a queries exceeded error from %s. Sleeping for %d hours..." % (engine.capitalize(), config.copyright_exceeded_in_queries_sleep_hours))
         time.sleep(config.copyright_exceeded_in_queries_sleep_hours * 60 * 60)
     # Stop execution
     if config.copyright_exceeded_in_queries == 3:
@@ -944,7 +944,6 @@
             except KeyboardInterrupt:
                 raise
             except Exception, err:
-                error(err, "Got an error")
 
                 #
                 # SOAP.faultType: <Fault SOAP-ENV:Server: Exception from service object:
@@ -953,10 +952,12 @@
 
                 if 'Daily limit' in str(err) or 'Insufficient quota for key' in str(err):
                     exceeded_in_queries('google')
-                if 'limit exceeded' in str(err):
+                elif 'limit exceeded' in str(err):
                     exceeded_in_queries('yahoo')
                 #FIXME: Live Search
                 #
+                else:
+                    error(err, "Got an error")
 
                 if search_request_retry:
                     search_request_retry -= 1





More information about the Pywikipedia-l mailing list