Closed FodT closed 7 years ago
@FodT, I'm a little confused because I don't see deals
in the CHILD_PATHS
dict in t1mappings.py
. Based on the comment you made, it seems like this should work but it didn't seem to work
>>> t1.get("strategies", 123456, child="deals")
Traceback (most recent call last):
File "/Users/ttheissier/test_python/lib/python3.5/site-packages/terminalone/service.py", line 251, in _construct_url
child_path = CHILD_PATHS[child.lower()]
KeyError: 'deals'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ttheissier/test_python/lib/python3.5/site-packages/terminalone/service.py", line 327, in get
_url, child_id = self._construct_url(collection, entity, child, limit)
File "/Users/ttheissier/test_python/lib/python3.5/site-packages/terminalone/service.py", line 255, in _construct_url
raise ClientError("`child` must correspond to an entity in T1")
terminalone.errors.ClientError: '`child` must correspond to an entity in T1'
>>>
Running TerminalOne==1.6.0
hi @thomas91310, you're right! I need to do a little work to support this. Apologies.
@thomas91310 can you check out my branch at https://github.com/FodT/t1-python/tree/107-child-deals ? We might need to retire the xml parser soon, since there's a very, very dirty hack there to make this work.
Some new things happening here to support the new Deals service and the deprecation of the old endpoints
The
strategies
entity now allows forsave_deals()
alongsidesave_supplies()
- the syntax here is the same as saving supplies. to use, call the strategy withchild=deals
(optional), then call strategy.save_deals withdata=[dict of deals]
Asking for a
deal
entity now talks to the new media API and pulls the json entity. saving will also post to this endpoint in json format.entities are now aware of whether they should be posting formdata or json.