nonebot2/website/versioned_docs/version-2.0.0-beta.3/api/drivers/aiohttp.md
github-actions[bot] 9b45b77894 🔖 Release 2.0.0-beta.3
2022-05-20 10:21:32 +00:00

2.0 KiB

sidebar_position description
2 nonebot.drivers.aiohttp 模块

nonebot.drivers.aiohttp

AIOHTTP 驱动适配器。

nb driver install aiohttp
# 或者
pip install nonebot2[aiohttp]

:::tip 提示 本驱动仅支持客户端连接 :::

class Mixin()

  • 说明

    AIOHTTP Mixin

property type

  • 类型: str

async method request(self, setup)

  • 参数

    • setup (nonebot.internal.driver.model.Request)
  • 返回

    • nonebot.internal.driver.model.Response

method websocket(self, setup)

  • 参数

    • setup (nonebot.internal.driver.model.Request)
  • 返回

    • AsyncGenerator[WebSocket, NoneType]

class WebSocket(*, request, session, websocket)

  • 说明

    AIOHTTP Websocket Wrapper

  • 参数

    • request (nonebot.internal.driver.model.Request)

    • session (aiohttp.client.ClientSession)

    • websocket (aiohttp.client_ws.ClientWebSocketResponse)

async method accept(self)

  • 返回

    • Unknown

async method close(self, code=1000)

  • 参数

    • code (int)
  • 返回

    • Unknown

async method receive(self)

  • 返回

    • str

async method receive_bytes(self)

  • 返回

    • bytes

async method receive_text(self)

  • 返回

    • str

async method send_bytes(self, data)

  • 参数

    • data (bytes)
  • 返回

    • None

async method send_text(self, data)

  • 参数

    • data (str)
  • 返回

    • None

class Driver(env, config)

  • 说明

    AIOHTTP Driver

  • 参数

property type

  • 类型: str