Added helper for getting user object by id #232

This commit is contained in:
Manuel Cortez 2018-07-17 10:58:09 -05:00
parent 610f18dcb6
commit 64d843d98a

View File

@ -530,4 +530,12 @@ class Session(object):
if "@%s" % (i["screen_name"]) not in tweet["message"] and i["screen_name"] != tweet["user"]["screen_name"]:
if tweet.has_key("retweeted_status") and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]:
continue
return tweet
return tweet
def get_user(self, id):
if self.db.has_key("users") == False or self.db["users"].has_key(id) == False:
user = self.twitter.twitter.show_user(id=id)
self.db["users"][user["id"]] = user
return user
else:
return self.db["users"][id]