Post tweet with tweepy

I am trying to tweet with a tweepy library. I am using 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 get this error:

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

How can i fix this?

+6
source share
2 answers

In the application settings, set your application type to Read and Write. Then restart the access token.

+9
source

the code only works for me with

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

Source: https://habr.com/ru/post/955846/


All Articles