MediaMath/t1-python

ClientError: "No POST data", but passed along properties.

Closed this issue · 4 comments

Using version with latest commit: 4703da8

As suggested in the bottom of the https://github.com/MediaMath/t1-python#entities in the documentation:

new_properties = {
         'name': 'some_agency_name',
         'organization_id': 19112,
         'status':1
}
new_agency = t1.new('agency', properties=new_properties)
new_agency.save()

Traceback (most recent call last):
  File "/Users/rrouck/pi-automation-api/automation_api/runners.py", line 302, in create_agencies
    new_agency.save()
  File "/Users/rrouck/.virtualenvs/pi-automation-api-t1test/lib/python2.7/site-packages/terminalone/entity.py", line 205, in save
    entity, _ = super(Entity, self)._post(self._get_service_path(), url, data=data)
  File "/Users/rrouck/.virtualenvs/pi-automation-api-t1test/lib/python2.7/site-packages/terminalone/connection.py", line 188, in _post
    raise ClientError('No POST data.')
ClientError: 'No POST data.'

Looking through the SDK code shows me that it fails here:

raise ClientError('Cannot specify both data and json POST data.')
.

Looks like the properties data is not propagating to the post call somehow.

FodT commented

Welp, Looks like the last update has broken creating new entities entirely (using the properties argument on construct)

Workaround for the time being would be to set each property explicitly and avoid using the properties argument.

Just going to use the version from the commit before (09cdf1a).

I assume this will use the new endpoints and not the deprecated ones (https://developer.mediamath.com/docs/read/terminalone_api_overview/Upcoming_API_Migrations).

@FodT
We are currently using a fork that doesn't include the changes which create this issue. Would it be possible to put this issue in the backlog under projects (can't see it there currently) so it gets fixed soon and we can start pulling from your repo again when a new problem arises and there's a fix?

FodT commented

Resolved by #136