-
Notifications
You must be signed in to change notification settings - Fork 0
/
notifications-delete.py
executable file
·35 lines (28 loc) · 1.29 KB
/
notifications-delete.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
import vdjpy
import argparse
import json
import os.path
import urllib
import sys
if __name__ == '__main__':
# arguments
parser = argparse.ArgumentParser(description = 'Delete a notification.')
parser.add_argument('-n', '--notification_uuid', dest = 'notification_uuid', nargs = '?', help = 'uuid of notification object')
parser.add_argument('-v', '--verbose', dest = 'verbose', action = 'store_true', help = 'verbose output')
parser.add_argument('-z', '--accesstoken', dest = 'accesstoken', nargs = '?', help = 'access token')
args = parser.parse_args()
# make Agave object and kwargs
my_agave = vdjpy.make_vdj_agave(args.accesstoken)
kwargs = {}
# -a
if args.notification_uuid is None:
args.notification_uuid = vdjpy.prompt_user('notification uuid')
kwargs['uuid'] = args.notification_uuid
# delete notifications
notification_delete = my_agave.notifications.delete(**kwargs)
# deliver message
if notification_delete is None:
print 'Successfully deleted notification', args.notification_uuid
else:
print 'Deletion was not successfull. The message returned from the request was:\n' + json.dumps(notification_delete, default = vdjpy.json_serial, sort_keys = True, indent = 4, separators = (',', ': '))