-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
085ee59
commit d2f628a
Showing
9 changed files
with
234 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import requests | ||
|
||
from h5rdmtoolbox.repository.zenodo.tokens import get_api_token | ||
|
||
|
||
def delete_sandbox_deposits(): | ||
"""Delete all deposits in the sandbox account.""" | ||
r = requests.get( | ||
'https://sandbox.zenodo.org/api/deposit/depositions', | ||
params={'access_token': get_api_token(sandbox=True)} | ||
) | ||
r.raise_for_status() | ||
for deposit in r.json(): | ||
try: | ||
# if deposit['title'].startswith('[test]'): | ||
if not deposit['submitted']: | ||
print(f'deleting deposit {deposit["title"]} with id {deposit["id"]}') | ||
r = requests.delete( | ||
'https://sandbox.zenodo.org/api/deposit/depositions/{}'.format(deposit['id']), | ||
params={'access_token': get_api_token(sandbox=True)} | ||
) | ||
else: | ||
print( | ||
f'Cannot delete {deposit["title"]} with id {deposit["id"]} because it is already published."' | ||
) | ||
except Exception as e: | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
delete_sandbox_deposits() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.