Make sure we are logged to get max_characters

This commit is contained in:
jeancf 2023-07-19 19:45:43 +02:00
parent a50a077cd3
commit b6396f7b51

View File

@ -1150,13 +1150,14 @@ def main(argv):
mastodon = login(mast_password)
# Check toot character limit on mastodon instance
try:
max_characters = mastodon.instance().configuration.statuses['max_characters']
logging.debug('Instance character limit is '+ str(max_characters))
except Exception:
# Default value for Mastodon
max_characters = 500
logging.debug('Tried to get toot character limit from Mastodon instance but failed. Assuming 500')
if mastodon is not None:
try:
max_characters = mastodon.instance().configuration.statuses['max_characters']
logging.debug('Instance character limit is '+ str(max_characters))
except Exception:
# Default value for Mastodon
max_characters = 500
logging.debug('Tried to get toot character limit from Mastodon instance but failed. Assuming 500')
# **********************************************************
# Iterate tweets in list.