diff --git a/CHANGELOG.md b/CHANGELOG.md index 647fc311be..33d9e70167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2579](https://github.com/Pycord-Development/pycord/pull/2579)) - Added new `Subscription` object and related methods/events. ([#2564](https://github.com/Pycord-Development/pycord/pull/2564)) +- Added ability to change the API's base URL with `Route.API_BASE_URL`. + ([#2714](https://github.com/Pycord-Development/pycord/pull/2714)) ### Fixed diff --git a/discord/http.py b/discord/http.py index adbabf04ca..2db704b268 100644 --- a/discord/http.py +++ b/discord/http.py @@ -106,6 +106,8 @@ async def json_or_text(response: aiohttp.ClientResponse) -> dict[str, Any] | str class Route: + API_BASE_URL: str = "https://discord.com/api/v{API_VERSION}" + def __init__(self, method: str, path: str, **parameters: Any) -> None: self.path: str = path self.method: str = method @@ -127,7 +129,7 @@ def __init__(self, method: str, path: str, **parameters: Any) -> None: @property def base(self) -> str: - return f"https://discord.com/api/v{API_VERSION}" + return self.API_BASE_URL.format(API_VERSION=API_VERSION) @property def bucket(self) -> str: