tweepy.errors.Unauthorized: 401 Unauthorized 89 - Invalid or expired token. #1961
-
I have an API version2 of the following keys: and I'm having this error: I actually made system time to UTF. And I don't know why this is happening! The following code is what I'm currently working on auth = tweepy.OAuth1UserHandler(consumer_key,consumer_secret_key) auth.set_access_token(access_token,access_token_secret) api = tweepy.API(auth)
if name=="main": |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 3 replies
-
Double check that your credentials are correct. Regenerate them if necessary. For code block usage, see https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks. |
Beta Was this translation helpful? Give feedback.
-
I actually regenerated several times already but it still gives me the same error. And it says I already pulled about 10,000 tweets even though I wasn't able to do it even once... Does selecting Read and write and Direct message from User authentication settings matters? I chose that... |
Beta Was this translation helpful? Give feedback.
-
It's almost certainly an issue with the actual credentials or how you're passing them. I'm not sure where you're seeing that, but that shouldn't be relevant to this issue. No, the error indicates your credentials are invalid. |
Beta Was this translation helpful? Give feedback.
-
Then should I use API v1.1 consumer_key,consumer_secret_key,access_token,access_token_secret? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
But when I typed in the tokens, I get this message even though I had already upgraded to 'elevated' level.
,which is why I tried to use API v2 |
Beta Was this translation helpful? Give feedback.
-
Assuming you mean it says Tweepy API v1.1 requires Elevated access, this is true, as the error you're likely seeing indicates. That's unrelated to this issue though. |
Beta Was this translation helpful? Give feedback.
Double check that your credentials are correct. Regenerate them if necessary.
For code block usage, see https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks.