diff --git a/appPublic/httpclient.py b/appPublic/httpclient.py index a5b0ba6..1c68879 100755 --- a/appPublic/httpclient.py +++ b/appPublic/httpclient.py @@ -150,7 +150,9 @@ class HttpClient: if headers == {}: headers = None - ssl_ctx = ssl.create_default_context(cafile=certifi.where()) + ssl_ctx = None + if url.startswith('https://'): + ssl_ctx = ssl.create_default_context(cafile=certifi.where()) return await session.request(method, url, params=params, data=data, @@ -166,8 +168,10 @@ class HttpClient: headers=None, **kw ): + domain = get_domain(url) try: - return await self.make_request(url, method=method, + if self.socks5_proxy_url is None or domain not in self.blocked_domains: + return await self.make_request(url, method=method, params=params, data=data, jd=jd, @@ -179,7 +183,6 @@ class HttpClient: exception(f'{e=}, {format_exc()}') if self.socks5_proxy_url is None: raise e - domain = get_domain(url) debug(f'{self.socks5_proxy_url=}, {self.blocked_domains=}, {domain=}') if domain not in self.blocked_domains: self.blocked_domains.add(domain)