pferd/PFERD/crawl/__init__.py

26 lines
1013 B
Python
Raw Normal View History

2021-05-05 23:45:10 +02:00
from configparser import SectionProxy
from typing import Callable, Dict
from ..auth import Authenticator
2021-05-05 23:45:10 +02:00
from ..config import Config
2021-06-04 18:33:02 +02:00
from .crawler import Crawler, CrawlError, CrawlerSection # noqa: F401
from .ilias import KitIliasWebCrawler, KitIliasWebCrawlerSection
2021-10-21 12:01:41 +02:00
from .kit_ipd_crawler import KitIpdCrawler, KitIpdCrawlerSection
from .local_crawler import LocalCrawler, LocalCrawlerSection
2021-04-29 13:44:29 +02:00
CrawlerConstructor = Callable[[
2021-05-13 18:57:20 +02:00
str, # Name (without the "crawl:" prefix)
SectionProxy, # Crawler's section of global config
Config, # Global config
Dict[str, Authenticator], # Loaded authenticators by name
], Crawler]
CRAWLERS: Dict[str, CrawlerConstructor] = {
"local": lambda n, s, c, a:
LocalCrawler(n, LocalCrawlerSection(s), c),
"kit-ilias-web": lambda n, s, c, a:
KitIliasWebCrawler(n, KitIliasWebCrawlerSection(s), c, a),
2021-10-21 12:01:41 +02:00
"kit-ipd": lambda n, s, c, a:
KitIpdCrawler(n, KitIpdCrawlerSection(s), c),
2021-04-29 13:44:29 +02:00
}