From: Shane Jaroch Date: Thu, 15 Feb 2024 01:27:57 +0000 (-0500) Subject: tweak, don't allow 200s X-Git-Tag: v0.2.8.dev0~36 X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=9569a7cc514b878a4b9aeb35729e368f8b04342d;p=nutratech%2Fcli.git tweak, don't allow 200s --- 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)