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


Messages In This Thread
tweepy:invalid or expired token - by weareux - Nov-30-2017, 03:38 PM
RE: tweepy:invalid or expired token - by weareux - Dec-03-2017, 02:17 PM
RE: tweepy:invalid or expired token - by micseydel - Dec-03-2017, 07:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Refresh token for Wyze SDK duckredbeard 0 1,186 May-16-2022, 04:33 AM
Last Post: duckredbeard
  Need to sign JWT token with JWK key stucoder 1 1,865 Feb-21-2022, 09:04 AM
Last Post: stucoder
  Python requests oauth2 access token herobpv 6 4,244 Sep-27-2021, 06:54 PM
Last Post: herobpv
  unexpected token < in json at position 0 Frodoxzibit 5 3,008 Jul-10-2021, 09:33 AM
Last Post: Larz60+
  Check if tweet is favorited by myself | TWEEPY altayko 0 1,442 Sep-16-2020, 05:40 PM
Last Post: altayko
  / token in function parameterlist tpourjalali 1 1,974 Apr-12-2020, 07:05 PM
Last Post: deanhystad
  zlib decompress error: invalid code lengths set / invalid block type DreamingInsanity 0 7,097 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,976 Jan-26-2020, 01:09 AM
Last Post: Winfried
  Getting an "Unexpected Token" Error and don't know why... NotAHackusator 1 1,937 Nov-20-2019, 03:00 PM
Last Post: buran
  get and reuse the token value with huawei modem Reims 1 4,734 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