improve config loading of TMP_DIR, LIB_DIR, move to separate files

This commit is contained in:
Nick Sweeting 2024-10-07 23:45:11 -07:00
parent 7a895d9285
commit cf1ea8f80f
No known key found for this signature in database
49 changed files with 767 additions and 527 deletions
archivebox/misc

View file

@ -1,4 +1,4 @@
__package__ = 'archivebox'
__package__ = 'archivebox.misc'
import re
import requests
@ -25,10 +25,10 @@ except ImportError:
detect_encoding = lambda rawdata: "utf-8"
from archivebox.config.constants import STATICFILE_EXTENSIONS
from archivebox.config import ARCHIVING_CONFIG
from archivebox.config import CONSTANTS
from archivebox.config.common import ARCHIVING_CONFIG
from .misc.logging import COLOR_DICT
from .logging import COLOR_DICT
### Parsing Helpers
@ -120,7 +120,7 @@ def find_all_urls(urls_str: str):
def is_static_file(url: str):
# TODO: the proper way is with MIME type detection + ext, not only extension
return extension(url).lower() in STATICFILE_EXTENSIONS
return extension(url).lower() in CONSTANTS.STATICFILE_EXTENSIONS
def enforce_types(func):