I am able to fetch tweets from timeline using following endpoint https://api.twitter.com/1.1/statuses/home_timeline.json
But now I am trying for engagement API , with same access details it’s giving error as {u’errors’: [u’Your account could not be authenticated. Reason: Unknown Authorization Type’]}
Following is the code am working with :
def engagement_api(url, consumer_key, consumer_secret_key,access_key,access_secret_key, http_method="POST",http_headers={'Content-type': 'application/json'}):#def oauth_req(url, key, secret, http_method="GET", post_body=””, http_headers=None):
consumer = oauth2.Consumer(key=consumer_key, secret=consumer_secret_key)
token = oauth2.Token(key=access_key, secret=access_secret_key)
client = oauth2.Client(consumer, token)
resp, content = client.request( url, method=http_method,headers=http_headers,body=urllib.urlencode({'status': params}))
return content
if __name__ == '__main__':
engagements = engagement_api('https://data-api.twitter.com/insights/engagement/totals', consumer_key, consumer_secret_key,access_key,access_secret_key)
I am trying with endpoint https://data-api.twitter.com/insights/engagement/totals. When I search for this got lot of queries in my mind
Can’t we directly get engagement details using same credentials?
What is gnip?
Do we need to have gnip account to fetch engagement data?
can you please someone help me with that?