From 166c7657fdfce31afc6bc2e9e1a0f1d461b27f3e Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Sun, 8 Feb 2026 00:12:55 -0300 Subject: [PATCH] Fix CLI bugs: conditional strptime and status_code() call - Move datetime.strptime() calls inside the None-check blocks to prevent TypeError when before/after are not provided - Fix response.status_code to response.status_code() (method call, not attribute access) Closes #35 --- executable/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/executable/cli.py b/executable/cli.py index d5e2eb7..1406cb4 100644 --- a/executable/cli.py +++ b/executable/cli.py @@ -20,18 +20,18 @@ def bulk_export_to_json( before: str | None = None, after: str | None = None, ): - before_dt = datetime.strptime(before, DATETIME_FORMAT) - after_dt = datetime.strptime(after, DATETIME_FORMAT) client = Client(api_key=API_KEY) queries = [] queries.append(RawQuery(query)) if before is not None: + before_dt = datetime.strptime(before, DATETIME_FORMAT) before_dt_field = UpdateDateField( before_dt, operator=Operator.StrictlyGreater ) queries.append(MustQuery(before_dt_field)) if after is not None: + after_dt = datetime.strptime(after, DATETIME_FORMAT) after_dt_field = UpdateDateField( after_dt, operator=Operator.StrictlySmaller ) @@ -46,7 +46,7 @@ def bulk_export_to_json( else: raise Exception( "API error (code = %d, message = %s)" - % (response.status_code, response.json()) + % (response.status_code(), response.json()) )