Question

I'm trying to post a tweet with the tweepy library. I use this code:

import tweepy

CONSUMER_KEY ="XXXX"
CONSUMER_SECRET = "XXXX"   
ACCESS_KEY = "XXXX"    
ACCESS_SECRET = "XXXX"

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

api = tweepy.API(auth)
api.update_status('Updating using OAuth authentication via Tweepy!')

But when I run the application, I receive this error:

raise TweepError(error_msg, resp)
TweepError: Read-only application cannot POST.

How can I fix this?

Était-ce utile?

La solution

In the application's settings, set your Application Type to "Read and Write". Then renegotiate your access token.

Autres conseils

the code works for me with only

api.update_status (**status** = 'Updating using OAuth authentication via Tweepy!')

You have to set your app to read and write enter image description here

After that, you'll be able to run your code.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top