2016-04-17 14 views
1

Twythonを使用してTwitterのストリーミングAPIからデータを収集していますが、AttributeErrorエラーが発生しています。 'MyStreamer'オブジェクトに 'status'属性がありませんAttributeError: 'MyStreamer'オブジェクトには、MyStreamerクラスがTwythonStreamerクラスを拡張する属性のステータスはありません

app_key = 'XXXXXXXXXXXXXXXXXX' 
app_secret = 'XXXXXXXXXXXXXXX' 
oauth_token = 'XXXXXXXXXXXXXX' 
oauth_token_secret = 'XXXXXXX' 

client_args = { 
      'proxies':{ 
         'http': 'http://x.x.x.x:xxxx', 
         'https': 'https://x.x.x.x:xxxx', 
         } 
     } 


class MyStreamer(TwythonStreamer): 

def __init__(self): 
    self.app_key = app_key 
    self.app_secret = app_secret 
    self.oauth_token = oauth_token 
    self.oauth_token_secret = oauth_token_secret 
    self.client_args = client_args 

def on_success(self, data): 
    if 'text' in data: 
     print data['text'].encode('utf-8') 

def on_error(self, status_code, data): 
    print status_code 

if __name__ == '__main__': 
    stream = MyStreamer() 
    stream.statuses.filter(track = 'twitter') 

答えて

0

(自己)」関数とその内容を削除してから、試してみてください。

関連する問題