mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Catch case where no image is set
This commit is contained in:
parent
17b4f673bb
commit
f233592d75
26
twoot.py
26
twoot.py
|
@ -237,20 +237,22 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
|||
|
||||
# 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_img = new_avatar.content if new_avatar.status_code == 200 else None
|
||||
new_avatar_mime = new_avatar.headers['content-type'] if new_avatar.status_code == 200 else None
|
||||
if new_avatar.status_code !=200:
|
||||
logging.error("Could not download avatar image from " + nitter_url + new_avatar_url)
|
||||
else:
|
||||
logging.debug("Avatar image downloaded")
|
||||
if new_avatar is not None:
|
||||
new_avatar_img = new_avatar.content if new_avatar.status_code == 200 else None
|
||||
new_avatar_mime = new_avatar.headers['content-type'] if new_avatar.status_code == 200 else None
|
||||
if new_avatar.status_code !=200:
|
||||
logging.error("Could not download avatar image from " + nitter_url + new_avatar_url)
|
||||
else:
|
||||
logging.debug("Avatar image downloaded")
|
||||
|
||||
new_banner = requests.get(nitter_url + new_banner_url, timeout=HTTPS_REQ_TIMEOUT) if new_banner_url is not None else None
|
||||
new_banner_img = new_banner.content if new_banner.status_code == 200 else None
|
||||
new_banner_mime = new_banner.headers['content-type'] if new_banner.status_code == 200 else None
|
||||
if new_banner.status_code !=200:
|
||||
logging.error("Could not download banner image from " + nitter_url + new_banner_url)
|
||||
else:
|
||||
logging.debug("Banner image downloaded")
|
||||
if new_banner is not None:
|
||||
new_banner_img = new_banner.content if new_banner.status_code == 200 else None
|
||||
new_banner_mime = new_banner.headers['content-type'] if new_banner.status_code == 200 else None
|
||||
if new_banner.status_code !=200:
|
||||
logging.error("Could not download banner image from " + nitter_url + new_banner_url)
|
||||
else:
|
||||
logging.debug("Banner image downloaded")
|
||||
|
||||
mastodon = login(mast_password)
|
||||
# Update profile on Mastodon
|
||||
|
|
Loading…
Reference in New Issue
Block a user