Ensure a tweet is reduced when sent by streaming API

This commit is contained in:
Manuel Cortez 2021-07-03 14:04:14 -05:00
parent c926355048
commit 788811bf6c

View File

@ -405,9 +405,9 @@ class Session(base.baseSession):
""" Returns an user object associated with an ID. """ Returns an user object associated with an ID.
id str: User identifier, provided by Twitter. id str: User identifier, provided by Twitter.
returns a tweepy user object.""" returns a tweepy user object."""
if hasattr(id, "id_str"): # if hasattr(id, "id_str"):
log.error("Called get_user function by passing a full user id as a parameter.") # log.error("Called get_user function by passing a full user id as a parameter.")
id = id.id_str # id = id.id_str
# Check if the user has been added to the list of deleted users previously. # Check if the user has been added to the list of deleted users previously.
if id in self.deleted_users: if id in self.deleted_users:
log.debug("Returning user {} from the list of deleted users.".format(id)) log.debug("Returning user {} from the list of deleted users.".format(id))
@ -548,7 +548,7 @@ class Session(base.baseSession):
if num == 0: if num == 0:
buffers_to_send.remove(buffer) buffers_to_send.remove(buffer)
# However, we have to do the "reduce and change" process here because the status we sent to the db is going to be a different object that the one sent to database. # However, we have to do the "reduce and change" process here because the status we sent to the db is going to be a different object that the one sent to database.
reduced_status = reduce.reduce_tweet(status) status = reduce.reduce_tweet(status)
status = self.check_quoted_status(status) status = self.check_quoted_status(status)
status = self.check_long_tweet(status) status = self.check_long_tweet(status)
# Send it to the main controller object. # Send it to the main controller object.