From: Shane Jaroch Date: Wed, 14 Feb 2024 15:41:49 +0000 (-0500) Subject: wip URLS_API (try all available hosts) X-Git-Tag: v0.2.8.dev0~43 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=598def479d4ca7316340b56381869602d6a0746f;p=nutratech%2Fcli.git wip URLS_API (try all available hosts) --- diff --git a/ntclient/services/api/__init__.py b/ntclient/services/api/__init__.py index c75d952..e5d6990 100644 --- a/ntclient/services/api/__init__.py +++ b/ntclient/services/api/__init__.py @@ -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...")