ERROR : TwythonAuthError: Twitter API returned a 401 (Unauthorized), This request is not properly authenticated


#1

The following error occurs when trying to access the summary data.

from twython import Twython
import json
APP_KEY = ''
APP_SECRET = '
'
OAUTH_TOKEN = ''
OAUTH_TOKEN_SECRET = '
'
twitter = Twython(APP_KEY, APP_SECRET,OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
account_id = ‘'
twitter.request('https://ads-api.twitter.com/1/stats/accounts/{}/reach/campaigns?campaign_ids={}&start_time=2014-01-01T07:00:00Z&end_time=2014-11-16T07:00:00Z’.format(account_id,’
’))

Error:
TwythonAuthError: Twitter API returned a 401 (Unauthorized), This request is not properly authenticated


#2

Hello!

In order to make sure this is not an issue with the code. Can you try to make the same request using twurl (https://github.com/twitter/twurl)? If you receive an error please paste the API call and response.

Thanks!


#3

Is there any other other package other than twurl to access the follwing request?
https://ads-api.twitter.com/1/stats/accounts/{}/reach/campaigns?campaign_ids={}&start_time=2014-01-01T07:00:00Z&end_time=2014-11-16T07:00:00Z’.format(account_id,’*’)


#4

@ajayanilkumar1: It doesn’t look like the other SDKs support this endpoint. What’s the hesitation with using twurl?


#5

api to get linkclicks and page impression for particular page(twitter ads)?