diff --git a/ADC_function.py b/ADC_function.py index e65ae32..aa0acc6 100755 --- a/ADC_function.py +++ b/ADC_function.py @@ -40,6 +40,7 @@ def get_proxy(proxy: str, proxytype: str = None) -> dict: # 网页请求核心 def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None): + verify=config.Config().cacert_file() switch, proxy, timeout, retry_count, proxytype = config.Config().proxy() proxies = get_proxy(proxy, proxytype) @@ -51,7 +52,7 @@ def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None) for i in range(retry_count): try: if switch == '1' or switch == 1: - result = requests.get(str(url), headers=headers, timeout=timeout, proxies=proxies, cookies=cookies) + result = requests.get(str(url), headers=headers, timeout=timeout, proxies=proxies, verify=verify, cookies=cookies) else: result = requests.get(str(url), headers=headers, timeout=timeout, cookies=cookies) diff --git a/config.ini b/config.ini index ceb30a9..dbcc070 100644 --- a/config.ini +++ b/config.ini @@ -14,6 +14,7 @@ type=http proxy=127.0.0.1:1080 timeout=5 retry=3 +cacert_file= [Name_Rule] location_rule=actor+'/'+number diff --git a/config.py b/config.py index b798ab6..8b54947 100644 --- a/config.py +++ b/config.py @@ -87,6 +87,9 @@ class Config: return switch, proxy, timeout, retry, proxytype except ValueError: self._exit("common") + + def cacert_file(self) -> str: + return self.conf.get('proxy', 'cacert_file') def media_type(self) -> str: return self.conf.get('media', 'media_type') @@ -153,6 +156,8 @@ class Config: conf.set(sec2, "timeout", "5") conf.set(sec2, "retry", "3") conf.set(sec2, "type", "socks5") + conf.set(sec2, "cacert_file", "") + sec3 = "Name_Rule" conf.add_section(sec3)