mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-11-04 08:56:42 +00:00 
			
		
		
		
	
		
			Some checks failed
		
		
	
	Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.10) (push) Failing after 1m25s
				
			Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.11) (push) Failing after 1m24s
				
			Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.12) (push) Failing after 1m30s
				
			Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.9) (push) Failing after 1m23s
				
			Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.10) (push) Failing after 1m28s
				
			Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.11) (push) Failing after 1m33s
				
			Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.12) (push) Failing after 1m22s
				
			Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.9) (push) Failing after 1m37s
				
			Pyright Lint / Pyright Lint (pydantic-v1) (push) Failing after 1m23s
				
			Pyright Lint / Pyright Lint (pydantic-v2) (push) Failing after 1m19s
				
			Ruff Lint / Ruff Lint (push) Successful in 27s
				
			Site Deploy / publish (push) Failing after 1m31s
				
			Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.10) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.11) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.12) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.9) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.10) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.11) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.12) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.9) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.10) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.11) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.12) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.9) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.10) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.11) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.12) (push) Has been cancelled
				
			Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.9) (push) Has been cancelled
				
			
		
			
				
	
	
		
			113 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
mdx:
 | 
						|
  format: md
 | 
						|
sidebar_position: 3
 | 
						|
description: nonebot.drivers.httpx 模块
 | 
						|
---
 | 
						|
 | 
						|
# nonebot.drivers.httpx
 | 
						|
 | 
						|
[HTTPX](https://www.python-httpx.org/) 驱动适配
 | 
						|
 | 
						|
```bash
 | 
						|
nb driver install httpx
 | 
						|
# 或者
 | 
						|
pip install nonebot2[httpx]
 | 
						|
```
 | 
						|
 | 
						|
:::tip 提示
 | 
						|
本驱动仅支持客户端 HTTP 连接
 | 
						|
:::
 | 
						|
 | 
						|
## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  - `params` (QueryTypes)
 | 
						|
 | 
						|
  - `headers` (HeaderTypes)
 | 
						|
 | 
						|
  - `cookies` (CookieTypes)
 | 
						|
 | 
						|
  - `version` (str | [HTTPVersion](index.md#HTTPVersion))
 | 
						|
 | 
						|
  - `timeout` (float | None)
 | 
						|
 | 
						|
  - `proxy` (str | None)
 | 
						|
 | 
						|
### _async method_ `request(setup)` {#Session-request}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  - `setup` ([Request](index.md#Request))
 | 
						|
 | 
						|
- **返回**
 | 
						|
 | 
						|
  - [Response](index.md#Response)
 | 
						|
 | 
						|
### _async method_ `setup()` {#Session-setup}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  empty
 | 
						|
 | 
						|
- **返回**
 | 
						|
 | 
						|
  - None
 | 
						|
 | 
						|
### _async method_ `close()` {#Session-close}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  empty
 | 
						|
 | 
						|
- **返回**
 | 
						|
 | 
						|
  - None
 | 
						|
 | 
						|
## _class_ `Mixin(<auto>)` {#Mixin}
 | 
						|
 | 
						|
- **说明:** HTTPX Mixin
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  auto
 | 
						|
 | 
						|
### _async method_ `request(setup)` {#Mixin-request}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  - `setup` ([Request](index.md#Request))
 | 
						|
 | 
						|
- **返回**
 | 
						|
 | 
						|
  - [Response](index.md#Response)
 | 
						|
 | 
						|
### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  - `params` (QueryTypes)
 | 
						|
 | 
						|
  - `headers` (HeaderTypes)
 | 
						|
 | 
						|
  - `cookies` (CookieTypes)
 | 
						|
 | 
						|
  - `version` (str | [HTTPVersion](index.md#HTTPVersion))
 | 
						|
 | 
						|
  - `timeout` (float | None)
 | 
						|
 | 
						|
  - `proxy` (str | None)
 | 
						|
 | 
						|
- **返回**
 | 
						|
 | 
						|
  - Session
 | 
						|
 | 
						|
## _class_ `Driver(env, config)` {#Driver}
 | 
						|
 | 
						|
- **参数**
 | 
						|
 | 
						|
  - `env` ([Env](../config.md#Env))
 | 
						|
 | 
						|
  - `config` ([Config](../config.md#Config))
 |