From 17b4f673bbc0538464c1246e2b937eab0800b949 Mon Sep 17 00:00:00 2001 From: jeancf Date: Thu, 15 Jun 2023 17:32:21 +0200 Subject: [PATCH] Improved logging --- twoot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/twoot.py b/twoot.py index 6e5ff64..c2157f4 100755 --- a/twoot.py +++ b/twoot.py @@ -241,12 +241,16 @@ def update_profile(nitter_url, soup, sql, mast_password): new_avatar_mime = new_avatar.headers['content-type'] if new_avatar.status_code == 200 else None if new_avatar.status_code !=200: logging.error("Could not download avatar image from " + nitter_url + new_avatar_url) + else: + logging.debug("Avatar image downloaded") new_banner = requests.get(nitter_url + new_banner_url, timeout=HTTPS_REQ_TIMEOUT) if new_banner_url is not None else None new_banner_img = new_banner.content if new_banner.status_code == 200 else None new_banner_mime = new_banner.headers['content-type'] if new_banner.status_code == 200 else None if new_banner.status_code !=200: logging.error("Could not download banner image from " + nitter_url + new_banner_url) + else: + logging.debug("Banner image downloaded") mastodon = login(mast_password) # Update profile on Mastodon @@ -257,6 +261,7 @@ def update_profile(nitter_url, soup, sql, mast_password): logging.error("Could not update profile") logging.error(e) else: + logging.debug("Profile updated on Mastodon") # Add urls to database db.execute("UPDATE profiles SET avatar_url=?, banner_url=? WHERE mastodon_instance=? AND mastodon_account=?", (new_avatar_url, new_banner_url, TOML['config']['mastodon_instance'], TOML['config']['mastodon_user'])) sql.commit()