Twitter stats not working with twitter python wrapper by geduldig


#1

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()
pprint(stats_info)

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.


#2

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


#4

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


#5

https://developer.twitter.com/en/docs/ads/analytics/api-reference/synchronous

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


#6

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


#7

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.


#10

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


#11

What is the error you’re seeing?


#12

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


#13

Are you using the correct API hostname?


#14

Is there a reason not to use the official Twitter Ads API Python wrapper? https://github.com/twitterdev/twitter-python-ads-sdk