Twitter stats not working with twitter python wrapper by geduldig


I am trying to use the stats api to get information.

stats = api.request(‘stats/accounts/:123456’,{‘entity’:‘LINE_ITEM’, ‘start_time’:‘2017-09-29’, entity_ids: ‘8u94t’,
‘end_time’:‘2017-09-30’,‘granularity’ : ‘TOTAL’, ‘placement’: ‘ALL_ON_TWITTER’ , ‘metric_groups’ :‘ENGAGEMENT’})

stats_info = stats.json()

The above does not work at all.

I am not actually sure how I would be using to get the information and as well as what entity_ids is and how to find it.


It looks like you’re attempting to use that Python library with the Ads API. Have you applied for access to it?


Can you provide a link to the documentation for the API endpoint you’re using?


This is part of the Ads API family. You need to be whitelisted for access and use the correct API hostname.


Hi Andy, how can I be whitelisted for access?
And what is entity_ids?


Use the Apply for Access form link at the bottom of this page.

Note that this API is aimed at partners building Ads solutions, and is not generally open to everyone.


Hi Andry, I do have access to the twitter ads api, but I am simply just getting the error.


What is the error you’re seeing?


{'errors': [{'code': 34, 'message': 'Sorry, that page does not exist'}]}


Are you using the correct API hostname?


Is there a reason not to use the official Twitter Ads API Python wrapper?