Python twitter "errors":[{"message":"Could not authenticate you","code":32


#1

Dear All,

I’m trying to execute the examples from https://github.com/sixohsix/twitter with the current library version installed by pip install (1.14.3).

#!/usr/bin/env python # -*- coding: utf-8 -*- from twitter import *

con_secret=‘DACs’ # "Consumer Secret"
con_secret_key=‘jold’ # "Consumer Key"
token=‘2554’ # "Access token"
token_key=‘HHSD’ # “Access Token Secret”

t = Twitter(
auth=OAuth(token, token_key, con_secret, con_secret_key))
t.statuses.user_timeline(screen_name=“RenateBergmann”)

The reply is:
twitter.api.TwitterHTTPError: Twitter sent status 401 for URL: 1.1/statuses/user_timeline.json using parameters: (oauth_consumer_key=DA…&oauth_nonce=…&oauth_signature_method=HMAC-SHA1&oauth_timestamp=…&oauth_token=…&oauth_version=1.0&screen_name=RenateBergmann&oauth_signature=…)
details: {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}

What’s the issue? Have I used the right tokens and keys? The labeling in the script is a bit different from the Twitter api page.
Is Python 2.7 the proper version? The documentation said 2.6, but someone told me I had to use 2.7.
Is the authentication method correct? It should be, because this is an example from the Github readme.

I’m a beginner, so maybe it’s only a slight mistake?

Thank you in advance.

  • Chris