TweepyException: Failed to parse JSON payload: Expecting value: line 1 column 1 (char 0)

108 views Asked by At

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?

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

1

There are 1 answers

1
Paolo Sini On

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