gracedb-client response handling
Issue first tracked started on April 17, 2017. Copied from redmine (https://bugs.ligo.org/redmine/issues/5496)
gracedb-client (command line) does not appear to be handling HTTP responses correctly. Example: applying and then trying to re-apply a label to an event.
(gracedb)tanner@UWM-laptop:[~/work/gracedb/testing]$ gracedb --service-url=https://gracedb-dev1.ligo.org/api/ label G249261 EM_SENT
Server returned 201
Traceback (most recent call last):
File "/home/tanner/.virtualenvs/gracedb/bin/gracedb", line 553, in <module>
code = main()
File "/home/tanner/.virtualenvs/gracedb/bin/gracedb", line 545, in main
if ('warning' in responseBody) and response['warning']:
AttributeError: HTTPResponse instance has no attribute '__getitem__'
It should display the actual response message from the server.
type(rv)
<type 'str'>
ipdb> json.loads(rv)
u'{"warning": "Event G249258 already labeled with \'EM_SENT\'"}'
But it doesn't appear to be converted from a string to a dict correctly (possible issue with quotes).