From 002e1ccb5560d2481bf73061bed5dbe68beee900 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sun, 27 Jun 2021 16:03:36 -0500 Subject: [PATCH] If get_user is called with a full user object as an argument, logs it and changes the object to be only the user_id --- src/sessions/twitter/session.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sessions/twitter/session.py b/src/sessions/twitter/session.py index 4e3278cf..030d29e8 100644 --- a/src/sessions/twitter/session.py +++ b/src/sessions/twitter/session.py @@ -398,6 +398,9 @@ class Session(base.baseSession): """ Returns an user object associated with an ID. id str: User identifier, provided by Twitter. returns a tweepy user object.""" + if hasattr(id, "id_str"): + log.error("Called get_user function by passing a full user id as a parameter.") + id = id.id_str if ("users" in self.db) == False or (str(id) in self.db["users"]) == False: log.debug("Requesting user id {} as it is not present in the users database.".format(id)) try: