mirror of
https://gitlab.com/oloturia/fumcaso.git
synced 2025-01-08 22:47:17 +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)
|
mastodon = Mastodon(access_token = TOKEN,api_base_url = API_URL)
|
||||||
status = createStrip("mastodon.png")
|
status = createStrip("mastodon.png")
|
||||||
if status == 0:
|
if status == 0:
|
||||||
new_strip = mastodon.media_post(fileDir+"mastodon.png","image/png")
|
published = False
|
||||||
mastodon.status_post("Nuova striscia",media_ids=new_strip)
|
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:
|
else:
|
||||||
print("error creating image\n")
|
print("error creating image\n")
|
||||||
print(status)
|
print(status)
|
||||||
|
|
|
@ -15,10 +15,16 @@ if __name__ == "__main__":
|
||||||
auth = tweepy.OAuthHandler(tokens[0],tokens[1])
|
auth = tweepy.OAuthHandler(tokens[0],tokens[1])
|
||||||
auth.set_access_token(tokens[2],tokens[3])
|
auth.set_access_token(tokens[2],tokens[3])
|
||||||
api = tweepy.API(auth)
|
api = tweepy.API(auth)
|
||||||
try:
|
published = False
|
||||||
api.verify_credentials()
|
for i in range(0,100):
|
||||||
api.update_with_media(fileDir+"twitter.png","Generatore automatico di strip. Striscia di oggi.")
|
try:
|
||||||
except:
|
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")
|
print("Auth error")
|
||||||
else:
|
else:
|
||||||
print("Error creating image\n")
|
print("Error creating image\n")
|
||||||
|
|
Loading…
Reference in a new issue