'tweepy API.update_profile error tweepy.errors.Unauthorized: 401 Unauthorized
I want to update my twitter profile name with bot. But it gave me 401.
here's my code
def main():
auth = tweepy.OAuth1UserHandler(
CONSUMER_KEY, CONSUMER_SECRET, ACCESSS_TOKEN, ACCESSS_TOKEN_SECRET)
api = tweepy.API(auth)
api.update_profile(name="Henlo")
Traceback (most recent call last):
File "path-to-app/app.py", line 34, in <module>
main()
File "path-to-app/app.py", line 26, in main
api.update_profile(name="Henlo")
File "path-to-app/venv/lib64/python3.10/site-packages/tweepy/api.py", line 46, in wrapper
return method(*args, **kwargs)
File "path-to-app/venv/lib64/python3.10/site-packages/tweepy/api.py", line 2752, in update_profile
return self.request(
File "path-to-app/venv/lib64/python3.10/site-packages/tweepy/api.py", line 257, in request
raise Unauthorized(resp)
tweepy.errors.Unauthorized: 401 Unauthorized
Solution 1:[1]
It's because the Access token. It need write permission in order to make change to profile. Here's the detail Generate Access Token with Read/Write Permission
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BlueBeret |
