eaf-base-api 2.2.7__tar.gz → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eaf_base_api
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: A base API for EchterAlsFake's Porn APIs
5
5
  Home-page: https://github.com/EchterAlsFake/eaf_base_api
6
6
  Author: Johannes Habel
@@ -5,7 +5,6 @@ import time
5
5
  import m3u8
6
6
  import json
7
7
  import httpx
8
- import random
9
8
  import logging
10
9
  import traceback
11
10
  import threading
@@ -143,6 +142,7 @@ class Cache:
143
142
  self.cache_dictionary = {}
144
143
  self.lock = threading.Lock()
145
144
  self.logger = setup_logger("BASE API - [Cache]", level=logging.CRITICAL)
145
+ self.config = config
146
146
 
147
147
  def enable_logging(self, log_file=None, level=logging.DEBUG):
148
148
  """
@@ -160,7 +160,7 @@ class Cache:
160
160
 
161
161
  def save_cache(self, url, content):
162
162
  with self.lock:
163
- if len(self.cache_dictionary.keys()) >= config.config.MAX_CACHE_ITEMS:
163
+ if len(self.cache_dictionary.keys()) >= self.config.max_cache_items:
164
164
  first_key = next(iter(self.cache_dictionary))
165
165
  # Delete the first item
166
166
  del self.cache_dictionary[first_key]
@@ -200,7 +200,7 @@ class BaseCore:
200
200
  self.kill_switch = True
201
201
 
202
202
  def check_kill_switch(self):
203
- proxy_ip = self.config.PROXY
203
+ proxy_ip = self.config.proxy
204
204
  pattern = re.compile(
205
205
  r'^(?P<scheme>http|socks5)://'
206
206
  r'(?:(?:\w+:\w+)@)?' # optional user:pass@
@@ -233,16 +233,16 @@ class BaseCore:
233
233
 
234
234
  def initialize_session(self, verify=True): # Disable SSL verification only if you really need it....
235
235
  self.session = httpx.Client(
236
- proxy=self.config.PROXY,
237
- headers=self.config.HEADERS,
238
- timeout=self.config.TIMEOUT,
236
+ proxy=self.config.proxy,
237
+ headers=self.config.headers,
238
+ timeout=self.config.timeout,
239
239
  follow_redirects=True,
240
240
  verify=verify
241
241
  )
242
242
 
243
243
  def enforce_delay(self):
244
244
  """Enforces the specified delay in consts.REQUEST_DELAY"""
245
- delay = self.config.REQUEST_DELAY
245
+ delay = self.config.request_delay
246
246
  if delay > 0:
247
247
  time_since_last_request = time.time() - self.last_request_time
248
248
  self.logger.debug(f"Time since last request: {time_since_last_request:.2f} seconds.")
@@ -276,7 +276,7 @@ class BaseCore:
276
276
  self.logger.info(f"Fetched content for: {url} from cache!")
277
277
  return content
278
278
 
279
- for attempt in range(1, self.config.MAX_RETRIES + 1):
279
+ for attempt in range(1, self.config.max_retries + 1):
280
280
  if attempt != 1:
281
281
  time.sleep(1.5) # Sleeping for 1.5 seconds to minimize site overload when doing a lot of requests
282
282
 
@@ -342,9 +342,9 @@ class BaseCore:
342
342
  except Exception:
343
343
  self.logger.error(f"Attempt {attempt}: Unexpected error for URL {url}: {traceback.format_exc()}")
344
344
 
345
- self.logger.info(f"Retrying ({attempt}/{self.config.MAX_RETRIES}) for URL: {url}")
345
+ self.logger.info(f"Retrying ({attempt}/{self.config.max_retries}) for URL: {url}")
346
346
 
347
- self.logger.error(f"Failed to fetch URL {url} after {self.config.MAX_RETRIES} attempts.")
347
+ self.logger.error(f"Failed to fetch URL {url} after {self.config.max_retries} attempts.")
348
348
  return None # Return None if all attempts fail
349
349
 
350
350
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eaf_base_api
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: A base API for EchterAlsFake's Porn APIs
5
5
  Home-page: https://github.com/EchterAlsFake/eaf_base_api
6
6
  Author: Johannes Habel
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="eaf_base_api",
5
- version="2.2.7",
5
+ version="2.2.8",
6
6
  packages=find_packages(),
7
7
  install_requires=["ffmpeg-progress-yield", "m3u8", "httpx"],
8
8
  entry_points={
File without changes
File without changes
File without changes