mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-03 02:24:51 +08:00
🐛 Fix: httpx proxy 与 aiohttp timeout 参数新版本修改 (#3152)
This commit is contained in:
parent
6df8d5b254
commit
9fed938de1
12
envs/pydantic-v1/poetry.lock
generated
12
envs/pydantic-v1/poetry.lock
generated
@ -1388,13 +1388,13 @@ files = []
|
||||
develop = true
|
||||
|
||||
[package.dependencies]
|
||||
aiohttp = {version = "^3.9.0b0", extras = ["speedups"], optional = true}
|
||||
aiohttp = {version = "^3.11.0", extras = ["speedups"], optional = true}
|
||||
anyio = "^4.4.0"
|
||||
exceptiongroup = "^1.2.2"
|
||||
fastapi = {version = ">=0.93.0,<1.0.0", optional = true}
|
||||
httpx = {version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true}
|
||||
httpx = {version = ">=0.26.0,<1.0.0", extras = ["http2"], optional = true}
|
||||
loguru = ">=0.6.0,<1.0.0"
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0"
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0,!=2.10.1"
|
||||
pygtrie = "^2.4.1"
|
||||
python-dotenv = ">=0.21.0,<2.0.0"
|
||||
Quart = {version = ">=0.18.0,<1.0.0", optional = true}
|
||||
@ -1405,10 +1405,10 @@ websockets = {version = ">=10.0", optional = true}
|
||||
yarl = "^1.7.2"
|
||||
|
||||
[package.extras]
|
||||
aiohttp = ["aiohttp[speedups] (>=3.9.0b0,<4.0.0)"]
|
||||
all = ["Quart (>=0.18.0,<1.0.0)", "aiohttp[speedups] (>=3.9.0b0,<4.0.0)", "fastapi (>=0.93.0,<1.0.0)", "httpx[http2] (>=0.20.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)", "websockets (>=10.0)"]
|
||||
aiohttp = ["aiohttp[speedups] (>=3.11.0,<4.0.0)"]
|
||||
all = ["Quart (>=0.18.0,<1.0.0)", "aiohttp[speedups] (>=3.11.0,<4.0.0)", "fastapi (>=0.93.0,<1.0.0)", "httpx[http2] (>=0.26.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)", "websockets (>=10.0)"]
|
||||
fastapi = ["fastapi (>=0.93.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)"]
|
||||
httpx = ["httpx[http2] (>=0.20.0,<1.0.0)"]
|
||||
httpx = ["httpx[http2] (>=0.26.0,<1.0.0)"]
|
||||
quart = ["Quart (>=0.18.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)"]
|
||||
websockets = ["websockets (>=10.0)"]
|
||||
|
||||
|
12
envs/pydantic-v2/poetry.lock
generated
12
envs/pydantic-v2/poetry.lock
generated
@ -1399,13 +1399,13 @@ files = []
|
||||
develop = true
|
||||
|
||||
[package.dependencies]
|
||||
aiohttp = {version = "^3.9.0b0", extras = ["speedups"], optional = true}
|
||||
aiohttp = {version = "^3.11.0", extras = ["speedups"], optional = true}
|
||||
anyio = "^4.4.0"
|
||||
exceptiongroup = "^1.2.2"
|
||||
fastapi = {version = ">=0.93.0,<1.0.0", optional = true}
|
||||
httpx = {version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true}
|
||||
httpx = {version = ">=0.26.0,<1.0.0", extras = ["http2"], optional = true}
|
||||
loguru = ">=0.6.0,<1.0.0"
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0"
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0,!=2.10.1"
|
||||
pygtrie = "^2.4.1"
|
||||
python-dotenv = ">=0.21.0,<2.0.0"
|
||||
Quart = {version = ">=0.18.0,<1.0.0", optional = true}
|
||||
@ -1416,10 +1416,10 @@ websockets = {version = ">=10.0", optional = true}
|
||||
yarl = "^1.7.2"
|
||||
|
||||
[package.extras]
|
||||
aiohttp = ["aiohttp[speedups] (>=3.9.0b0,<4.0.0)"]
|
||||
all = ["Quart (>=0.18.0,<1.0.0)", "aiohttp[speedups] (>=3.9.0b0,<4.0.0)", "fastapi (>=0.93.0,<1.0.0)", "httpx[http2] (>=0.20.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)", "websockets (>=10.0)"]
|
||||
aiohttp = ["aiohttp[speedups] (>=3.11.0,<4.0.0)"]
|
||||
all = ["Quart (>=0.18.0,<1.0.0)", "aiohttp[speedups] (>=3.11.0,<4.0.0)", "fastapi (>=0.93.0,<1.0.0)", "httpx[http2] (>=0.26.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)", "websockets (>=10.0)"]
|
||||
fastapi = ["fastapi (>=0.93.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)"]
|
||||
httpx = ["httpx[http2] (>=0.20.0,<1.0.0)"]
|
||||
httpx = ["httpx[http2] (>=0.26.0,<1.0.0)"]
|
||||
quart = ["Quart (>=0.18.0,<1.0.0)", "uvicorn[standard] (>=0.20.0,<1.0.0)"]
|
||||
websockets = ["websockets (>=10.0)"]
|
||||
|
||||
|
@ -90,9 +90,7 @@ class Session(HTTPClientSession):
|
||||
@override
|
||||
async def request(self, setup: Request) -> Response:
|
||||
if self._params:
|
||||
params = self._params.copy()
|
||||
params.update(setup.url.query)
|
||||
url = setup.url.with_query(params)
|
||||
url = setup.url.with_query({**self._params, **setup.url.query})
|
||||
else:
|
||||
url = setup.url
|
||||
|
||||
@ -172,11 +170,13 @@ class Mixin(HTTPClientMixin, WebSocketClientMixin):
|
||||
else:
|
||||
raise RuntimeError(f"Unsupported HTTP version: {setup.version}")
|
||||
|
||||
timeout = aiohttp.ClientWSTimeout(ws_close=setup.timeout or 10.0) # type: ignore
|
||||
|
||||
async with aiohttp.ClientSession(version=version, trust_env=True) as session:
|
||||
async with session.ws_connect(
|
||||
setup.url,
|
||||
method=setup.method,
|
||||
timeout=setup.timeout or 10, # type: ignore
|
||||
timeout=timeout,
|
||||
headers=setup.headers,
|
||||
proxy=setup.proxy,
|
||||
) as ws:
|
||||
|
@ -82,6 +82,8 @@ class Session(HTTPClientSession):
|
||||
data=setup.data,
|
||||
files=setup.files,
|
||||
json=setup.json,
|
||||
# ensure the params priority
|
||||
params=setup.url.raw_query_string,
|
||||
headers=tuple(setup.headers.items()),
|
||||
cookies=setup.cookies.jar,
|
||||
timeout=setup.timeout,
|
||||
@ -102,7 +104,7 @@ class Session(HTTPClientSession):
|
||||
headers=self._headers,
|
||||
cookies=self._cookies.jar,
|
||||
http2=self._version == HTTPVersion.H2,
|
||||
proxies=self._proxy,
|
||||
proxy=self._proxy,
|
||||
follow_redirects=True,
|
||||
)
|
||||
await self._client.__aenter__()
|
||||
|
2
poetry.lock
generated
2
poetry.lock
generated
@ -2754,4 +2754,4 @@ websockets = ["websockets"]
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "9a608f08258ea569245a48676ab5a103a1abee7b4458ed68c4c9c25046445c7f"
|
||||
content-hash = "d056b0d9257bca0815a57efa5df5f6e3cf88503a7cb54f8de5ca75264cfd25aa"
|
||||
|
@ -34,13 +34,13 @@ loguru = ">=0.6.0,<1.0.0"
|
||||
python-dotenv = ">=0.21.0,<2.0.0"
|
||||
typing-extensions = ">=4.4.0,<5.0.0"
|
||||
tomli = { version = "^2.0.1", python = "<3.11" }
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0"
|
||||
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1,!=2.10.0,!=2.10.1"
|
||||
|
||||
websockets = { version = ">=10.0", optional = true }
|
||||
Quart = { version = ">=0.18.0,<1.0.0", optional = true }
|
||||
fastapi = { version = ">=0.93.0,<1.0.0", optional = true }
|
||||
aiohttp = { version = "^3.9.0b0", extras = ["speedups"], optional = true }
|
||||
httpx = { version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true }
|
||||
aiohttp = { version = "^3.11.0", extras = ["speedups"], optional = true }
|
||||
httpx = { version = ">=0.26.0,<1.0.0", extras = ["http2"], optional = true }
|
||||
uvicorn = { version = ">=0.20.0,<1.0.0", extras = [
|
||||
"standard",
|
||||
], optional = true }
|
||||
|
Loading…
Reference in New Issue
Block a user