external delete button

This commit is contained in:
vabene1111
2019-12-25 15:54:23 +01:00
parent 4b0164a676
commit e2301c0c3a
7 changed files with 84 additions and 31 deletions

View File

@ -27,7 +27,7 @@ class Dropbox(Provider):
try:
recipes = r.json()
except ValueError:
log_entry = SyncLog(status='ERROR', msg=str(r), monitor=monitor)
log_entry = SyncLog(status='ERROR', msg=str(r), sync=monitor)
log_entry.save()
return r
@ -105,3 +105,20 @@ class Dropbox(Provider):
r = requests.post(url, headers=headers, data=json.dumps(data))
return r.json()
@staticmethod
def delete_file(recipe):
url = "https://api.dropboxapi.com/2/files/delete_v2"
headers = {
"Authorization": "Bearer " + recipe.storage.token,
"Content-Type": "application/json"
}
data = {
"path": recipe.file_path
}
r = requests.post(url, headers=headers, data=json.dumps(data))
return r.json()