mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 15:04:21 +00:00
webhook response fix
This commit is contained in:
parent
022857435f
commit
bcaf88ae77
1 changed files with 10 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
from json import JSONDecodeError
|
||||
|
||||
from modules.util import Failed
|
||||
|
||||
|
@ -25,11 +26,15 @@ class Webhooks:
|
|||
response = self.config.get(url, json=json, params=params)
|
||||
else:
|
||||
response = self.config.post(webhook, json=json)
|
||||
try:
|
||||
response_json = response.json()
|
||||
if self.config.trace_mode:
|
||||
logger.debug(f"Response: {response_json}")
|
||||
if response.status_code >= 400 or ("result" in response_json and response_json["result"] == "error"):
|
||||
raise Failed(f"({response.status_code} [{response.reason}]) {response_json}")
|
||||
except JSONDecodeError:
|
||||
if response.status_code >= 400:
|
||||
raise Failed(f"({response.status_code} [{response.reason}])")
|
||||
|
||||
def start_time_hooks(self, start_time):
|
||||
if self.run_start_webhooks:
|
||||
|
|
Loading…
Reference in a new issue