diff --git a/src/__pycache__/already_posted.cpython-39.pyc b/src/__pycache__/already_posted.cpython-39.pyc deleted file mode 100644 index e75fed5..0000000 Binary files a/src/__pycache__/already_posted.cpython-39.pyc and /dev/null differ diff --git a/src/__pycache__/converters.cpython-39.pyc b/src/__pycache__/converters.cpython-39.pyc deleted file mode 100644 index 79b35a6..0000000 Binary files a/src/__pycache__/converters.cpython-39.pyc and /dev/null differ diff --git a/src/__pycache__/network.cpython-39.pyc b/src/__pycache__/network.cpython-39.pyc deleted file mode 100644 index 2f895d0..0000000 Binary files a/src/__pycache__/network.cpython-39.pyc and /dev/null differ diff --git a/src/converters.py b/src/converters.py index 65e4b59..cd86475 100644 --- a/src/converters.py +++ b/src/converters.py @@ -14,8 +14,8 @@ def try_to_get_carousel(array, post): return urls print(Fore.GREEN + "🎠 > Found carousel!") print(Style.RESET_ALL) - except: - print(Fore.RED + "🎠💥 > No carousel :( ") + except Exception as e: + print(Fore.RED + "🎠💥 > No carousel :( \n", e) print(Style.RESET_ALL) return array diff --git a/src/network.py b/src/network.py index 8b8e6b0..926f196 100644 --- a/src/network.py +++ b/src/network.py @@ -17,9 +17,9 @@ def get_image(url): print(Style.RESET_ALL) 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) @@ -31,27 +31,26 @@ def upload_image_to_mastodon(url, mastodon): print(Fore.GREEN + "✨ > Uploaded!") print(Style.RESET_ALL) return media["id"] - except: - print(Fore.RED + "💥 > failed to upload image to mastodon") + except Exception as e: + print(Fore.RED + "💥 > failed to upload image to mastodon. \n", e) print(Style.RESET_ALL) def toot(urls, title, mastodon, fetched_user ): - #try: - print(Fore.YELLOW + "🐘 > Creating Toot...", title) - print(Style.RESET_ALL) - ids = [] - for url in urls: - ids.append(upload_image_to_mastodon(url, mastodon)) - print(url) - post_text = str(title) + "\n" + "crosposted from https://instagram.com/"+fetched_user # creating post text - post_text = post_text[0:1000] - print(ids) - mastodon.status_post(post_text, media_ids = ids) + try: + print(Fore.YELLOW + "🐘 > Creating Toot...", title) + print(Style.RESET_ALL) + ids = [] + for url in urls: + ids.append(upload_image_to_mastodon(url, mastodon)) + print(url) + post_text = str(title) + "\n" + "crosposted from https://instagram.com/"+fetched_user # creating post text + post_text = post_text[0:1000] + print(ids) + mastodon.status_post(post_text, media_ids = ids) - #except: - # print(urls) - # print(Fore.RED + "😿 > Failed to create toot") - # print(Style.RESET_ALL) + except Exception as e: + print(Fore.RED + "😿 > Failed to create toot \n", e) + 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): posts = profile.get_posts()