#!/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」的東西,而且沒有提及它!?Python的嘰嘰喳喳 - 意想不到的關鍵字參數「access_token_key」
用戶@主持人:〜#updatedb的
用戶@主持人:〜#定位get_access_token
用戶@主持人:〜#
錯誤: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
+1 - 保持忘記檢查是多麼有用:) – RocketDonkey
這可能會節省我一些時間。 雖然最主要的原因是我使用apt-get安裝的舊版本的庫python-twitter:/ – Torxed