skip to Main Content

I am using twitter v1 api for searching the tweet , last day python script working fine but today it gives the error "TweetException Failed to parse the Payload".

Any suggestion would help

consumer_key = "*"
consumer_secret = "*"
access_key = "*"
access_secret = "*"

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
def get_init_tweets(screen_name):
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_key, access_secret)
    api = tweepy.API(auth)
    alltweets = []
    print(api.verify_credentials().screen_name)
    new_tweets = api.search_tweets(q = '@ElonMuskAOC',count=200,result_type='recent')
    print(outtweets)
    return new_tweets

i have try to find out solution in Stackoverflow but no help.
I have another api keys also when i am trying to check the connection with api ,it return same bug.
syntax to check the api is working or not "print(api.verify_credentials().screen_name)"

2

Answers


  1. I believe the Twitter v1 API has been shut down:
    https://twittercommunity.com/t/reminder-to-migrate-to-the-new-free-basic-or-enterprise-plans-of-the-twitter-api/189737.

    If you are using Tweepy you should probably look into moving to v2 of the Twitter API: https://docs.tweepy.org/en/stable/authentication.html#twitter-api-v2

    Login or Signup to reply.
  2. Same problem here, started this morning. Also, i can’t reproduce the issue locally, it postst normally from my test environment.

    I’m using twitter api v2, and am just using post message.

    client_v2 = tweepy.Client(
            consumer_key=tw_consumer_key,
            consumer_secret=tw_consumer_secret,
            access_token=tw_access_token,
            access_token_secret=tw_access_token_secret
        )
    
    message = "some message"
    
    client_v2.create_tweet(text=message)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search