1

我是 Python 新手,认为使用 Twitter 学习对我很有用。我通过在互联网上研究代码将以下代码放在一起。

import sys
from twython import Twython

CONSUMER_KEY = "xxxx"
CONSUMER_SECRET = "xxxx"
ACCESS_TOKEN = "xxxx"
ACCESS_TOKEN_SECRET = "xxxx"

twitter = Twython(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SEC$

twitter.update_status(status=sys.argv[1])

当我运行代码时出现错误,有人可以帮忙吗?错误如下:

$ python3 Twitter_Test_Put.py Test From Python
Traceback (most recent call last):
  File "Twitter_Test_Put.py", line 12, in <module>
   twitter.update_status(status=sys.argv[1])
  File                 "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/sit      e-packages/twython-3.1.0-py3.3.egg/twython/endpoints.py", line 90, in update_status
  File     "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/sit      e-packages/twython-3.1.0-py3.3.egg/twython/api.py", line 234, in post
  File "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/sit      e-packages/twython-3.1.0-py3.3.egg/twython/api.py", line 224, in request
  File      "/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/sit      e-packages/twython-3.1.0-py3.3.egg/twython/api.py", line 194, in _request
  twython.exceptions.TwythonAuthError: Twitter API returned a 401 (Unauthorized), An   error occurred processing your request.

任何帮助将不胜感激,我是所有这一切的新手,因此很容易遵循这些步骤,在此先感谢您。

4

0 回答 0