From: Thorsten S Date: Sat, 20 Apr 2019 15:46:43 +0000 (+0200) Subject: deal with broken searx engines, pin pika for now X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=1348f6dc0cbb9d77fdc655fceefcf62a02855141;p=urlbot-v3.git deal with broken searx engines, pin pika for now --- 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"],