Remove Client and AsyncClient block and unblock methods
authorHarmon <Harmon758@gmail.com>
Thu, 29 Jun 2023 21:45:03 +0000 (16:45 -0500)
committerHarmon <Harmon758@gmail.com>
Thu, 29 Jun 2023 21:45:34 +0000 (16:45 -0500)
The endpoints that they use have been removed.
https://developer.twitter.com/en/updates/changelog

cassettes/test_asyncclient_block_and_get_blocked_and unblock.yaml [deleted file]
cassettes/test_client_block_and_get_blocked_and unblock.yaml [deleted file]
docs/asyncclient.rst
docs/client.rst
tests/test_asyncclient.py
tests/test_client.py
tweepy/asynchronous/client.py
tweepy/client.py

diff --git a/cassettes/test_asyncclient_block_and_get_blocked_and unblock.yaml b/cassettes/test_asyncclient_block_and_get_blocked_and unblock.yaml
deleted file mode 100644 (file)
index 2cd4817..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-interactions:
-- request:
-    body:
-      target_user_id: '17874544'
-    headers:
-      Content-Type:
-      - application/json
-      User-Agent:
-      - Python/3.10.0 aiohttp/3.7.4.post0 Tweepy/4.9.0
-    method: POST
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking
-  response:
-    body:
-      string: '{"data":{"blocking":true}}'
-    headers:
-      api-version:
-      - '2.42'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '52'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Sat, 07 May 2022 13:20:50 UTC
-      server:
-      - tsa_b
-      set-cookie:
-      - guest_id_marketing=v1%3A165192965087916447; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id_ads=v1%3A165192965087916447; Max-Age=63072000; Expires=Mon, 06 May
-        2024 13:20:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - personalization_id="v1_d6raK5hbnCFRKnII2kd5hQ=="; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id=v1%3A165192965087916447; Max-Age=63072000; Expires=Mon, 06 May 2024
-        13:20:50 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - c9ce8c94ed937e66ed27655cc9cb540351079e5c38b952f0fe5622664320d42e
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '50'
-      x-rate-limit-remaining:
-      - '49'
-      x-rate-limit-reset:
-      - '1651930550'
-      x-response-time:
-      - '41'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-    url: https://api.twitter.com/2/users/1072250532645998596/blocking
-- request:
-    body: null
-    headers:
-      User-Agent:
-      - Python/3.10.0 aiohttp/3.7.4.post0 Tweepy/4.9.0
-    method: GET
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking
-  response:
-    body:
-      string: '{"data":[{"id":"17874544","name":"Twitter Support","username":"TwitterSupport"}],"meta":{"result_count":1}}'
-    headers:
-      api-version:
-      - '2.42'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '111'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Sat, 07 May 2022 13:20:51 UTC
-      server:
-      - tsa_b
-      set-cookie:
-      - guest_id_marketing=v1%3A165192965103954945; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id_ads=v1%3A165192965103954945; Max-Age=63072000; Expires=Mon, 06 May
-        2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - personalization_id="v1_i17sy7cUDAjsGIpFEiP82w=="; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id=v1%3A165192965103954945; Max-Age=63072000; Expires=Mon, 06 May 2024
-        13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - 6518b1ea1eedc55716aea9d3c3a7c13005142dd0edca34f50821728bda86965a
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '15'
-      x-rate-limit-remaining:
-      - '14'
-      x-rate-limit-reset:
-      - '1651930551'
-      x-response-time:
-      - '42'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-    url: https://api.twitter.com/2/users/1072250532645998596/blocking
-- request:
-    body: null
-    headers:
-      User-Agent:
-      - Python/3.10.0 aiohttp/3.7.4.post0 Tweepy/4.9.0
-    method: DELETE
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking/17874544
-  response:
-    body:
-      string: '{"data":{"blocking":false}}'
-    headers:
-      api-version:
-      - '2.42'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '53'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Sat, 07 May 2022 13:20:51 UTC
-      server:
-      - tsa_b
-      set-cookie:
-      - guest_id_marketing=v1%3A165192965123045517; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id_ads=v1%3A165192965123045517; Max-Age=63072000; Expires=Mon, 06 May
-        2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - personalization_id="v1_VeY7KCW087dRYotZqyA/ig=="; Max-Age=63072000; Expires=Mon,
-        06 May 2024 13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id=v1%3A165192965123045517; Max-Age=63072000; Expires=Mon, 06 May 2024
-        13:20:51 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - 4e0af34f12925ee64848c60af7be02d98e38b2ee16eb71e16465cab2c32def2a
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '50'
-      x-rate-limit-remaining:
-      - '49'
-      x-rate-limit-reset:
-      - '1651930551'
-      x-response-time:
-      - '38'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-    url: https://api.twitter.com/2/users/1072250532645998596/blocking/17874544
-version: 1
diff --git a/cassettes/test_client_block_and_get_blocked_and unblock.yaml b/cassettes/test_client_block_and_get_blocked_and unblock.yaml
deleted file mode 100644 (file)
index ea8d39f..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-interactions:
-- request:
-    body: '{"target_user_id": "17874544"}'
-    headers:
-      Accept:
-      - '*/*'
-      Accept-Encoding:
-      - gzip, deflate
-      Connection:
-      - keep-alive
-      Content-Length:
-      - '30'
-      Content-Type:
-      - application/json
-      User-Agent:
-      - Python/3.9.6 Requests/2.25.1 Tweepy/4.0.0-alpha
-    method: POST
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking
-  response:
-    body:
-      string: !!binary |
-        H4sIAAAAAAAAAKpWSkksSVSyqlZKyslPzs7MS1eyKikqTa2tBQAAAP//AwBcCHSuGgAAAA==
-    headers:
-      api-version:
-      - '2.24'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '52'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Mon, 20 Sep 2021 18:12:41 UTC
-      server:
-      - tsa_b
-      set-cookie:
-      - personalization_id="v1_YP58GZ7KULovj9I0BZd+tA=="; Max-Age=63072000; Expires=Wed,
-        20 Sep 2023 18:12:41 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      - guest_id=v1%3A163216156123071343; Max-Age=63072000; Expires=Wed, 20 Sep 2023
-        18:12:41 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - 74daf3f6996e83c2a3a1336df68a70c9ffe266db5ca7f75f44b223f3b021bc79
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '50'
-      x-rate-limit-remaining:
-      - '49'
-      x-rate-limit-reset:
-      - '1632162461'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-- request:
-    body: null
-    headers:
-      Accept:
-      - '*/*'
-      Accept-Encoding:
-      - gzip, deflate
-      Connection:
-      - keep-alive
-      Cookie:
-      - guest_id=v1%3A163216156123071343; personalization_id="v1_YP58GZ7KULovj9I0BZd+tA=="
-      User-Agent:
-      - Python/3.9.6 Requests/2.25.1 Tweepy/4.0.0-alpha
-    method: GET
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking
-  response:
-    body:
-      string: !!binary |
-        H4sIAAAAAAAAAKpWSkksSVSyiq5WykxRslIyNLcwNzE1MVHSUcpLzE0FioSUZ5aUpBYpBJcWFOQX
-        lQAlSotTi1AlYXK1sTpKuakg86qVilKLS3NK4pPzS/NKlKwMa2sBAAAA//8DAMW+VFVrAAAA
-    headers:
-      api-version:
-      - '2.24'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '111'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Mon, 20 Sep 2021 18:12:41 UTC
-      server:
-      - tsa_b
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - 74daf3f6996e83c2a3a1336df68a70c9ffe266db5ca7f75f44b223f3b021bc79
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '15'
-      x-rate-limit-remaining:
-      - '14'
-      x-rate-limit-reset:
-      - '1632162461'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-- request:
-    body: null
-    headers:
-      Accept:
-      - '*/*'
-      Accept-Encoding:
-      - gzip, deflate
-      Connection:
-      - keep-alive
-      Content-Length:
-      - '0'
-      Cookie:
-      - guest_id=v1%3A163216156123071343; personalization_id="v1_YP58GZ7KULovj9I0BZd+tA=="
-      User-Agent:
-      - Python/3.9.6 Requests/2.25.1 Tweepy/4.0.0-alpha
-    method: DELETE
-    uri: https://api.twitter.com/2/users/1072250532645998596/blocking/17874544
-  response:
-    body:
-      string: !!binary |
-        H4sIAAAAAAAAAKpWSkksSVSyqlZKyslPzs7MS1eySkvMKU6trQUAAAD//wMAcXlx4RsAAAA=
-    headers:
-      api-version:
-      - '2.24'
-      cache-control:
-      - no-cache, no-store, max-age=0
-      content-disposition:
-      - attachment; filename=json.json
-      content-encoding:
-      - gzip
-      content-length:
-      - '53'
-      content-type:
-      - application/json; charset=utf-8
-      date:
-      - Mon, 20 Sep 2021 18:12:41 UTC
-      server:
-      - tsa_b
-      strict-transport-security:
-      - max-age=631138519
-      x-access-level:
-      - read-write-directmessages
-      x-connection-hash:
-      - 74daf3f6996e83c2a3a1336df68a70c9ffe266db5ca7f75f44b223f3b021bc79
-      x-content-type-options:
-      - nosniff
-      x-frame-options:
-      - SAMEORIGIN
-      x-rate-limit-limit:
-      - '50'
-      x-rate-limit-remaining:
-      - '49'
-      x-rate-limit-reset:
-      - '1632162461'
-      x-xss-protection:
-      - '0'
-    status:
-      code: 200
-      message: OK
-version: 1
index 0f9f0f60aaebc1371c8d065ae97e0f5542441689..4458308e94a124bece83cc2db5aa0bd75ae9a0a3 100644 (file)
     +--------------------------------------------------------------+--------------------------------------------------------+
     | .. centered:: |Blocks|_                                                                                               |
     +--------------------------------------------------------------+--------------------------------------------------------+
-    | `DELETE /2/users/:source_user_id/blocking/:target_user_id`_  | :meth:`AsyncClient.unblock`                            |
-    +--------------------------------------------------------------+--------------------------------------------------------+
     | `GET /2/users/:id/blocking`_                                 | :meth:`AsyncClient.get_blocked`                        |
     +--------------------------------------------------------------+--------------------------------------------------------+
-    | `POST /2/users/:id/blocking`_                                | :meth:`AsyncClient.block`                              |
-    +--------------------------------------------------------------+--------------------------------------------------------+
     | .. centered:: |Follows|_                                                                                              |
     +--------------------------------------------------------------+--------------------------------------------------------+
     | `DELETE /2/users/:source_user_id/following/:target_user_id`_ | :meth:`AsyncClient.unfollow_user`                      |
 .. _GET /2/tweets/:id: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets-id
 .. _GET /2/tweets: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets
 .. |Blocks| replace:: *Blocks*
-.. _DELETE /2/users/:source_user_id/blocking/:target_user_id: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/delete-users-user_id-blocking
 .. _GET /2/users/:id/blocking: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/get-users-blocking
-.. _POST /2/users/:id/blocking: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/post-users-user_id-blocking
 .. |Follows| replace:: *Follows*
 .. _DELETE /2/users/:source_user_id/following/:target_user_id: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following
 .. _GET /2/users/:id/followers: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers
@@ -402,12 +396,8 @@ Users
 Blocks
 ------
 
-.. automethod:: AsyncClient.unblock
-
 .. automethod:: AsyncClient.get_blocked
 
-.. automethod:: AsyncClient.block
-
 Follows
 -------
 
index a32ac2241a49cb599eb2d853610c49e6a74e898f..2fec1b672f22863d634d8fc1654c36437c11caee 100644 (file)
     +------------------------------------------------------------------------------------------------------------------+
     | .. centered:: |Blocks|_                                                                                          |
     +--------------------------------------------------------------+---------------------------------------------------+
-    | `DELETE /2/users/:source_user_id/blocking/:target_user_id`_  | :meth:`Client.unblock`                            |
-    +--------------------------------------------------------------+---------------------------------------------------+
     | `GET /2/users/:id/blocking`_                                 | :meth:`Client.get_blocked`                        |
     +--------------------------------------------------------------+---------------------------------------------------+
-    | `POST /2/users/:id/blocking`_                                | :meth:`Client.block`                              |
-    +--------------------------------------------------------------+---------------------------------------------------+
     | .. centered:: |Follows|_                                                                                         |
     +--------------------------------------------------------------+---------------------------------------------------+
     | `DELETE /2/users/:source_user_id/following/:target_user_id`_ | :meth:`Client.unfollow_user`                      |
 .. _GET /2/tweets/:id: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets-id
 .. _GET /2/tweets: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets
 .. |Blocks| replace:: *Blocks*
-.. _DELETE /2/users/:source_user_id/blocking/:target_user_id: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/delete-users-user_id-blocking
 .. _GET /2/users/:id/blocking: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/get-users-blocking
-.. _POST /2/users/:id/blocking: https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/post-users-user_id-blocking
 .. |Follows| replace:: *Follows*
 .. _DELETE /2/users/:source_user_id/following/:target_user_id: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following
 .. _GET /2/users/:id/followers: https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/get-users-id-followers
@@ -402,12 +396,8 @@ Users
 Blocks
 ------
 
-.. automethod:: Client.unblock
-
 .. automethod:: Client.get_blocked
 
-.. automethod:: Client.block
-
 Follows
 -------
 
index f7fa1b82cb19ef6db71d9a7b0b55c90a438e970d..052360383c478f2124f2e94826b819ce04303238 100644 (file)
@@ -114,14 +114,7 @@ class TweepyAsyncClientTests(IsolatedAsyncioTestCase):
         # @TwitterDev and @TwitterAPI Tweets announcing API v2
         await self.client.get_tweets(tweet_ids)
 
-    @tape.use_cassette(
-        "test_asyncclient_block_and_get_blocked_and unblock.yaml"
-    )
-    async def test_block_and_get_blocked_and_unblock(self):
-        user_id = 17874544  # User ID for @TwitterSupport
-        await self.client.block(user_id)
-        await self.client.get_blocked()
-        await self.client.unblock(user_id)
+    # TODO: Test AsyncClient.get_blocked
 
     @tape.use_cassette("test_asyncclient_follow_and_unfollow_user.yaml")
     async def test_follow_and_unfollow_user(self):
index faa3a41be16b692e423c709fd0cf3187c9e318ce..3240a3aec61b041ad0a96718652a2ae01288df96 100644 (file)
@@ -110,12 +110,7 @@ class TweepyClientTests(unittest.TestCase):
         # @TwitterDev and @TwitterAPI Tweets announcing API v2
         self.client.get_tweets(tweet_ids)
 
-    @tape.use_cassette("test_client_block_and_get_blocked_and unblock.yaml")
-    def test_block_and_get_blocked_and_unblock(self):
-        user_id = 17874544  # User ID for @TwitterSupport
-        self.client.block(user_id)
-        self.client.get_blocked()
-        self.client.unblock(user_id)
+    # TODO: Test Client.get_blocked
 
     @tape.use_cassette("test_client_follow_and_unfollow_user.yaml")
     def test_follow_and_unfollow_user(self):
index 9eb001df0a7e684e78a7ccf8bd2877ac9452025e..312332a8ee52222e1be97728b7179628278db4dc 100644 (file)
@@ -169,6 +169,10 @@ class AsyncClient(AsyncBaseClient):
 
     .. versionadded:: 4.10
 
+    .. versionchanged:: 4.15
+        Removed ``block`` and ``unblock`` methods, as the endpoints they use
+        have been removed
+
     Parameters
     ----------
     bearer_token : str | None
@@ -1719,49 +1723,6 @@ class AsyncClient(AsyncBaseClient):
 
     # Blocks
 
-    async 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
-        user they're not blocking or have already unblocked.
-
-        .. note::
-
-            When using OAuth 2.0 Authorization Code Flow with PKCE with
-            ``user_auth=False``, a request is made beforehand to Twitter's API
-            to determine the authenticating user's ID. This is cached and only
-            done once per :class:`AsyncClient` instance for each access token
-            used.
-
-        Parameters
-        ----------
-        target_user_id : int | str
-            The user ID of the user that you would like to unblock.
-        user_auth : bool
-            Whether or not to use OAuth 1.0a User Context to authenticate
-
-        Raises
-        ------
-        TypeError
-            If the access token isn't set
-
-        Returns
-        -------
-        dict | aiohttp.ClientResponse | Response
-
-        References
-        ----------
-        https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/delete-users-user_id-blocking
-        """
-        source_user_id = await self._get_authenticating_user_id(
-            oauth_1=user_auth
-        )
-        route = f"/2/users/{source_user_id}/blocking/{target_user_id}"
-
-        return await self._make_request(
-            "DELETE", route, user_auth=user_auth
-        )
-
     async def get_blocked(self, *, user_auth=True, **params):
         """get_blocked( \
             *, expansions=None, max_results=None, pagination_token=None, \
@@ -1821,45 +1782,6 @@ class AsyncClient(AsyncBaseClient):
             ), data_type=User, user_auth=user_auth
         )
 
-    async def block(self, target_user_id, *, user_auth=True):
-        """Block another user.
-
-        .. note::
-
-            When using OAuth 2.0 Authorization Code Flow with PKCE with
-            ``user_auth=False``, a request is made beforehand to Twitter's API
-            to determine the authenticating user's ID. This is cached and only
-            done once per :class:`AsyncClient` instance for each access token
-            used.
-
-        Parameters
-        ----------
-        target_user_id : int | str
-            The user ID of the user that you would like to block.
-        user_auth : bool
-            Whether or not to use OAuth 1.0a User Context to authenticate
-
-        Raises
-        ------
-        TypeError
-            If the access token isn't set
-
-        Returns
-        -------
-        dict | aiohttp.ClientResponse | Response
-
-        References
-        ----------
-        https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/post-users-user_id-blocking
-        """
-        id = await self._get_authenticating_user_id(oauth_1=user_auth)
-        route = f"/2/users/{id}/blocking"
-
-        return await self._make_request(
-            "POST", route, json={"target_user_id": str(target_user_id)},
-            user_auth=user_auth
-        )
-
     # Follows
 
     async def unfollow_user(self, target_user_id, *, user_auth=True):
index 440a15535e4c74592ef55b893c59f2822f4a8f75..12173863f8d5f2f2b6f511a351b6c502413505f4 100644 (file)
@@ -211,6 +211,10 @@ class Client(BaseClient):
 
     .. versionadded:: 4.0
 
+    .. versionchanged:: 4.15
+        Removed ``block`` and ``unblock`` methods, as the endpoints they use
+        have been removed
+
     Parameters
     ----------
     bearer_token : str | None
@@ -1828,55 +1832,6 @@ class Client(BaseClient):
 
     # Blocks
 
-    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
-        user they're not blocking or have already unblocked.
-
-        .. note::
-
-            When using OAuth 2.0 Authorization Code Flow with PKCE with
-            ``user_auth=False``, a request is made beforehand to Twitter's API
-            to determine the authenticating user's ID. This is cached and only
-            done once per :class:`Client` instance for each access token used.
-
-        .. versionchanged:: 4.5
-            Added ``user_auth`` parameter
-
-        .. versionchanged:: 4.8
-            Added support for using OAuth 2.0 Authorization Code Flow with PKCE
-
-        .. versionchanged:: 4.8
-            Changed to raise :class:`TypeError` when the access token isn't set
-
-        Parameters
-        ----------
-        target_user_id : int | str
-            The user ID of the user that you would like to unblock.
-        user_auth : bool
-            Whether or not to use OAuth 1.0a User Context to authenticate
-
-        Raises
-        ------
-        TypeError
-            If the access token isn't set
-
-        Returns
-        -------
-        dict | requests.Response | Response
-
-        References
-        ----------
-        https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/delete-users-user_id-blocking
-        """
-        source_user_id = self._get_authenticating_user_id(oauth_1=user_auth)
-        route = f"/2/users/{source_user_id}/blocking/{target_user_id}"
-
-        return self._make_request(
-            "DELETE", route, user_auth=user_auth
-        )
-
     def get_blocked(self, *, user_auth=True, **params):
         """get_blocked( \
             *, expansions=None, max_results=None, pagination_token=None, \
@@ -1944,53 +1899,6 @@ class Client(BaseClient):
             ), data_type=User, user_auth=user_auth
         )
 
-    def block(self, target_user_id, *, user_auth=True):
-        """Block another user.
-
-        .. note::
-
-            When using OAuth 2.0 Authorization Code Flow with PKCE with
-            ``user_auth=False``, a request is made beforehand to Twitter's API
-            to determine the authenticating user's ID. This is cached and only
-            done once per :class:`Client` instance for each access token used.
-
-        .. versionchanged:: 4.5
-            Added ``user_auth`` parameter
-
-        .. versionchanged:: 4.8
-            Added support for using OAuth 2.0 Authorization Code Flow with PKCE
-
-        .. versionchanged:: 4.8
-            Changed to raise :class:`TypeError` when the access token isn't set
-
-        Parameters
-        ----------
-        target_user_id : int | str
-            The user ID of the user that you would like to block.
-        user_auth : bool
-            Whether or not to use OAuth 1.0a User Context to authenticate
-
-        Raises
-        ------
-        TypeError
-            If the access token isn't set
-
-        Returns
-        -------
-        dict | requests.Response | Response
-
-        References
-        ----------
-        https://developer.twitter.com/en/docs/twitter-api/users/blocks/api-reference/post-users-user_id-blocking
-        """
-        id = self._get_authenticating_user_id(oauth_1=user_auth)
-        route = f"/2/users/{id}/blocking"
-
-        return self._make_request(
-            "POST", route, json={"target_user_id": str(target_user_id)},
-            user_auth=user_auth
-        )
-
     # Follows
 
     def unfollow_user(self, target_user_id, *, user_auth=True):