From 05304d8a46e81ef90f27dd389e4caa1fbe1d5720 Mon Sep 17 00:00:00 2001 From: AMIT YADAV Date: Fri, 14 Jun 2024 20:50:53 +0530 Subject: [PATCH] added support for discord proxy --- discord/http.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discord/http.py b/discord/http.py index 7e707bb98d..a1e51bc003 100644 --- a/discord/http.py +++ b/discord/http.py @@ -33,6 +33,7 @@ from urllib.parse import quote as _uriquote import aiohttp +import os from . import __version__, utils from .errors import ( @@ -123,6 +124,9 @@ def __init__(self, method: str, path: str, **parameters: Any) -> None: @property def base(self) -> str: + DISCORD_PROXY = bool(os.environ.get("DISCORD_PROXY", False)) + if DISCORD_PROXY: + return f"http://discord.com/api/v{API_VERSION}" return f"https://discord.com/api/v{API_VERSION}" @property