constants_t.py 699 Bytes
from pot_libs.aiohttp_util.aiohttp_utils import AioHttpUtils

# http前缀,
HTTP_PREFIX = "http://0.0.0.0:8090"
TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMDA4NiwiZXhwIjoxNjM4ODY0ODM4fQ.HYwQM8-F0OkjAkwB4b3F-zr2MVWEa2pCzTEnma_xsvA"


async def post_request(url, data):
    resp_str, status = await AioHttpUtils().post(
        url=f"{HTTP_PREFIX}{url}",
        data=data,
        timeout=10,
        headers={"Authorization": f"Bearer {TOKEN}"}
    )
    return resp_str, status


async def get_request(url):
    resp_str, status = await AioHttpUtils().get(
        url=f"{HTTP_PREFIX}{url}",
        headers={"Authorization": f"Bearer {TOKEN}"}
    )
    return resp_str, status