# Hide replies
- def hide_reply(self, id):
+ def hide_reply(self, id, *, user_auth=True):
"""Hides a reply to a Tweet.
Parameters
"""
return self._make_request(
"PUT", f"/2/tweets/{id}/hidden", json={"hidden": True},
- user_auth=True
+ user_auth=user_auth
)
- def unhide_reply(self, id):
+ def unhide_reply(self, id, *, user_auth=True):
"""Unhides a reply to a Tweet.
Parameters
"""
return self._make_request(
"PUT", f"/2/tweets/{id}/hidden", json={"hidden": False},
- user_auth=True
+ user_auth=user_auth
)
# Likes
# Manage Tweets
- def delete_tweet(self, id):
+ def delete_tweet(self, id, *, user_auth=True):
"""Allows an authenticated user ID to delete a Tweet.
.. versionadded:: 4.3
https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/delete-tweets-id
"""
return self._make_request(
- "DELETE", f"/2/tweets/{id}", user_auth=True
+ "DELETE", f"/2/tweets/{id}", user_auth=user_auth
)
def create_tweet(
place_id=None, media_ids=None, media_tagged_user_ids=None,
poll_duration_minutes=None, poll_options=None, quote_tweet_id=None,
exclude_reply_user_ids=None, in_reply_to_tweet_id=None,
- reply_settings=None, text=None
+ reply_settings=None, text=None, user_auth=True
):
"""Creates a Tweet on behalf of an authenticated user.
json["text"] = text
return self._make_request(
- "POST", f"/2/tweets", json=json, user_auth=True
+ "POST", f"/2/tweets", json=json, user_auth=user_auth
)
# Retweets
- def unretweet(self, source_tweet_id):
+ def unretweet(self, source_tweet_id, *, user_auth=True):
"""Allows an authenticated user ID to remove the Retweet of a Tweet.
The request succeeds with no action when the user sends a request to a
route = f"/2/users/{id}/retweets/{source_tweet_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
def get_retweeters(self, id, *, user_auth=False, **params):
), data_type=User, user_auth=user_auth
)
- def retweet(self, tweet_id):
+ def retweet(self, tweet_id, *, user_auth=True):
"""Causes the user ID to Retweet the target Tweet.
Parameters
route = f"/2/users/{id}/retweets"
return self._make_request(
- "POST", route, json={"tweet_id": str(tweet_id)}, user_auth=True
+ "POST", route, json={"tweet_id": str(tweet_id)},
+ user_auth=user_auth
)
# Search Tweets
# Blocks
- def unblock(self, target_user_id):
+ def unblock(self, target_user_id, *, user_auth=True):
"""Unblock another user.
The request succeeds with no action when the user sends a request to a
route = f"/2/users/{source_user_id}/blocking/{target_user_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
- def get_blocked(self, **params):
+ def get_blocked(self, *, user_auth=True, **params):
"""get_blocked(*, expansions, max_results, pagination_token, \
tweet_fields, user_fields)
endpoint_parameters=(
"expansions", "max_results", "pagination_token",
"tweet.fields", "user.fields"
- ), data_type=User, user_auth=True
+ ), data_type=User, user_auth=user_auth
)
- def block(self, target_user_id):
+ def block(self, target_user_id, *, user_auth=True):
"""Block another user.
Parameters
return self._make_request(
"POST", route, json={"target_user_id": str(target_user_id)},
- user_auth=True
+ user_auth=user_auth
)
# Follows
- def unfollow_user(self, target_user_id):
+ def unfollow_user(self, target_user_id, *, user_auth=True):
"""Allows a user ID to unfollow another user.
The request succeeds with no action when the authenticated user sends a
route = f"/2/users/{source_user_id}/following/{target_user_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
- def unfollow(self, target_user_id):
+ def unfollow(self, target_user_id, *, user_auth=True):
"""Alias for :meth:`Client.unfollow_user`
.. deprecated:: 4.2
"Client.unfollow is deprecated; use Client.unfollow_user instead.",
DeprecationWarning
)
- self.unfollow_user(target_user_id)
+ self.unfollow_user(target_user_id, user_auth=user_auth)
def get_users_followers(self, id, *, user_auth=False, **params):
"""get_users_followers( \
), data_type=User, user_auth=user_auth
)
- def follow_user(self, target_user_id):
+ def follow_user(self, target_user_id, *, user_auth=True):
"""Allows a user ID to follow another user.
If the target user does not have public Tweets, this endpoint will send
return self._make_request(
"POST", route, json={"target_user_id": str(target_user_id)},
- user_auth=True
+ user_auth=user_auth
)
- def follow(self, target_user_id):
+ def follow(self, target_user_id, *, user_auth=True):
"""Alias for :meth:`Client.follow_user`
.. deprecated:: 4.2
"Client.follow is deprecated; use Client.follow_user instead.",
DeprecationWarning
)
- self.follow_user(target_user_id)
+ self.follow_user(target_user_id, user_auth=user_auth)
# Mutes
- def unmute(self, target_user_id):
+ def unmute(self, target_user_id, *, user_auth=True):
"""Allows an authenticated user ID to unmute the target user.
The request succeeds with no action when the user sends a request to a
route = f"/2/users/{source_user_id}/muting/{target_user_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
- def get_muted(self, **params):
+ def get_muted(self, *, user_auth=True, **params):
"""get_muted(*, expansions, max_results, pagination_token, \
tweet_fields, user_fields)
endpoint_parameters=(
"expansions", "max_results", "pagination_token",
"tweet.fields", "user.fields"
- ), data_type=User, user_auth=True
+ ), data_type=User, user_auth=user_auth
)
- def mute(self, target_user_id):
+ def mute(self, target_user_id, *, user_auth=True):
"""Allows an authenticated user ID to mute the target user.
Parameters
return self._make_request(
"POST", route, json={"target_user_id": str(target_user_id)},
- user_auth=True
+ user_auth=user_auth
)
# User lookup
# List follows
- def unfollow_list(self, list_id):
+ def unfollow_list(self, list_id, *, user_auth=True):
"""Enables the authenticated user to unfollow a List.
.. versionadded:: 4.2
route = f"/2/users/{id}/followed_lists/{list_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
def get_list_followers(self, id, *, user_auth=False, **params):
), data_type=List, user_auth=user_auth
)
- def follow_list(self, list_id):
+ def follow_list(self, list_id, *, user_auth=True):
"""Enables the authenticated user to follow a List.
.. versionadded:: 4.2
route = f"/2/users/{id}/followed_lists"
return self._make_request(
- "POST", route, json={"list_id": str(list_id)}, user_auth=True
+ "POST", route, json={"list_id": str(list_id)}, user_auth=user_auth
)
# List lookup
# List members
- def remove_list_member(self, id, user_id):
+ def remove_list_member(self, id, user_id, *, user_auth=True):
"""Enables the authenticated user to remove a member from a List they
own.
"""
return self._make_request(
- "DELETE", f"/2/lists/{id}/members/{user_id}", user_auth=True
+ "DELETE", f"/2/lists/{id}/members/{user_id}", user_auth=user_auth
)
def get_list_members(self, id, *, user_auth=False, **params):
), data_type=List, user_auth=user_auth
)
- def add_list_member(self, id, user_id):
+ def add_list_member(self, id, user_id, *, user_auth=True):
"""Enables the authenticated user to add a member to a List they own.
.. versionadded:: 4.2
"""
return self._make_request(
"POST", f"/2/lists/{id}/members", json={"user_id": str(user_id)},
- user_auth=True
+ user_auth=user_auth
)
# Manage Lists
- def delete_list(self, id):
+ def delete_list(self, id, *, user_auth=True):
"""Enables the authenticated user to delete a List that they own.
.. versionadded:: 4.2
"""
return self._make_request(
- "DELETE", f"/2/lists/{id}", user_auth=True
+ "DELETE", f"/2/lists/{id}", user_auth=user_auth
)
- def update_list(self, id, *, description=None, name=None, private=None):
+ def update_list(self, id, *, description=None, name=None, private=None,
+ user_auth=True):
"""Enables the authenticated user to update the meta data of a
specified List that they own.
json["private"] = private
return self._make_request(
- "PUT", f"/2/lists/{id}", json=json, user_auth=True
+ "PUT", f"/2/lists/{id}", json=json, user_auth=user_auth
)
- def create_list(self, name, *, description=None, private=None):
+ def create_list(self, name, *, description=None, private=None,
+ user_auth=True):
"""Enables the authenticated user to create a List.
.. versionadded:: 4.2
json["private"] = private
return self._make_request(
- "POST", f"/2/lists", json=json, user_auth=True
+ "POST", f"/2/lists", json=json, user_auth=user_auth
)
# Pinned Lists
- def unpin_list(self, list_id):
+ def unpin_list(self, list_id, *, user_auth=True):
"""Enables the authenticated user to unpin a List.
.. versionadded:: 4.2
route = f"/2/users/{id}/pinned_lists/{list_id}"
return self._make_request(
- "DELETE", route, user_auth=True
+ "DELETE", route, user_auth=user_auth
)
- def get_pinned_lists(self, **params):
+ def get_pinned_lists(self, *, user_auth=True, **params):
"""get_pinned_lists(*, expansions, list_fields, user_fields)
Returns the Lists pinned by a specified user.
"GET", route, params=params,
endpoint_parameters=(
"expansions", "list.fields", "user.fields"
- ), data_type=List, user_auth=True
+ ), data_type=List, user_auth=user_auth
)
- def pin_list(self, list_id):
+ def pin_list(self, list_id, *, user_auth=True):
"""Enables the authenticated user to pin a List.
.. versionadded:: 4.2
route = f"/2/users/{id}/pinned_lists"
return self._make_request(
- "POST", route, json={"list_id": str(list_id)}, user_auth=True
+ "POST", route, json={"list_id": str(list_id)}, user_auth=user_auth
)
# Batch Compliance