Update upload-pkg.py

This commit is contained in:
Molly Sophia 2023-12-21 07:11:21 +00:00
parent 1a3c297c9e
commit 6fb6d774d2

View File

@ -34,11 +34,14 @@ def UploadFile(url: str, file: str, code: int = 201):
with open(file, "rb") as f:
res = put(url, f.read())
text = GetReasonText(res)
if res.status_code != code:
raise RequestException(
"upload %s status not %d: %d (%s)" %
(file, code, res.status_code, text)
)
if res.status_code != code :
if res.status_code == 409:
info("target already exists; not overwritting")
else
raise RequestException(
"upload %s status not %d: %d (%s)" %
(file, code, res.status_code, text)
)
def UploadPackage(