|
|
|
@ -16,8 +16,8 @@ class Notifiarr:
|
|
|
|
|
self.test = params["test"]
|
|
|
|
|
logger.secret(self.apikey)
|
|
|
|
|
logger.debug(f"Environment: {'Test' if self.test else 'Develop' if self.develop else 'Production'}")
|
|
|
|
|
url, _ = self.get_url("user/validate/")
|
|
|
|
|
response = self.config.get(url)
|
|
|
|
|
url, _ = self.get_url("user/pmm/")
|
|
|
|
|
response = self.config.get(url, params={"fetch": "settings"})
|
|
|
|
|
try:
|
|
|
|
|
response_json = response.json()
|
|
|
|
|
except JSONDecodeError as e:
|
|
|
|
@ -26,7 +26,7 @@ class Notifiarr:
|
|
|
|
|
if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"):
|
|
|
|
|
logger.debug(f"Response: {response_json}")
|
|
|
|
|
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
|
|
|
|
|
if not params["test"] and not response_json["details"]["response"]:
|
|
|
|
|
if not self.test and not response_json["details"]["response"]:
|
|
|
|
|
raise Failed("Notifiarr Error: Invalid apikey")
|
|
|
|
|
|
|
|
|
|
def get_url(self, path):
|
|
|
|
|