-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbackup.py
More file actions
28 lines (21 loc) · 843 Bytes
/
backup.py
File metadata and controls
28 lines (21 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json
from dotenv import load_dotenv
load_dotenv()
from cloudinary import uploader, config
# get reference to config instance
config = config(secure=True)
print(config.cloud_name)
print(config.api_key)
# DOCS: https://cloudinary.com/documentation/backups_and_version_management
# Upload and ensure asset is backed up
# backup = uploader.upload("assets/sealion.jpg",
# public_id = "sealion00",
# overwrite = True,
# backup = True)
# print("**** Upload and ensure asset is backed up ****\n Response:\n", json.dumps(backup,indent=2), "\n")
# Example to show a restore when a mistake is made
mistake = uploader.upload("assets/puma.jpg",
public_id = "sealion00",
overwrite = True,
backup = True)
print("**** Upload another asset by mistake with the same public ID ****\n Response:\n", json.dumps(mistake,indent=2), "\n")