From 3cea21a0aa6c807e8b07b85924f490573dfc0558 Mon Sep 17 00:00:00 2001 From: jbara Date: Wed, 16 Aug 2023 19:20:33 +0100 Subject: [PATCH] fix: set separate timeout for source fetching --- openweb_proxy/config.py | 1 + openweb_proxy/proxy_miner.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openweb_proxy/config.py b/openweb_proxy/config.py index 2fe3e8c..3d4977d 100644 --- a/openweb_proxy/config.py +++ b/openweb_proxy/config.py @@ -19,6 +19,7 @@ PROXY_PROTOCOL = "socks5" DEFAULT_PROXY = "https://localhost:3128" TIMEOUT = 5 +SOURCE_TIMEOUT = 20 MAX_WORKERS = 10 RE_URL = re.compile(r"^https?://", re.IGNORECASE) diff --git a/openweb_proxy/proxy_miner.py b/openweb_proxy/proxy_miner.py index 87a49ca..04d5cc8 100644 --- a/openweb_proxy/proxy_miner.py +++ b/openweb_proxy/proxy_miner.py @@ -64,7 +64,7 @@ def __init__( def _get_proxies(self, url: str) -> None: """Get proxies list from github and al""" try: - r = requests.get(url, timeout=self.timeout) + r = requests.get(url, timeout=config.SOURCE_TIMEOUT) self.proxies.update( { f"{self.protocol}://{proxy.group(1)}"