don't get tripped up by errors

This commit is contained in:
Lynne Megido 2018-11-15 11:09:47 +10:00
parent f685f76ccb
commit ba9b697a63
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499

2
run.py
View file

@ -28,6 +28,8 @@ for row in dc.fetchall():
if row['cc'] != "None" and row['cc'] != None: if row['cc'] != "None" and row['cc'] != None:
r = requests.get("https://curiouscat.me/api/v2/profile?username={}&count=100&min_timestamp={}".format(row['cc'], row['latest_post'])) r = requests.get("https://curiouscat.me/api/v2/profile?username={}&count=100&min_timestamp={}".format(row['cc'], row['latest_post']))
j = r.json() j = r.json()
if 'error' in j:
continue
if len(j['posts']) > 0 and not (len(j['posts']) == 1 and int(j['posts'][0]['timestamp']) == int(row['latest_post'])): 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 #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']) client = Mastodon(client_id=row['client_id'], client_secret=row['client_secret'], access_token=row['secret'], api_base_url=row['instance'])