mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-09-20 23:48:11 +08:00
14 lines
472 B
Python
14 lines
472 B
Python
# -*- coding: utf-8 -*-
|
|
import httpx
|
|
import config
|
|
|
|
|
|
def make_async_client(**kwargs) -> httpx.AsyncClient:
|
|
"""创建统一配置的 httpx.AsyncClient。
|
|
|
|
从配置文件读取 DISABLE_SSL_VERIFY(默认 False,即开启 SSL 验证)。
|
|
仅在使用企业代理、Burp、mitmproxy 等中间人代理时才需将其设为 True。
|
|
"""
|
|
kwargs.setdefault("verify", not getattr(config, "DISABLE_SSL_VERIFY", False))
|
|
return httpx.AsyncClient(**kwargs)
|