mirror of
https://github.com/Garmelon/PFERD.git
synced 2025-07-12 06:02:31 +02:00
Use global conductor instance
The switch from crawler-local conductors to a single pferd-global conductor was made to prepare for auth section credential providers.
This commit is contained in:
@ -4,7 +4,7 @@ from datetime import datetime
|
||||
from pathlib import Path, PurePath
|
||||
# TODO In Python 3.9 and above, AsyncContextManager is deprecated
|
||||
from typing import (Any, AsyncContextManager, AsyncIterator, Awaitable,
|
||||
Callable, Optional, Protocol, TypeVar)
|
||||
Callable, Optional, TypeVar)
|
||||
|
||||
from rich.markup import escape
|
||||
|
||||
@ -141,8 +141,9 @@ class Crawler(ABC):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
config: Config,
|
||||
section: CrawlerSection,
|
||||
config: Config,
|
||||
conductor: TerminalConductor,
|
||||
) -> None:
|
||||
"""
|
||||
Initialize a crawler from its name and its section in the config file.
|
||||
@ -154,9 +155,9 @@ class Crawler(ABC):
|
||||
"""
|
||||
|
||||
self.name = name
|
||||
|
||||
self._conductor = TerminalConductor()
|
||||
self._conductor = conductor
|
||||
self._limiter = Limiter()
|
||||
self.error_free = True
|
||||
|
||||
try:
|
||||
self._transformer = Transformer(section.transform())
|
||||
@ -171,8 +172,6 @@ class Crawler(ABC):
|
||||
self._conductor,
|
||||
)
|
||||
|
||||
self.error_free = False
|
||||
|
||||
def print(self, text: str) -> None:
|
||||
"""
|
||||
Print rich markup to the terminal. Crawlers *must* use this function to
|
||||
|
Reference in New Issue
Block a user