aboutsummaryrefslogtreecommitdiffstats
path: root/backend/discord.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/discord.py')
-rw-r--r--backend/discord.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/backend/discord.py b/backend/discord.py
index 8cb602c..e5c7f8f 100644
--- a/backend/discord.py
+++ b/backend/discord.py
@@ -2,11 +2,9 @@
import httpx
from backend.constants import (
- OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET
+ DISCORD_API_BASE_URL, OAUTH2_CLIENT_ID, OAUTH2_CLIENT_SECRET
)
-API_BASE_URL = "https://discord.com/api/v8"
-
async def fetch_bearer_token(code: str, redirect: str, *, refresh: bool) -> dict:
async with httpx.AsyncClient() as client:
@@ -23,7 +21,7 @@ async def fetch_bearer_token(code: str, redirect: str, *, refresh: bool) -> dict
data["grant_type"] = "authorization_code"
data["code"] = code
- r = await client.post(f"{API_BASE_URL}/oauth2/token", headers={
+ r = await client.post(f"{DISCORD_API_BASE_URL}/oauth2/token", headers={
"Content-Type": "application/x-www-form-urlencoded"
}, data=data)
@@ -34,7 +32,7 @@ async def fetch_bearer_token(code: str, redirect: str, *, refresh: bool) -> dict
async def fetch_user_details(bearer_token: str) -> dict:
async with httpx.AsyncClient() as client:
- r = await client.get(f"{API_BASE_URL}/users/@me", headers={
+ r = await client.get(f"{DISCORD_API_BASE_URL}/users/@me", headers={
"Authorization": f"Bearer {bearer_token}"
})