1
0
mirror of https://github.com/ihabunek/toot.git synced 2025-01-03 14:56:37 -05:00

Fix last ID not saving when using --json

This commit is contained in:
Ivan Habunek 2024-11-27 19:46:18 +01:00
parent eb175029a8
commit 54a111d669
No known key found for this signature in database
GPG Key ID: 01DB3DD0D824504C

View File

@ -184,10 +184,11 @@ def post(
poll_hide_totals=poll_hide_totals, poll_hide_totals=poll_hide_totals,
) )
status = response.json()
if json: if json:
click.echo(response.text) click.echo(response.text)
else: else:
status = response.json()
if "scheduled_at" in status: if "scheduled_at" in status:
scheduled_at = parse_datetime(status["scheduled_at"]) scheduled_at = parse_datetime(status["scheduled_at"])
scheduled_at = datetime.strftime(scheduled_at, "%Y-%m-%d %H:%M:%S%z") scheduled_at = datetime.strftime(scheduled_at, "%Y-%m-%d %H:%M:%S%z")
@ -195,7 +196,7 @@ def post(
else: else:
click.echo(f"Toot posted: {status['url']}") click.echo(f"Toot posted: {status['url']}")
save_last_post_id(app, user, status["id"]) save_last_post_id(app, user, status["id"])
delete_tmp_status_file() delete_tmp_status_file()