From 9f8326ae0685da8bd928b64358a5bbcbb393dd36 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 17 Nov 2018 15:34:52 +1000 Subject: [PATCH] handle tokens being revoked --- run.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index f930c08..32771fc 100755 --- a/run.py +++ b/run.py @@ -33,7 +33,10 @@ for row in dc.fetchall(): posted = False if len(j['posts']) > 0 and not (len(j['posts']) == 1 and int(j['posts'][0]['timestamp']) == int(row['latest_post'])): #they've made some new posts, log in to masto - client = Mastodon(client_id=row['client_id'], client_secret=row['client_secret'], access_token=row['secret'], api_base_url=row['instance']) + try: + client = Mastodon(client_id=row['client_id'], client_secret=row['client_secret'], access_token=row['secret'], api_base_url=row['instance']) + except: + continue for post in j['posts']: if post['senderData']['id'] == False: sender = "(anonymous)"