xdevplatform / twitter-python-ads-sdk

A Twitter supported and maintained Ads API SDK for Python.
https://twitterdev.github.io/twitter-python-ads-sdk/
MIT License
189 stars 106 forks source link

LineItem retrieved with invalid attributes #262

Open clevep opened 4 years ago

clevep commented 4 years ago

LineItem objects loaded from my Account contain invalid values for the attributes:

So if I load a LineItem and then immediately save it, I am greeted with errors like this:

>>> line_item = account.line_items().next()

>>> line_item.save()
BadRequest: <BadRequest object at 0x7fc24b5bd9a8 code=400 details=[{'message': 'Expected a value in APP_CLICK, APP_INSTALL, VIEW, VIEW_3S_100PCT, VIEW_6S, got "LINK_CLICK" for bid_unit', 'code': 'INVALID_PARAMETER', 'parameter': 'bid_unit'}, {'message': 'Expected a value in APP_CLICK, APP_INSTALL, got "LINK_CLICK" for charge_by', 'code': 'INVALID_PARAMETER', 'parameter': 'charge_by'}, {'message': 'setting advertiser_user_id is not allowed', 'code': 'INVALID_PARAMETER', 'parameter': 'advertiser_user_id'}]>

I am able to work around this by explicitly setting all of these attributes to None before saving, but it does not seem like they should populate with invalid values.

osowskit commented 2 years ago

Over time, parameters and options can get deprecated between versions. This results in campaigns that may no longer be possible to modify or the previous values are not valid. In the above scenario, it seems that the line items attempted to save these incorrectly. Let us know if you find additional examples and we can attempt to work around these.