Skip to content

Commit

Permalink
implement deleting all incomplete resumables
Browse files Browse the repository at this point in the history
  • Loading branch information
leondutoit committed Mar 22, 2019
1 parent 39ab62a commit 642333d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='tsd-api-client',
version='1.5.0',
version='1.6.0',
description='A client for the TSD REST API',
author='Leon du Toit',
author_email='[email protected]',
Expand Down
23 changes: 21 additions & 2 deletions tsdapiclient/fileapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,28 @@ def delete_resumable(env, pnum, token, filename, upload_id, dev_url=None):
else:
url = '%s/%s/files/resumables/%s?id=%s' % (ENV[env], pnum, filename, upload_id)
resp = requests.delete(url, headers={'Authorization': 'Bearer ' + token})
print 'Upload: %s, for filename %s deleted' % (upload_id, filename)
print 'Upload: %s, for filename: %s deleted' % (upload_id, filename)
return json.loads(resp.text)


def delete_all_resumables(env, pnum, token, dev_url=None):
pass
"""
Delete all incomplete resumables.
Parameters
----------
env: str, 'test' or 'prod'
pnum: str, project number
token: str, JWT
dev_url: str, pass a complete url (useful for development)
Returns
-------
dict
"""
overview = get_resumable(env, pnum, token, dev_url)
all_resumables = overview['resumables']
for r in all_resumables:
delete_resumable(env, pnum, token, r['filename'], r['id'])
return

0 comments on commit 642333d

Please sign in to comment.