コード例 #1
0
def get_stream(stream='all'):
  oa = app_settings.oauth_keys()
  auth = twitter.OAuth(oa['token'], oa['token secret'], oa['key'], oa['secret'])
  stream_api = twitter.TwitterStream(auth=auth)
  
  if stream is 'sf':
    return stream_api.statuses.filter(locations='-122.75,36.8,-121.75,37.8')
  elif stream is 'geo':
    return stream_api.statuses.filter(locations='-180,-90,180,90')
  else:
    return stream_api.statuses.sample()
コード例 #2
0
 def __init__(self):
   self.auth_keys = app_settings.oauth_keys()
   self.oauth = twitter.OAuth(self.auth_keys['token'],
                              self.auth_keys['token secret'],
                              self.auth_keys['key'],
                              self.auth_keys['secret'])