MediaMath / t1-python

Python SDK for MediaMath Platform APIs
https://developer.mediamath.com/
Apache License 2.0
18 stars 30 forks source link

Refactor and remove unknown items before POST #30

Closed pswaminathan closed 9 years ago

pswaminathan commented 9 years ago

api_base has the protocol and path in. this is not good, as it makes us hard-code certain values and doesn’t let us switch environments easily. We can make the API base just the domain itself. This way, we can put the paths to each API module separately, and make our methods invoke them instead.

Additionally, we can refactor some things. Split out the functions from XMLParser.__init__ to make it easier to read. Construct the URL as a method, rather than doing it each time we need to. Some other little things.

Part of the API breaking changes is that addition of a new parameter does not constitute a breaking change. This is fine, we don’t care on read. But, previously we would post unknown items on save—we just wouldn’t do any validation.

But this breaks for new parameters that are read-only on update; with these, we would send them along anyway and get an error. Now, if we don’t know what an attribute is beforehand, we ignore it.