#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import twitter
class twitt():
def __init__(self):
consumer_key = '...'
consumer_secret = '...'
access_key = '...'
access_secret = '...'
encoding = 'iso-8859-15'
self.api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_key, access_token_secret=access_secret, input_encoding=encoding)
def run(self):
statuses = self.api.GetPublicTimeline()
print statuses
h = twitt()
h.run()
此代码不起作用,它直接取自自述文件和我找到的每个示例。我发现了一些关于“get_access_token.py”的东西,但没有提到它!?
user@host:~# updatedb
user@host:~# locate get_access_token
user@host:~#
错误: TypeError: __init__() got an unexpected keyword argument 'access_token_key'
参考:
- http://code.google.com/p/python-twitter/issues/detail?id=215
- https://github.com/bear/python-twitter/tree/master/examples