Skip to content

Commit

Permalink
Fix style / lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbostock committed Feb 20, 2024
1 parent 78b4575 commit 62b5b12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scribemi/ScribeMi.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ def fetch_model(self, task: MITask):
res = requests.get(modelUrl)
if res.status_code == 200:
md5checksum_expected = res.headers['ETag'].replace('"', '')
md5checksum = md5(res.text.encode()).hexdigest()
md5checksum = md5(res.text.encode(), usedforsecurity=False).hexdigest()
if md5checksum != md5checksum_expected:
raise Exception("Integrity Error: invalid checksum. Please retry.")
raise Exception(
"Integrity Error: invalid checksum. Please retry."
)

return json.loads(res.text)
elif res.status_code == 401 or res.status_code == 403:
Expand Down Expand Up @@ -500,6 +502,6 @@ def delete_task(self, task: MITask):


def upload_file(file, md5checksum, url):
res = requests.put(url, data=file, headers={ 'Content-MD5': md5checksum })
res = requests.put(url, data=file, headers={'Content-MD5': md5checksum})
if res.status_code != 200:
raise Exception("Error uploading file: {}".format(res.status_code))

0 comments on commit 62b5b12

Please sign in to comment.