hokay first iteration of python-dudes is ready

This commit is contained in:
2024-02-19 18:25:34 -07:00
parent fb8bfa6a9c
commit cdb30f2dc0
34 changed files with 1130 additions and 383 deletions

View File

@@ -1,20 +1,15 @@
from scwrypts.env import getenv
from scwrypts.http import get_request_client
REQUEST = None
from .. import get_request_client
def request(method, endpoint, **kwargs):
global REQUEST # pylint: disable=global-statement
headers = {}
if REQUEST is None:
headers = {}
if (token := getenv("DISCORD__BOT_TOKEN", required = False)) is not None:
headers['Authorization'] = f'Bot {token}'
if (token := getenv("DISCORD__BOT_TOKEN", required = False)) is not None:
headers['Authorization'] = f'Bot {token}'
REQUEST = get_request_client(
base_url = 'https://discord.com/api',
headers = headers,
)
return REQUEST(method, endpoint, **kwargs)
return get_request_client(
base_url = 'https://discord.com/api',
headers = headers,
)(method, endpoint, **kwargs)