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

Enttity type .all method parameter parsing incorrect, expected boolean got "True" #218

Open shaun10 opened 5 years ago

shaun10 commented 5 years ago
  File "process_twitter_ads_api/main.py", line 408, in main
    lookup_table_name = produce_lookup_data(ACCOUNTS, entity_name, entity_properties)
  File "process_twitter_ads_api/main.py", line 323, in produce_lookup_data
    entities_df = json_normalize([item.to_params() for item in entity_properties.get('object').all(acc
ount_object, with_deleted=True)], sep='_')
  File "/opt/conda/lib/python2.7/site-packages/twitter_ads/resource.py", line 94, in all
    return Cursor(klass, request, init_with=[account])
  File "/opt/conda/lib/python2.7/site-packages/twitter_ads/cursor.py", line 29, in __init__
    self.__from_response(request.perform())
  File "/opt/conda/lib/python2.7/site-packages/twitter_ads/http.py", line 69, in perform
    raise Error.from_response(response)
BadRequest: <BadRequest object at 0x7f3df76c2dc0 code=400 details=[{u'message':u'Expected Boolean, go
t "True" for with_deleted', u'code': u'INVALID_PARAMETER', u'parameter': u

I’m passing it like this X.all(account_object, with_deleted=True) with X being the type of object. such as PromotedTweet, MediaCreative, AccountMedia, ImageAppDownloadCard, MediaLibrary, VideoConversationCard, PollCard, WebsiteCard from the SDK. Can you help me understand which of these objects could take this and which couldn’t? Also is there a way I can pass generally to avoid the error above?

With targeting criteria I use TargetingCriteria.all(account_object, line_items_subset_ids, with_deleted=True) as that is not a creative. The non-creative .all methods have a slightly different setup in the SDK.

smaeda-ks commented 5 years ago

@shaun10

Also is there a way I can pass generally to avoid the error above?

The best you can do right now is to check our documentation as to which endpoint supports with_deleted request parameter.

I'm taking your feedback as my TODO but for now, please check our documentation. Thank you for your patience.