Currently, I am thinking of using Python-twitter for SNS analysis.I installed oauth2, httplib2, and simplejson respectively, and I was able to install Python-twitter.(Each confirmed in import)
However, I received the following error.
I am a beginner who started learning programming languages such as Python this spring.
I managed to get here while reading Google and books, but I can't move on.I look forward to your kind cooperation.
Error Contents
>>>api=twitter.Api()
>> statuses=api.GetUser ('********')
Traceback (most recent call last):
File "<pyshell#10>",
line 1, in
states=api.GetUser('********')
File "build\bdist.win32\egg\twitter\api.py", line 1847, in GetUser
if not self.__auth:
AttributeError: 'Api' object has no attribute'_Api_auth'
ユーザー Username is in hidden characters
environment
python 2.7.8
httplib2-0.9.2
oauthlib-1.0.3
simplejson-3.8.0
python-twitter-2.2
Github had the same question.
https://github.com/bear/python-twitter/issues/119
Twitter.Api()
should be given four arguments for authentication, and it should work in the following form:
api=twitter.Api(consumer_key='consumer_key',
consumer_secret = 'consumer_secret',
access_token_key='access_token',
access_token_secret='access_token_secret')
You can find instructions on how to obtain tokens, etc., in the API section of the document.
https://github.com/bear/python-twitter#api
It's a little old in Japanese, but for example, the following blog post explains it.
Create a Twitter application (how to check Consumer key, Consumer secret, Access token, Access token secret)
© 2024 OneMinuteCode. All rights reserved.