def test_VerifyCredentials(self): api = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) status = api.VerifyCredentials() self.assertIsNotNone(status) self.assertTrue('screen_name' in status) self.assertTrue('name' in status)
def getfriends(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) friends = tapi.GetFriends() return json.dumps(friends)
def getwelcomemessages(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) welcomemessages = tapi.GetWelcomeMessages() return json.dumps(welcomemessages)
def getfollowers(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) followers = tapi.GetFollowers() return json.dumps(followers)
def timeline(): screen_name = request.form.get('screenname', 'SanJoseTrails') tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) timeline = tapi.GetUserTimeline(screen_name=screen_name) return jsonify([t['text'] for t in timeline])
def getratelimitstatus(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) limitstatus = tapi.GetRateLimitStatus() return json.dumps(limitstatus)
def gettrendswoeid(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) trendswoeid = tapi.GetTrendsWoeid() return json.dumps(trendswoeid)
def getcollections(): tapi = twitter(t.CONSUMER_KEY, t.CONSUMER_SECRET, t.ACCESS_KEY, t.ACCESS_SECRET) collections = tapi.GetCollections() return json.dumps(collections)