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