mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 19:36:43 +08:00
* 🎨 修改 nonebot_bison 目录位置 * auto fix by pre-commit hooks * 🚚 fix frontend build target * 🚚 use soft link * Revert "🚚 use soft link" This reverts commit de21f79d5ae1bd5515b04f42a4138cb25ddf3e62. * 🚚 modify dockerfile --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: felinae98 <731499577@qq.com>
25 lines
583 B
Python
25 lines
583 B
Python
import functools
|
|
|
|
import httpx
|
|
|
|
from ..plugin_config import plugin_config
|
|
|
|
http_args = {
|
|
"proxies": plugin_config.bison_proxy or None,
|
|
}
|
|
http_headers = {"user-agent": plugin_config.bison_ua}
|
|
|
|
|
|
@functools.wraps(httpx.AsyncClient)
|
|
def http_client(*args, **kwargs):
|
|
if headers := kwargs.get("headers"):
|
|
new_headers = http_headers.copy()
|
|
new_headers.update(headers)
|
|
kwargs["headers"] = new_headers
|
|
else:
|
|
kwargs["headers"] = http_headers
|
|
return httpx.AsyncClient(*args, **kwargs)
|
|
|
|
|
|
http_client = functools.partial(http_client, **http_args)
|