json output into run_all again
This commit is contained in:
parent
c146dbb674
commit
d4cf254df6
1 changed files with 4 additions and 4 deletions
|
@ -17,15 +17,15 @@ 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, default=datetime_handler)
|
||||||
|
|
||||||
def datetime_handler(obj):
|
def datetime_handler(obj):
|
||||||
if isinstance(obj, datetime.datetime):
|
if isinstance(obj, datetime.datetime):
|
||||||
return obj.isoformat()
|
return obj.isoformat()
|
||||||
raise TypeError("Unknown type")
|
raise TypeError("Unknown type")
|
||||||
|
|
||||||
# Save the results to a JSON file
|
|
||||||
with open('results.json', 'w') as json_file:
|
|
||||||
json.dump(results, json_file, indent=4, default=datetime_handler)
|
|
||||||
|
|
||||||
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]):
|
||||||
|
|
Loading…
Reference in a new issue