2023-07-18 21:43:25 +08:00

19 lines
482 B
Python

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}
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_args)