2021-05-05 23:45:10 +02:00
|
|
|
from configparser import SectionProxy
|
|
|
|
from typing import Callable, Dict
|
|
|
|
|
2021-05-23 19:16:42 +02:00
|
|
|
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
|
2021-05-19 21:41:17 +02:00
|
|
|
from .ilias import KitIliasWebCrawler, KitIliasWebCrawlerSection
|
2021-05-23 19:16:42 +02:00
|
|
|
from .local_crawler import LocalCrawler, LocalCrawlerSection
|
2021-04-29 13:44:29 +02:00
|
|
|
|
2021-05-10 23:50:16 +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
|
2021-05-10 23:50:16 +02:00
|
|
|
], Crawler]
|
|
|
|
|
|
|
|
CRAWLERS: Dict[str, CrawlerConstructor] = {
|
2021-05-18 22:43:46 +02:00
|
|
|
"local": lambda n, s, c, a:
|
|
|
|
LocalCrawler(n, LocalCrawlerSection(s), c),
|
2021-05-19 21:41:17 +02:00
|
|
|
"kit-ilias-web": lambda n, s, c, a:
|
|
|
|
KitIliasWebCrawler(n, KitIliasWebCrawlerSection(s), c, a),
|
2021-04-29 13:44:29 +02:00
|
|
|
}
|