halamadrid7
BANNED
- Jan 19, 2023
- 266
- 117
from BunnyCDN.Storage import Storage
# Initialize BunnyCDN Storage object with your API key and storage zone name
obj_storage = Storage('723fbcb5-1fd5c4eed0137a8bd-abaa-4fddb9faf17d', 'testing-dec')
# Specify the file name (without path)
file_name = 'Image.jpg'
# Specify the storage path (directory) where you want to upload the file
storage_path = 'testing-dec/Images/' + file_name # Specify the directory and file name where you want to upload
# Upload the file
response = obj_storage.PutFile(file_name, storage_path)
# Check the response
if response['status'] == 'success':
print("File uploaded successfully.")
else:
print("Failed to upload file. Error:", response['msg'])
I am getting 401 error. Can any one provide new code or changes to upload and get images from local storage to folder in storage?