Merge pull request #812 from po-lan/main

可关闭 ssl 验证
This commit is contained in:
HibiKier 2022-06-14 19:22:25 +08:00 committed by GitHub
commit 4bb38a2730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ class AsyncHttpx:
params: Optional[Dict[str, Any]] = None,
headers: Optional[Dict[str, str]] = None,
cookies: Optional[Dict[str, str]] = None,
verify: bool = True,
use_proxy: bool = True,
proxy: Dict[str, str] = None,
timeout: Optional[int] = 30,
@ -50,7 +51,7 @@ class AsyncHttpx:
if not headers:
headers = get_user_agent()
proxy = proxy if proxy else cls.proxy if use_proxy else None
async with httpx.AsyncClient(proxies=proxy) as client:
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
return await client.get(
url,
params=params,
@ -68,6 +69,7 @@ class AsyncHttpx:
data: Optional[Dict[str, str]] = None,
content: Any = None,
files: Any = None,
verify: bool = True,
use_proxy: bool = True,
proxy: Dict[str, str] = None,
json: Optional[Dict[str, Union[Any]]] = None,
@ -96,7 +98,7 @@ class AsyncHttpx:
if not headers:
headers = get_user_agent()
proxy = proxy if proxy else cls.proxy if use_proxy else None
async with httpx.AsyncClient(proxies=proxy) as client:
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
return await client.post(
url,
content=content,
@ -117,6 +119,7 @@ class AsyncHttpx:
path: Union[str, Path],
*,
params: Optional[Dict[str, str]] = None,
verify: bool = True,
use_proxy: bool = True,
proxy: Dict[str, str] = None,
headers: Optional[Dict[str, str]] = None,
@ -169,7 +172,7 @@ class AsyncHttpx:
headers = get_user_agent()
proxy = proxy if proxy else cls.proxy if use_proxy else None
try:
async with httpx.AsyncClient(proxies=proxy) as client:
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
async with client.stream(
"GET",
url,