mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
try regetting token once if auth error during download
This commit is contained in:
parent
7c0a947bf4
commit
06e0775904
1 changed files with 3 additions and 2 deletions
|
|
@ -97,7 +97,6 @@ class CotalityClient:
|
|||
url = f"{self.base}/jobs/{job_id}/evidence"
|
||||
|
||||
r = self.session.get(url)
|
||||
|
||||
if r.status_code == 401:
|
||||
raise UnauthorizedError("Token expired or invalid")
|
||||
|
||||
|
|
@ -112,6 +111,9 @@ class CotalityClient:
|
|||
params = {"evidenceIds": evidence_id}
|
||||
|
||||
r = self.session.get(url, params=params)
|
||||
if r.status_code == 401:
|
||||
raise UnauthorizedError()
|
||||
|
||||
r.raise_for_status()
|
||||
|
||||
return EvidenceMetadata.from_api(r.json())
|
||||
|
|
@ -126,7 +128,6 @@ class CotalityClient:
|
|||
|
||||
def _download_file(self, url: str, file_name: str) -> None:
|
||||
r = requests.get(url)
|
||||
|
||||
if r.status_code == 401:
|
||||
raise UnauthorizedError()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue