eaf-base-api 2.3.6__tar.gz → 2.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eaf_base_api-2.3.6/eaf_base_api.egg-info → eaf_base_api-2.3.8}/PKG-INFO +1 -1
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/base.py +10 -5
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/modules/errors.py +7 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8/eaf_base_api.egg-info}/PKG-INFO +1 -1
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/setup.py +1 -1
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/LICENSE +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/README.md +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/__init__.py +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/modules/__init__.py +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/modules/config.py +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/base_api/modules/progress_bars.py +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/eaf_base_api.egg-info/SOURCES.txt +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/eaf_base_api.egg-info/dependency_links.txt +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/eaf_base_api.egg-info/requires.txt +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/eaf_base_api.egg-info/top_level.txt +0 -0
- {eaf_base_api-2.3.6 → eaf_base_api-2.3.8}/setup.cfg +0 -0
|
@@ -168,15 +168,16 @@ class BaseCore:
|
|
|
168
168
|
"""
|
|
169
169
|
The base class which has all necessary functions for other API packages
|
|
170
170
|
"""
|
|
171
|
-
def __init__(self, config=config):
|
|
171
|
+
def __init__(self, config=config, auto_init: bool = True):
|
|
172
172
|
self.last_request_time = time.time()
|
|
173
173
|
self.total_requests = 0 # Tracks how many requests have been made
|
|
174
174
|
self.session = None
|
|
175
175
|
self.kill_switch = False
|
|
176
176
|
self.config = config
|
|
177
177
|
self.cache = Cache(self.config)
|
|
178
|
-
self.initialize_session()
|
|
179
178
|
self.logger = setup_logger("BASE API - [BaseCore]", log_file=False, level=logging.ERROR)
|
|
179
|
+
if auto_init:
|
|
180
|
+
self.initialize_session()
|
|
180
181
|
|
|
181
182
|
def enable_logging(self, log_file=None, level=logging.DEBUG, log_ip=None, log_port=None):
|
|
182
183
|
"""
|
|
@@ -232,13 +233,13 @@ class BaseCore:
|
|
|
232
233
|
raise KillSwitch("CRITICAL PROXY ERROR, CHECK LOGS!")
|
|
233
234
|
|
|
234
235
|
|
|
235
|
-
def initialize_session(self
|
|
236
|
+
def initialize_session(self): # Disable SSL verification only if you really need it....
|
|
236
237
|
self.session = httpx.Client(
|
|
237
238
|
proxy=self.config.proxy,
|
|
238
239
|
headers=self.config.headers,
|
|
239
240
|
timeout=self.config.timeout,
|
|
240
241
|
follow_redirects=True,
|
|
241
|
-
verify=
|
|
242
|
+
verify=self.config.verify_ssl
|
|
242
243
|
)
|
|
243
244
|
|
|
244
245
|
def update_headers(self, headers: dict):
|
|
@@ -368,8 +369,12 @@ class BaseCore:
|
|
|
368
369
|
self.logger.error(f"Attempt {attempt}: The connection has been unexpectedly closed by: {url}. Retrying...")
|
|
369
370
|
continue
|
|
370
371
|
|
|
371
|
-
except httpx.RequestError as e:
|
|
372
|
+
except (httpx.RequestError, httpx.ConnectError) as e:
|
|
372
373
|
self.logger.error(f"Attempt {attempt}: Request error for URL {url}: {e}")
|
|
374
|
+
|
|
375
|
+
if "CERTIFICATE_VERIFY_FAILED" in str(e):
|
|
376
|
+
raise ProxySSLError("Proxy has an invalid SSL certificate, to get around this error, set 'verify = False' in config")
|
|
377
|
+
|
|
373
378
|
self.logger.info(f"Retrying ({attempt}/{self.config.max_retries}) for URL: {url}")
|
|
374
379
|
continue # Continuing even failed requests, because they may succeed on another try (maybe idk)
|
|
375
380
|
|
|
@@ -42,3 +42,10 @@ class NetworkingError(Exception):
|
|
|
42
42
|
def __init__(self, message):
|
|
43
43
|
self.message = message
|
|
44
44
|
|
|
45
|
+
|
|
46
|
+
class ProxySSLError(Exception):
|
|
47
|
+
"""
|
|
48
|
+
Raises if a proxy request fails due to self-signed certificates or invalid TLS verification
|
|
49
|
+
"""
|
|
50
|
+
def __init__(self, message):
|
|
51
|
+
self.message = message
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|