From c8a7d855f85ad5a1acdeb02ce1167dcf2cd5e797 Mon Sep 17 00:00:00 2001 From: po-lan <42771836+po-lan@users.noreply.github.com> Date: Tue, 14 Jun 2022 18:47:43 +0800 Subject: [PATCH] Update http_utils.py --- utils/http_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/http_utils.py b/utils/http_utils.py index aa4b97b3..46e0a00e 100644 --- a/utils/http_utils.py +++ b/utils/http_utils.py @@ -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,