]> git.aero2k.de Git - urlbot-v3.git/commitdiff
deal with broken searx engines, pin pika for now
authorThorsten S <mail@aero2k.de>
Sat, 20 Apr 2019 15:46:43 +0000 (17:46 +0200)
committerThorsten S <mail@aero2k.de>
Sat, 20 Apr 2019 15:46:43 +0000 (17:46 +0200)
distbot/plugins/searx.py
setup.py

index a3226823f53c625b2908c5fab17ad0259ec2fafd..199c792d75c18336f714e241fd4bea5c08558857 100644 (file)
@@ -88,8 +88,14 @@ class Searx(Worker):
             self.search_list.pop(0)
             raise
 
-        if 'results' not in response or not response['results']:
+        if not response.get('results', []):
+            if response.get("unresponsive_engines", []):
+                logger.debug("drop search engine, probably has issues: %s", self.search_list[0])
+                self.search_list.pop(0)
+                return self.searx(text)
+            logger.info("No results found, response: %s", response)
             return
+
         return [(r.get('content', ''), r['url'], url) for r in response['results']][0]
 
     def parse_body(self, msg):
index 59c691650403036fd54d2f4143e09a243c43017e..45fdeaa24ae45ca3e82aeb95ec54b1f1a61bc917 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ setup(
     name="distbot",
     version=0.1,
     description="the distributed bot",
-    install_requires=["sleekxmpp", "pika", "flask", 'configobj', 'requests', 'lxml'],
+    install_requires=["sleekxmpp", "pika==0.12.0", "flask", 'configobj', 'requests', 'lxml'],
     test_requires=["pytest"],
     extras_require={
         'test': ["pytest"],