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

Alan Gauld alan.gauld at btinternet.com
Fri Aug 8 09:28:52 CEST 2014


On 08/08/14 05:57, Chris wrote:

> 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).

Since this list is for the core language and standard library
this is a bit off list. You might get more response direct from
the author or a twitter specific mailing list(if one exists).
Failing that maybe the main Python list. However...

>      con_secret='DACs' # "Consumer Secret"
>      con_secret_key='jold' # "Consumer Key"
>      token='2554' # "Access token"
>      token_key='HHSD' # "Access Token Secret"


Example code often uses fictitious security keys.
Are you sure these values are genuine values that work if
you use them to access twitter directly?

>      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?

Do you mean you used the same keys as in the example?
Or have you tested the keys work via some other method of access?

> Is Python 2.7 the proper version? The documentation said 2.6, but
> someone told me I had to use 2.7.

I doubt the differences between 2.6 and 2.7 are your problem.

> Is the authentication method correct? It should be, because this is an
> example from the Github readme.

I can't help there I know nothing about Twitter, far less its API!


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list