From 54a111d669152a81b61dfcf245db04a6cb11d8d9 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 27 Nov 2024 19:46:18 +0100 Subject: [PATCH] Fix last ID not saving when using --json --- toot/cli/post.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toot/cli/post.py b/toot/cli/post.py index 3daf911..d6bbb66 100644 --- a/toot/cli/post.py +++ b/toot/cli/post.py @@ -184,10 +184,11 @@ def post( poll_hide_totals=poll_hide_totals, ) + status = response.json() + if json: click.echo(response.text) else: - status = response.json() if "scheduled_at" in status: scheduled_at = parse_datetime(status["scheduled_at"]) scheduled_at = datetime.strftime(scheduled_at, "%Y-%m-%d %H:%M:%S%z") @@ -195,7 +196,7 @@ def post( else: 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()