Update code added

This commit is contained in:
jeancf 2023-06-14 17:10:00 +02:00
parent bf0797a002
commit 5be406f765

View File

@ -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