Skip to content

Commit

Permalink
Corrige verificação do resultado do webhook_validate
Browse files Browse the repository at this point in the history
  • Loading branch information
valterf committed Sep 15, 2021
1 parent ca052cd commit b3fb22f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions cpqdtrd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,20 @@ def root_callback(job_id):
self._webhook_port,
crt=self._crt,
token=self._validation_token,
)
if r.status_code == 200:
if not r.json()["reachable"]:
raise ConnectionError(
"{}:{} not reachable by the transcription server".format(
self._webhook_host, self._webhook_port
)
).json()
if "reachable" not in r:
raise ConnectionError(
"{}:{} Error in validation. Reason: {}".format(
self._webhook_host, self._webhook_port, r
)
)
if not r["reachable"]:
raise ConnectionError(
"{}:{} not reachable by the transcription server.".format(
self._webhook_host, self._webhook_port
)
)


def __del__(self):
self.stop()
Expand Down

0 comments on commit b3fb22f

Please sign in to comment.