handle error

pull/200/head
Aevann 2023-09-12 17:32:07 +03:00
parent 4c87c88cfc
commit 35f7b46fc8
1 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,9 @@ def get_mentions(cache, queries, reddit_notifs_users=False):
for query in queries:
url = f'https://api.pullpush.io/reddit/search/{kind}?q={query}'
data += requests.get(url, headers=HEADERS, timeout=5, proxies=proxies).json()['data']
try: req = requests.get(url, headers=HEADERS, timeout=5, proxies=proxies)
except: break
data += req.json()['data']
data = sorted(data, key=lambda x: int(x['created_utc']), reverse=True)