Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# errors
upload_list.append(("file", open(attachment, "rb").read()))
upload_pairs = tuple(upload_list)
try:
self.zinstance._check_backoff()
upload = requests.post(
url=authdata["url"],
files=upload_pairs,
headers={
# "Content-Type": authdata['contentType'],
"User-Agent": "Pyzotero/%s"
% __version__
},
)
except (requests.exceptions.ConnectionError):
raise ze.UploadError("ConnectionError")
try:
upload.raise_for_status()
except requests.exceptions.HTTPError:
error_handler(zinstance, upload)
backoff = upload.get("backoff")
if backoff:
zinstance._set_backoff(backoff)
# now check the responses
return self._register_upload(authdata, reg_key)