self.client.get_blocked()
self.client.unblock(user_id)
- @tape.use_cassette("test_follow_and_unfollow.yaml", serializer="yaml")
- def test_follow_and_unfollow(self):
+ @tape.use_cassette("test_follow_and_unfollow_user.yaml", serializer="yaml")
+ def test_follow_and_unfollow_user(self):
user_id = 17874544 # User ID for @TwitterSupport
- self.client.follow(user_id)
- self.client.unfollow(user_id)
+ self.client.follow_user(user_id)
+ self.client.unfollow_user(user_id)
@tape.use_cassette("test_get_users_followers.yaml", serializer="yaml")
def test_get_users_followers(self):
import logging
from platform import python_version
import time
+import warnings
import requests
# Follows
- def unfollow(self, target_user_id):
+ def unfollow_user(self, target_user_id):
"""Allows a user ID to unfollow another user.
The request succeeds with no action when the authenticated user sends a
"DELETE", route, user_auth=True
)
+ def unfollow(self, target_user_id):
+ """Alias for :meth:`Client.unfollow_user`
+
+ .. deprecated:: 4.2
+ Use :meth:`Client.unfollow_user` instead.
+ """
+ warnings.warn(
+ "Client.unfollow is deprecated; use Client.unfollow_user instead.",
+ DeprecationWarning
+ )
+ self.unfollow_user(target_user_id)
+
def get_users_followers(self, id, *, user_auth=False, **params):
"""get_users_followers( \
id, *, user_auth=False, expansions, max_results, \
), data_type=User, user_auth=user_auth
)
- def follow(self, target_user_id):
+ def follow_user(self, target_user_id):
"""Allows a user ID to follow another user.
If the target user does not have public Tweets, this endpoint will send
user_auth=True
)
+ def follow(self, target_user_id):
+ """Alias for :meth:`Client.follow_user`
+
+ .. deprecated:: 4.2
+ Use :meth:`Client.follow_user` instead.
+ """
+ warnings.warn(
+ "Client.follow is deprecated; use Client.follow_user instead.",
+ DeprecationWarning
+ )
+ self.follow_user(target_user_id)
+
# Mutes
def unmute(self, target_user_id):