Files
Scrapling/scrapling/__init__.py
T
Karim shoair 264ae02aa7 refactor: huge change, many features/class got a better naming
- `Adaptor` became `Selector`
- `Adaptors` became `Selectors`
- `auto_match` argument/feature became `adaptive`
- `adaptor_arguments` argument became `selector_config`
- `automatch_domain` argument became `adaptive_domain`
- `additional_arguments` argument became `additional_args`
- `storage_adaptors` file became just `storage`
2025-07-29 04:20:23 +03:00

50 lines
1.5 KiB
Python

__author__ = "Karim Shoair (karim.shoair@pm.me)"
__version__ = "0.3-beta"
__copyright__ = "Copyright (c) 2024 Karim Shoair"
# A lightweight approach to create lazy loader for each import for backward compatibility
# This will reduces initial memory footprint significantly (only loads what's used)
def __getattr__(name):
if name == "Fetcher":
from scrapling.fetchers import Fetcher as cls
return cls
elif name == "Selector":
from scrapling.parser import Selector as cls
return cls
elif name == "Selectors":
from scrapling.parser import Selectors as cls
return cls
elif name == "AttributesHandler":
from scrapling.core.custom_types import AttributesHandler as cls
return cls
elif name == "TextHandler":
from scrapling.core.custom_types import TextHandler as cls
return cls
elif name == "AsyncFetcher":
from scrapling.fetchers import AsyncFetcher as cls
return cls
elif name == "StealthyFetcher":
from scrapling.fetchers import StealthyFetcher as cls
return cls
elif name == "DynamicFetcher":
from scrapling.fetchers import DynamicFetcher as cls
return cls
elif name == "CustomFetcher":
from scrapling.fetchers import CustomFetcher as cls
return cls
else:
raise AttributeError(f"module 'scrapling' has no attribute '{name}'")
__all__ = ["Selector", "Fetcher", "AsyncFetcher", "StealthyFetcher", "DynamicFetcher"]