From 1348f6dc0cbb9d77fdc655fceefcf62a02855141 Mon Sep 17 00:00:00 2001 From: Thorsten S Date: Sat, 20 Apr 2019 17:46:43 +0200 Subject: [PATCH] deal with broken searx engines, pin pika for now --- distbot/plugins/searx.py | 8 +++++++- setup.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/distbot/plugins/searx.py b/distbot/plugins/searx.py index a322682..199c792 100644 --- a/distbot/plugins/searx.py +++ b/distbot/plugins/searx.py @@ -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): diff --git a/setup.py b/setup.py index 59c6916..45fdeaa 100644 --- 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"], -- 2.39.5