]> Nutra Git (v1) - nutratech/cli.git/commitdiff
wip URLS_API (try all available hosts)
authorShane Jaroch <chown_tee@proton.me>
Wed, 14 Feb 2024 15:41:49 +0000 (10:41 -0500)
committerShane Jaroch <chown_tee@proton.me>
Wed, 14 Feb 2024 15:41:49 +0000 (10:41 -0500)
ntclient/services/api/__init__.py

index c75d95218bcac170e3535a3ea85c4996d262daab..e5d6990ae3d9fd43d57a8a7540da841e95c9be29 100644 (file)
@@ -8,6 +8,12 @@ Created on Tue Feb 13 14:28:20 2024
 import requests
 
 URL_API = "https://api.nutra.tk"
+# TODO: try all of these; cache (save in prefs.json) the one which works first
+URLS_API = (
+    "https://api.nutra.tk",
+    "https://216.218.216.163/api",  # prod
+    "https://216.218.228.93/api",  # dev
+)
 REQUEST_READ_TIMEOUT = 18
 REQUEST_CONNECT_TIMEOUT = 5
 
@@ -40,6 +46,7 @@ class ApiClient:
         req.raise_for_status()
         return dict(req.json())
 
+    # TODO: move this outside class; support with host iteration helper method
     def post_bug(self, bug: tuple) -> None:
         """Post a bug report to the developer."""
         print("posting bug report...")