text
stringlengths
0
828
:return: User object. None if not found
""""""
try:
return User(self._client.get_user(user_id=id)._json)
except TweepError as e:
if e.api_code == TWITTER_USER_NOT_FOUND_ERROR:
return None
raise"
1751,"def remove_tweet(self, id):
""""""
Delete a tweet.
:param id: ID of the tweet in question
:return: True if success, False otherwise
""""""
try:
self._client.destroy_status(id=id)
return True
except TweepError as e:
if e.api_code in [TWITTER_PAGE_DOES_NOT_EXISTS_ERROR, TWITTER_DELETE_OTHER_USER_TWEET]:
return False
raise"
1752,"def follow(self, user_id, notify=False):
""""""
Follow a user.
:param user_id: ID of the user in question
:param notify: whether to notify the user about the following
:return: user that are followed
""""""
try:
return User(self._client.create_friendship(user_id=user_id, follow=notify)._json)
except TweepError as e:
if e.api_code in [TWITTER_ACCOUNT_SUSPENDED_ERROR]:
return self.get_user(user_id)
raise"
1753,"def unfollow(self, user_id):
""""""
Follow a user.
:param user_id: ID of the user in question
:return: The user that were unfollowed
""""""
return User(self._client.destroy_friendship(user_id=user_id)._json)"
1754,"def create_list(self, name, mode='public', description=None):
""""""
Create a list
:param name: Name of the new list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: Description of the new list
:return: The new list object
:rtype: :class:`~responsebot.models.List`
""""""
return List(tweepy_list_to_json(self._client.create_list(name=name, mode=mode, description=description)))"
1755,"def destroy_list(self, list_id):
""""""
Destroy a list
:param list_id: list ID number
:return: The destroyed list object
:rtype: :class:`~responsebot.models.List`
""""""
return List(tweepy_list_to_json(self._client.destroy_list(list_id=list_id)))"
1756,"def update_list(self, list_id, name=None, mode=None, description=None):
""""""
Update a list
:param list_id: list ID number
:param name: New name for the list
:param mode: :code:`'public'` (default) or :code:`'private'`
:param description: New description of the list
:return: The updated list object
:rtype: :class:`~responsebot.models.List`
""""""
return List(tweepy_list_to_json(
self._client.update_list(list_id=list_id, name=name, mode=mode, description=description))
)"
1757,"def list_timeline(self, list_id, since_id=None, max_id=None, count=20):
""""""
List the tweets of specified list.
:param list_id: list ID number
:param since_id: results will have ID greater than specified ID (more recent than)
:param max_id: results will have ID less than specified ID (older than)
:param count: number of results per page
:return: list of :class:`~responsebot.models.Tweet` objects
""""""
statuses = self._client.list_timeline(list_id=list_id, since_id=since_id, max_id=max_id, count=count)
return [Tweet(tweet._json) for tweet in statuses]"
1758,"def get_list(self, list_id):
""""""
Get info of specified list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
""""""
return List(tweepy_list_to_json(self._client.get_list(list_id=list_id)))"
1759,"def add_list_member(self, list_id, user_id):
""""""