Skip to content

Commit

Permalink
shorten file name on upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpyChap committed Aug 26, 2024
1 parent 15dcaae commit b7fd96b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def upload_file_to_pixeldrain(file_path):
url = "https://pixeldrain.com/api/file"
with open(file_path, "rb") as f:
file_path = os.path.basename(file_path)
r = requests.post(url, files={"file": f}, auth=("", os.getenv("PIXELDRAIN_KEY")), data={"name": file_path, "anonymous": False})
r = requests.post(url, files={"file": f}, auth=("", os.getenv("PIXELDRAIN_KEY")), data={"name": file_path.split(".")[0] + ".zip", "anonymous": False})
if r.status_code == 201:
print(f"File {file_path} uploaded successfully: {r.json()["id"]}")
return r.json()["id"]
Expand Down

0 comments on commit b7fd96b

Please sign in to comment.