1
0

Import fetchers

This commit is contained in:
Jon Michael Aanes 2024-08-25 20:56:47 +02:00
parent 595640efdf
commit 36b372fb2d
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
3 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,10 @@ from personal_data.notification import NotificationType
def parse_arguments():
available_scraper_names = personal_data.main.available_scraper_names()
if len(available_scraper_names) == 0:
msg = 'Failed to load any scrapers'
raise Exception(msg)
parser = argparse.ArgumentParser(
epilog='Available fetchers: ' + ' '.join(available_scraper_names),
)

View File

@ -64,6 +64,7 @@ def get_session(
def available_scrapers() -> list[type[data.Scraper]]:
from . import fetchers
subclasses = []
class_queue = [data.Scraper]
while class_queue:

7
test/test_main.py Normal file
View File

@ -0,0 +1,7 @@
import personal_data.main
def test_available():
names = personal_data.main.available_scraper_names()
assert len(names) > 0