add explicit error messages
This commit is contained in:
parent
2710d025db
commit
95e8420471
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -14,8 +14,8 @@ def try_to_get_carousel(array, post):
|
||||||
return urls
|
return urls
|
||||||
print(Fore.GREEN + "🎠 > Found carousel!")
|
print(Fore.GREEN + "🎠 > Found carousel!")
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
except:
|
except Exception as e:
|
||||||
print(Fore.RED + "🎠💥 > No carousel :( ")
|
print(Fore.RED + "🎠💥 > No carousel :( \n", e)
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
return array
|
return array
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ def get_image(url):
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
|
|
||||||
return response.content
|
return response.content
|
||||||
except:
|
except Exception as e:
|
||||||
|
|
||||||
print(Fore.RED + "💥 > Failed to download image.")
|
print(Fore.RED + "💥 > Failed to download image. \n", e)
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,27 +31,26 @@ def upload_image_to_mastodon(url, mastodon):
|
||||||
print(Fore.GREEN + "✨ > Uploaded!")
|
print(Fore.GREEN + "✨ > Uploaded!")
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
return media["id"]
|
return media["id"]
|
||||||
except:
|
except Exception as e:
|
||||||
print(Fore.RED + "💥 > failed to upload image to mastodon")
|
print(Fore.RED + "💥 > failed to upload image to mastodon. \n", e)
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
|
|
||||||
def toot(urls, title, mastodon, fetched_user ):
|
def toot(urls, title, mastodon, fetched_user ):
|
||||||
#try:
|
try:
|
||||||
print(Fore.YELLOW + "🐘 > Creating Toot...", title)
|
print(Fore.YELLOW + "🐘 > Creating Toot...", title)
|
||||||
print(Style.RESET_ALL)
|
print(Style.RESET_ALL)
|
||||||
ids = []
|
ids = []
|
||||||
for url in urls:
|
for url in urls:
|
||||||
ids.append(upload_image_to_mastodon(url, mastodon))
|
ids.append(upload_image_to_mastodon(url, mastodon))
|
||||||
print(url)
|
print(url)
|
||||||
post_text = str(title) + "\n" + "crosposted from https://instagram.com/"+fetched_user # creating post text
|
post_text = str(title) + "\n" + "crosposted from https://instagram.com/"+fetched_user # creating post text
|
||||||
post_text = post_text[0:1000]
|
post_text = post_text[0:1000]
|
||||||
print(ids)
|
print(ids)
|
||||||
mastodon.status_post(post_text, media_ids = ids)
|
mastodon.status_post(post_text, media_ids = ids)
|
||||||
|
|
||||||
#except:
|
except Exception as e:
|
||||||
# print(urls)
|
print(Fore.RED + "😿 > Failed to create toot \n", e)
|
||||||
# print(Fore.RED + "😿 > Failed to create toot")
|
print(Style.RESET_ALL)
|
||||||
# print(Style.RESET_ALL)
|
|
||||||
|
|
||||||
def get_new_posts(mastodon, profile, mastodon_carousel_size, post_limit, already_posted_path, using_mastodon, carousel_size, post_interval, fetched_user):
|
def get_new_posts(mastodon, profile, mastodon_carousel_size, post_limit, already_posted_path, using_mastodon, carousel_size, post_interval, fetched_user):
|
||||||
posts = profile.get_posts()
|
posts = profile.get_posts()
|
||||||
|
|
Loading…
Reference in New Issue