summaryrefslogtreecommitdiff
path: root/ATRI/utils/request.py
blob: da0cdd455364bd680c8e941a61bf4449770553d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import httpx
from ATRI.config import BotSelfConfig


if not BotSelfConfig.proxy:
    proxy = dict()
else:
    proxy = {"all://": BotSelfConfig.proxy}


async def get(url: str, **kwargs):
    async with httpx.AsyncClient(proxies=proxy) as client:  # type: ignore
        return await client.get(url, **kwargs)


async def post(url: str, **kwargs):
    async with httpx.AsyncClient(proxies=proxy) as client:  # type: ignore
        return await client.post(url, **kwargs)