From 5be406f7659b899f894ca10bbede9ee83575b938 Mon Sep 17 00:00:00 2001 From: jeancf Date: Wed, 14 Jun 2023 17:10:00 +0200 Subject: [PATCH] Update code added --- twoot.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index 093c018..d7e8195 100755 --- a/twoot.py +++ b/twoot.py @@ -197,13 +197,24 @@ def update_profile(soup, db, mast_password): # Check if urls have changed if new_avatar_url == cur_avatar_url: new_avatar_url = None + else: + logging.info('avatar image changed on twitter profile') if new_banner_url == cur_banner_url: new_banner_url = None + else: + logging.info('banner image changed on twitter profile') mastodon = None if new_avatar_url is not None or new_banner_url is not None: + logging.info('updating profile on Mastodon') mastodon = login(mast_password) - # TODO update profile on Mastodon + # Update profile on Mastodon + try: + mastodon.account_update_credentials(avatar=new_avatar_url, header=new_banner_url) + except Exception as e: + logging.error("Could not update profile") + logging.error(e) + # TODO update database return mastodon