Skip to content

Instantly share code, notes, and snippets.

@MS-Jahan
Last active July 30, 2020 09:16
Show Gist options
  • Select an option

  • Save MS-Jahan/b118ba91d434909207ce3af54726b012 to your computer and use it in GitHub Desktop.

Select an option

Save MS-Jahan/b118ba91d434909207ce3af54726b012 to your computer and use it in GitHub Desktop.
Save files to Dropbox using url and get url from Dropbox - Python API usage
import dropbox
import time
dbx = dropbox.Dropbox('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') #Dropbox API
path = input("Enter full path of file in Dropbox: ") #root directory means /
url = input("Enter the file download link: ")
result = dbx.files_save_url(path, url)
result = str(result).replace("SaveUrlResult('async_job_id', '", '').replace("\')",'')
while(1):
for x in range(2):
response = dbx.files_save_url_check_job_status(result)
print(response)
time.sleep(2)
option = input("Want to exit? (y/n)")
if(option == "y" or option == "Y"):
break
else:
pass
option = input("Want to get download link? (y/n)")
if option == "n" or option == "N":
pass
else:
res = dbx.files_get_temporary_link(path)
print(res.link)
# response = dbx.files_delete(path)
# print(response)
n = input("Exit?")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment