change placement of json output

This commit is contained in:
Marc Nixon 2023-09-01 10:25:21 -07:00
parent d6f66e5f9e
commit 0c30535972

View file

@ -19,12 +19,13 @@ def run_all(args: argparse.Namespace):
results.update(scraper.scrape()) results.update(scraper.scrape())
print(results) print(results)
# Save the results to a JSON file
with open('results.json', 'w') as json_file:
json.dump(results, json_file, indent=4)
def import_scrapers(): def import_scrapers():
directory = Path(__file__).resolve().parent / "scrapers" directory = Path(__file__).resolve().parent / "scrapers"
for module_loader, name, ispkg in pkgutil.iter_modules([directory]): for module_loader, name, ispkg in pkgutil.iter_modules([directory]):
importlib.import_module(f".scrapers.{name}", __package__) importlib.import_module(f".scrapers.{name}", __package__)
# Save the results to a JSON file
with open('results.json', 'w') as json_file:
json.dump(results, json_file, indent=4)