Looks like the bag is being added properly, but the bag id isn't being pulled out into the url path of the final bag id URL call via requests (scroll down to the last requests call, there's no id in the url).
(clint)dchud@gwdev-dchud12:~/projects/clint (t39-optional-json-output *)$ python
clint.py --json add bag
Enter field values for new bag
bagname: fakebag2
bag_type [Options: 1=Access, 3=Export, 2=Preservation]: 3
absolute_filesystem_path: /dev/null
payload:
machine: 3
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1):
gwdev-dchud12.wrlc.org
DEBUG:requests.packages.urllib3.connectionpool:Setting read timeout to None
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/v1/machine/3/?username=
dchud&api_key=APIKEY&format=json HTTP/1.1" 200
None
item: 38989/c014q74j984c
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1):
gwdev-dchud12.wrlc.org
DEBUG:requests.packages.urllib3.connectionpool:Setting read timeout to None
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/v1/item/38989/c014q74j9
84c/?username=dchud&format=json&api_key=APIKEY
HTTP/1.1" 200 None
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1):
gwdev-dchud12.wrlc.org
DEBUG:requests.packages.urllib3.connectionpool:Setting read timeout to None
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/v1/collection/38989/c01
6q466q373/?username=dchud&format=json&api_key=APIKEY
30534f HTTP/1.1" 200 None
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): gwdev-dchud12.wrlc.org
DEBUG:requests.packages.urllib3.connectionpool:Setting read timeout to None
DEBUG:requests.packages.urllib3.connectionpool:"POST /api/v1/bag/ HTTP/1.1" 201 None
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): gwdev-dchud12.wrlc.org
DEBUG:requests.packages.urllib3.connectionpool:Setting read timeout to None
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/v1/bag/?username=dchud&format=json&api_key=APIKEY HTTP/1.1" 200 None
Traceback (most recent call last):
File "clint.py", line 534, in <module>
main()
File "clint.py", line 530, in main
args.func(args)
File "clint.py", line 107, in add
print json.dumps(obj.as_json, indent=2)
File "/home/dchud/projects/clint/inventory.py", line 111, in as_json
return getattr(self, '_data', {})
File "/home/dchud/projects/clint/inventory.py", line 682, in __getattr__
self._load_properties()
File "/home/dchud/projects/clint/inventory.py", line 694, in _load_properties
item_id = '/'.join(self._data['item'].rstrip('/').split('/')[-2:])
KeyError: 'item'
Looks like the bag is being added properly, but the bag id isn't being pulled out into the url path of the final bag id URL call via requests (scroll down to the last requests call, there's no id in the url).