]> Nutra Git (v1) - nutratech/cli.git/commitdiff
tweak, don't allow 200s
authorShane Jaroch <chown_tee@proton.me>
Thu, 15 Feb 2024 01:27:57 +0000 (20:27 -0500)
committerShane Jaroch <chown_tee@proton.me>
Thu, 15 Feb 2024 01:27:57 +0000 (20:27 -0500)
ntclient/services/api/__init__.py
ntclient/services/bugs.py

index 02fb4cde061ecfd8a1f0fc188619d32f9f4e4e15..2813c3277ea9409462dbd29009fffca213fc349f 100644 (file)
@@ -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
 )
 
index 3a8cd6ab883c7a9bbaaa1b46a714f455a06ac001..9315b94a40f0b4db91fe567000bee29054cea149 100644 (file)
@@ -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)