From 9569a7cc514b878a4b9aeb35729e368f8b04342d Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Wed, 14 Feb 2024 20:27:57 -0500 Subject: [PATCH] tweak, don't allow 200s --- ntclient/services/api/__init__.py | 1 + ntclient/services/bugs.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ntclient/services/api/__init__.py b/ntclient/services/api/__init__.py index 02fb4cd..2813c32 100644 --- a/ntclient/services/api/__init__.py +++ b/ntclient/services/api/__init__.py @@ -15,6 +15,7 @@ REQUEST_CONNECT_TIMEOUT = 5 # TODO: try all of these; cache (save in prefs.json) the one which works first URLS_API = ( "https://api.nutra.tk", + "http://216.218.228.93", # dev "http://216.218.216.163", # prod ) diff --git a/ntclient/services/bugs.py b/ntclient/services/bugs.py index 3a8cd6a..9315b94 100644 --- a/ntclient/services/bugs.py +++ b/ntclient/services/bugs.py @@ -11,6 +11,7 @@ import traceback import ntclient.services.api from ntclient.persistence.sql.nt import sql as sql_nt +from ntclient.utils import CLI_CONFIG def insert(args: list, exception: Exception) -> None: @@ -63,11 +64,13 @@ def submit_bugs() -> int: for bug in sql_bugs: _res = api_client.post_bug(bug) + if CLI_CONFIG.debug: + print(_res.json()) - # Differentially store unique vs. duplicate bugs (someone else submitted) + # Distinguish bug which are unique vs. duplicates (someone else submitted) if _res.status_code == 201: sql_nt("UPDATE bug SET submitted = 1 WHERE id = %s", bug.id) - elif _res.status_code in {200, 204}: + elif _res.status_code == 204: sql_nt("UPDATE bug SET submitted = 2 WHERE id = %s", bug.id) print(".", end="", flush=True) -- 2.52.0