added a timeout

This commit is contained in:
Lynne Megido 2018-10-27 23:50:58 +10:00
parent adba7ca14b
commit 96e575edba
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499

View file

@ -50,9 +50,9 @@ class ReplyListener(mastodon.StreamListener):
kind = 'general' #todo: support for images kind = 'general' #todo: support for images
if kind == 'images': if kind == 'images':
r = requests.get("https://searx.lynnesbian.space/?category_images=1&q={}&format=json".format(q)) r = requests.get("https://searx.lynnesbian.space/?category_images=1&q={}&format=json".format(q), timeout=10)
else: else:
r = requests.get("https://searx.lynnesbian.space/?q={}&format=json".format(q)) r = requests.get("https://searx.lynnesbian.space/?q={}&format=json".format(q), timeout=10)
j = r.json() j = r.json()
if kind == 'images': if kind == 'images':