mirror of
https://gitlab.com/oloturia/fumcaso.git
synced 2025-01-07 22:17:18 +01:00
Retry if fails
This commit is contained in:
parent
8e223f37c9
commit
19dfee7bbb
2 changed files with 21 additions and 6 deletions
|
@ -15,8 +15,17 @@ if __name__ == "__main__":
|
|||
mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
|
||||
status = createStrip("mastodon.png")
|
||||
if status == 0:
|
||||
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
|
||||
mastodon.status_post("Nuova striscia",media_ids=new_strip)
|
||||
published = False
|
||||
for i in range(1,100):
|
||||
try:
|
||||
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
|
||||
mastodon.status_post("Nuova striscia",media_ids=new_strip)
|
||||
published = True
|
||||
except:
|
||||
continue
|
||||
break
|
||||
if not(published):
|
||||
print("Auth error")
|
||||
else:
|
||||
print("error creating image\n")
|
||||
print(status)
|
||||
|
|
|
@ -15,10 +15,16 @@ if __name__ == "__main__":
|
|||
auth = tweepy.OAuthHandler(tokens[0],tokens[1])
|
||||
auth.set_access_token(tokens[2],tokens[3])
|
||||
api = tweepy.API(auth)
|
||||
try:
|
||||
api.verify_credentials()
|
||||
api.update_with_media(fileDir+"twitter.png","Generatore automatico di strip. Striscia di oggi.")
|
||||
except:
|
||||
published = False
|
||||
for i in range(0,100):
|
||||
try:
|
||||
api.verify_credentials()
|
||||
api.update_with_media(fileDir+"twitter.png","Generatore automatico di strip. Striscia di oggi.")
|
||||
published = True
|
||||
except:
|
||||
continue
|
||||
break
|
||||
if not(published):
|
||||
print("Auth error")
|
||||
else:
|
||||
print("Error creating image\n")
|
||||
|
|
Loading…
Reference in a new issue