mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-18 09:25:46 +08:00
2.9 KiB
2.9 KiB
sidebar_position | description |
---|---|
2 | nonebot.drivers.aiohttp 模块 |
nonebot.drivers.aiohttp
AIOHTTP 驱动适配器。
nb driver install aiohttp
# 或者
pip install nonebot2[aiohttp]
:::tip 提示 本驱动仅支持客户端连接 :::
class Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)
-
参数
-
params
(QueryTypes) -
headers
(HeaderTypes) -
cookies
(CookieTypes) -
version
(str | HTTPVersion) -
timeout
(float | None) -
proxy
(str | None)
-
async method request(setup)
async method setup()
-
参数
empty
-
返回
- None
async method close()
-
参数
empty
-
返回
- None
class Mixin(<auto>)
-
说明: AIOHTTP Mixin
-
参数
auto
async method request(setup)
method websocket(setup)
method get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)
-
参数
-
params
(QueryTypes) -
headers
(HeaderTypes) -
cookies
(CookieTypes) -
version
(str | HTTPVersion) -
timeout
(float | None) -
proxy
(str | None)
-
-
返回
- Session
class WebSocket(*, request, session, websocket)
-
说明: AIOHTTP Websocket Wrapper
-
参数
-
request
(Request) -
session
(aiohttp.ClientSession) -
websocket
(aiohttp.ClientWebSocketResponse)
-
async method accept()
-
参数
empty
-
返回
- untyped
async method close(code=1000, reason="")
-
参数
-
code
(int) -
reason
(str)
-
-
返回
- untyped
async method receive()
-
参数
empty
-
返回
- str
async method receive_text()
-
参数
empty
-
返回
- str
async method receive_bytes()
-
参数
empty
-
返回
- bytes
async method send_text(data)
-
参数
data
(str)
-
返回
- None
async method send_bytes(data)
-
参数
data
(bytes)
-
返回
- None