1

Here is my code:- I have double checked all the auth parameters.

import tweepy


CONSUMER_KEY ='#Omitted - you should not publish your actual key'
CONSUMER_SECRET ='#Omitted - you should not publish your actual secret'
ACCESS_KEY='#Omitted - you should not publish your access key'
ACCESS_SECRET = '#Omitted - you should not publish your access secret'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

api.update_status('Tweeting from command line')

Saved the file in home folder as status.py after running python status.py follwing error comes:-

Traceback (most recent call last):
  File "status.py", line 14, in <module>
    api.update_status('Tweeting from command line')
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.10-py2.7.egg/tweepy/binder.py", line 185, in _call
    return method.execute()
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.10-py2.7.egg/tweepy/binder.py", line 168, in execute
    raise TweepError(error_msg, resp)
tweepy.error.TweepError: Could not authenticate with OAuth.

Please, help me out

4

3 に答える 3

3

I received this error under the same conditions - using tweepy, all of my keys/secrete were copy and pasted correctly. The problem was the time on my server. After running ntpdate -b pool.ntp.org I was to use tweepy just fine.

于 2013-04-27T22:29:46.663 に答える
0

I am able to authenticate using tweepy, I have an extra line in my code though, it might help for you to change your code to this:

import tweepy
from tweepy import OAuthHandler

then proceede with the rest of your code. Also add a line in your code to print out to the shell to show your connect as follows:

print api.me().name

Make sure the line you see above this is right after api = tweepy.API(auth)

于 2012-07-22T14:30:54.093 に答える
0

Try api.update_status(status='Tweeting from command line'). It helped me.

于 2015-08-02T21:31:30.423 に答える