ignore pullpush error
parent
ada5655392
commit
492a8a9d3e
|
@ -27,16 +27,16 @@ def offsite_mentions_task(cache):
|
|||
if const.REDDIT_NOTIFS_USERS:
|
||||
for query, send_user in const.REDDIT_NOTIFS_USERS.items():
|
||||
user_mentions = get_mentions(cache, [query], reddit_notifs_users=True)
|
||||
notify_mentions(user_mentions, send_to=send_user, mention_str='mention of you')
|
||||
if user_mentions:
|
||||
notify_mentions(user_mentions, send_to=send_user, mention_str='mention of you')
|
||||
|
||||
def get_mentions(cache, queries, reddit_notifs_users=False):
|
||||
mentions = []
|
||||
for kind in ('submission', 'comment'):
|
||||
q = " or ".join(queries)
|
||||
url = f'https://api.pullpush.io/reddit/search/{kind}?q={q}'
|
||||
try: req = requests.get(url, headers=HEADERS, timeout=5)
|
||||
try: data = requests.get(url, headers=HEADERS, timeout=5).json()['data']
|
||||
except: return []
|
||||
data = req.json()['data']
|
||||
|
||||
for thing in data:
|
||||
if not thing.get('permalink'):
|
||||
|
|
Loading…
Reference in New Issue