...
程式碼區塊 |
---|
import aiohttp import quart import traceback async def get_username(): async with aiohttp.ClientSession() as session: cookie = quart.request.headers["Davinci-Cookie"] url = 'https://prod.dvcbot.net' async with session.post( f"{url}/api/userinfo", json={"cookie": cookie}, verify_ssl=False, ) as resp: try: result = await resp.json() return result["username"] except Exception as e: error_message = traceback.format_exc() |
...