share link fixed

This commit is contained in:
vabene1111
2018-06-07 00:29:00 +02:00
parent b9994e6a45
commit be32b3f63e
3 changed files with 26 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ def import_all(monitor):
return True
def get_share_link(recipe):
def create_share_link(recipe):
url = "https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings"
headers = {
@@ -59,4 +59,27 @@ def get_share_link(recipe):
}
r = requests.post(url, headers=headers, data=json.dumps(data))
return r.json()
def get_share_link(recipe):
url = "https://api.dropboxapi.com/2/sharing/list_shared_links"
headers = {
"Authorization": "Bearer " + recipe.storage.token,
"Content-Type": "application/json"
}
data = {
"path": recipe.file_uid
}
r = requests.post(url, headers=headers, data=json.dumps(data))
p = r.json()
for l in p['links']:
return l['url']
response = create_share_link(recipe)
return response['url']