Python Forum
tweepy:invalid or expired token
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tweepy:invalid or expired token
#1
Hello, thanks for your help, I want to find a twitter user thanks to tweepy, I have already tried to generate a new key, I've also tried with a token, but it says:

Error:
"Traceback (most recent call last): File "C:/Users/enora/PycharmProjects/untitled2/Cluedo1.py", line 33, in <module> user = api.get_user(screen_name = 'suspect_jean_michel') File "C:\Python34\lib\site-packages\tweepy\binder.py", line 245, in _call return method.execute() File "C:\Python34\lib\site-packages\tweepy\binder.py", line 229, in execute raise TweepError(error_msg, resp, api_code=api_error_code) tweepy.error.TweepError: [{'code': 89, 'message': 'Invalid or expired token.'}]"
Here is my code:

#importer les modules
import googlemaps
import tweepy
import urllib.request
import json

from tweepy import API


#authentification twitter
consumer_key="REMOVEDl"
key=consumer_key
consumer_secret="REMOVED"
secret=consumer_secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(key, secret)
api = tweepy.API(auth)

user = api.get_user(screen_name = 'suspect_jean_michel')
Reply
#2
up :)
Reply
#3
It's extremely difficult for a regular forum to help with issues like this. The API says your token is invalid or expired - if that's the case, it should be clear how to fix it, and if it's not, then you probably need to contact whoever maintains the API.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Refresh token for Wyze SDK duckredbeard 0 1,105 May-16-2022, 04:33 AM
Last Post: duckredbeard
  Need to sign JWT token with JWK key stucoder 1 1,685 Feb-21-2022, 09:04 AM
Last Post: stucoder
  Python requests oauth2 access token herobpv 6 3,898 Sep-27-2021, 06:54 PM
Last Post: herobpv
  unexpected token < in json at position 0 Frodoxzibit 5 2,798 Jul-10-2021, 09:33 AM
Last Post: Larz60+
  Check if tweet is favorited by myself | TWEEPY altayko 0 1,361 Sep-16-2020, 05:40 PM
Last Post: altayko
  / token in function parameterlist tpourjalali 1 1,869 Apr-12-2020, 07:05 PM
Last Post: deanhystad
  zlib decompress error: invalid code lengths set / invalid block type DreamingInsanity 0 6,829 Mar-29-2020, 12:44 PM
Last Post: DreamingInsanity
  [gpxpy] "Error parsing XML: not well-formed (invalid token): line 1, column 1" Winfried 5 6,670 Jan-26-2020, 01:09 AM
Last Post: Winfried
  Getting an "Unexpected Token" Error and don't know why... NotAHackusator 1 1,841 Nov-20-2019, 03:00 PM
Last Post: buran
  get and reuse the token value with huawei modem Reims 1 4,572 Oct-02-2019, 04:29 AM
Last Post: Reims

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020