mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-12-18 00:00:17 +00:00
Fixed undefined variable error
This commit is contained in:
parent
503dc42f25
commit
36298925ac
13
twoot.py
13
twoot.py
|
@ -233,6 +233,11 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
||||||
if changed:
|
if changed:
|
||||||
logging.info('updating profile on Mastodon')
|
logging.info('updating profile on Mastodon')
|
||||||
|
|
||||||
|
new_avatar_img = None
|
||||||
|
new_avatar_mime = None
|
||||||
|
new_banner_img = None
|
||||||
|
new_banner_mime = None
|
||||||
|
|
||||||
# Download images
|
# Download images
|
||||||
new_avatar = requests.get(nitter_url + new_avatar_url, timeout=HTTPS_REQ_TIMEOUT) if new_avatar_url is not None else None
|
new_avatar = requests.get(nitter_url + new_avatar_url, timeout=HTTPS_REQ_TIMEOUT) if new_avatar_url is not None else None
|
||||||
if new_avatar is not None:
|
if new_avatar is not None:
|
||||||
|
@ -253,13 +258,11 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
||||||
logging.debug("Banner image downloaded")
|
logging.debug("Banner image downloaded")
|
||||||
|
|
||||||
mastodon = login(mast_password)
|
mastodon = login(mast_password)
|
||||||
|
|
||||||
# Update profile on Mastodon
|
# Update profile on Mastodon
|
||||||
# media.content, mime_type=media.headers['content-type']
|
|
||||||
try:
|
try:
|
||||||
if new_avatar_img is not None:
|
mastodon.account_update_credentials(avatar=new_avatar_img, avatar_mime_type=new_avatar_mime, header=new_banner_img, header_mime_type=new_banner_mime)
|
||||||
mastodon.account_update_credentials(avatar=new_avatar_img, avatar_mime_type=new_avatar_mime)
|
logging.debug("Images uploaded")
|
||||||
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:
|
except Exception as e:
|
||||||
logging.error("Could not update profile")
|
logging.error("Could not update profile")
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user