Ok I am making a twitter bot in Python Here is the code -
from twython import Twython, TwythonError
import requests
APP_KEY = ""
APP_SECRET = ""
twitter = Twython(APP_KEY, APP_SECRET)
auth = twitter.get_authentication_tokens()
OAUTH_TOKEN = auth['']
OAUTH_TOKEN_SECRET = auth['']
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
# This is the part you're missing
oauth_verifier_url = auth['auth_url']
oauth_verifier = requests.get(oauth_verifier_url)
# Getting the FINAL authentication tokens
final_step = twitter.get_authorized_tokens(oauth_verifier)
OAUTH_TOKEN = final_step['oauth_token']
OAUTH_TOKEN_SECRET = auth['oauth_token_secret']
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
# Up until this line
try:
twitter.update_status(status='yo')
except TwythonError as e:
print(e)
But I getting a this error -
Traceback (most recent call last):
File "C:\Users\suhas\PycharmProjects\Twitter-bot\main.py", line 9, in <module>
auth = twitter.get_authentication_tokens()
File "C:\Users\suhas\PycharmProjects\Twitter-bot\venv\lib\site-packages\twython\api.py", line 336, in get_authentication_tokens
raise TwythonAuthError(response.content,
twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), b'{"errors":[{"code":32,"message":"Could not authenticate you."}]}'
I have seen thousands of webpages with no sucess I wish anyone could help?