mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 09:04:28 +03:00
improve plus error messages
This commit is contained in:
parent
386dd689f8
commit
32f0b56b0f
@ -68,11 +68,13 @@ class PlusApi:
|
|||||||
or self._token_data["expires"] - datetime.datetime.now().timestamp() < 60
|
or self._token_data["expires"] - datetime.datetime.now().timestamp() < 60
|
||||||
):
|
):
|
||||||
if self.key is None:
|
if self.key is None:
|
||||||
raise Exception("Plus API not activated")
|
raise Exception(
|
||||||
|
"Plus API key not set. See https://docs.frigate.video/integrations/plus#set-your-api-key"
|
||||||
|
)
|
||||||
parts = self.key.split(":")
|
parts = self.key.split(":")
|
||||||
r = requests.get(f"{self.host}/v1/auth/token", auth=(parts[0], parts[1]))
|
r = requests.get(f"{self.host}/v1/auth/token", auth=(parts[0], parts[1]))
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
raise Exception("Unable to refresh API token")
|
raise Exception(f"Unable to refresh API token: {r.text}")
|
||||||
self._token_data = r.json()
|
self._token_data = r.json()
|
||||||
|
|
||||||
def _get_authorization_header(self) -> dict:
|
def _get_authorization_header(self) -> dict:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user