From 503dc42f25056dee588a9eeb5e017248fa46e44c Mon Sep 17 00:00:00 2001 From: jeancf Date: Thu, 15 Jun 2023 18:09:46 +0200 Subject: [PATCH] Split account update in 2 calls --- twoot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index 8dfab80..624780c 100755 --- a/twoot.py +++ b/twoot.py @@ -256,7 +256,10 @@ def update_profile(nitter_url, soup, sql, mast_password): # Update profile on Mastodon # media.content, mime_type=media.headers['content-type'] try: - mastodon.account_update_credentials(avatar=new_avatar_img, avatar_mime_type=new_avatar_mime, header=new_banner_img, header_mime_type=new_banner_mime) + if new_avatar_img is not None: + mastodon.account_update_credentials(avatar=new_avatar_img, avatar_mime_type=new_avatar_mime) + if new_banner_img is not None: + mastodon.account_update_credentials(header=new_banner_img, header_mime_type=new_banner_mime) except Exception as e: logging.error("Could not update profile") logging.error(e)