mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Improved logging
This commit is contained in:
parent
ee403a5301
commit
17b4f673bb
5
twoot.py
5
twoot.py
|
@ -241,12 +241,16 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
|||
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")
|
||||
|
||||
mastodon = login(mast_password)
|
||||
# Update profile on Mastodon
|
||||
|
@ -257,6 +261,7 @@ def update_profile(nitter_url, soup, sql, mast_password):
|
|||
logging.error("Could not update profile")
|
||||
logging.error(e)
|
||||
else:
|
||||
logging.debug("Profile updated on Mastodon")
|
||||
# Add urls to database
|
||||
db.execute("UPDATE profiles SET avatar_url=?, banner_url=? WHERE mastodon_instance=? AND mastodon_account=?", (new_avatar_url, new_banner_url, TOML['config']['mastodon_instance'], TOML['config']['mastodon_user']))
|
||||
sql.commit()
|
||||
|
|
Loading…
Reference in New Issue
Block a user