MediaMath / t1-python

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

Unable to remove additional domains for a strategy #157

Closed emmanueljob closed 6 years ago

emmanueljob commented 7 years ago

To remove "Additional Sites" from strategy targetting the API docs say to send an empty post to domain_restrictions for a strategy: https://developer.mediamath.com/docs/read/execution_and_management_api/Strategies#domain-restrictions

This client does not allow for empty posts: https://github.com/MediaMath/t1-python/blob/master/terminalone/connection.py#L227

Code example (Doesn't work):

t1 = terminalone.T1(auth_method="cookie", **creds) id = .... strat = t1.get('strategies', id, include="campaign") strat.save_domains({})

Code example (Hack workaround that works):

t1 = terminalone.T1(auth_method="cookie", **creds) id = .... strat = t1.get('strategies', id, include="campaign") strat.save_domains({"a": "b"})

Maybe we can allow an override on the post method that says I am explicitly sending an empty post (https://github.com/MediaMath/t1-python/blob/master/terminalone/connection.py#L220) add a param "allowEmptyPost" or something like that. Then every call that allows empty posts could send allowEmptyPost=True

fsargent commented 7 years ago

Hi Emmanuel,

Thanks for identifying this bug. We'll prioritize this fix.

FodT commented 7 years ago

@emmanueljob 1.8.2 now allows posting of an empty dict as the data param using the _post function.