-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathcloud_storage.py
More file actions
30 lines (19 loc) · 879 Bytes
/
cloud_storage.py
File metadata and controls
30 lines (19 loc) · 879 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
29
30
import dropbox
class TransferData:
def __init__(self, access_token):
self.access_token = access_token
def upload_file(self, file_from, file_to):
dbx = dropbox.Dropbox(self.access_token)
f = open(file_from, 'rb')
dbx.files_upload(f.read(), file_to)
def main():
access_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
transferData = TransferData(access_token)
file_from = input("Enter the file path to transfer : -")
file_to = input(
"enter the full path to upload to dropbox:- "
) # This is the full path to upload the file to, including name that you wish the file to be called once uploaded.
# API v2
transferData.upload_file(file_from, file_to)
print("file has been moved !!!")
main()