From 83281f3625ae26d4eb228ccc4ff13164e4c80991 Mon Sep 17 00:00:00 2001 From: Daniil Fajnberg Date: Sat, 13 Nov 2021 20:39:54 +0100 Subject: [PATCH] main function now async --- .gitignore | 4 +++- src/stocksymbolscraper/__main__.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 96ed22a..50cdbf2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ # PyCharm: /.idea/ # Distribution / packaging: -*.egg-info/ \ No newline at end of file +*.egg-info/ +# Python cache: +__pycache__/ \ No newline at end of file diff --git a/src/stocksymbolscraper/__main__.py b/src/stocksymbolscraper/__main__.py index 9512037..842be88 100644 --- a/src/stocksymbolscraper/__main__.py +++ b/src/stocksymbolscraper/__main__.py @@ -8,7 +8,7 @@ from pathlib import Path from . import get_all_data, log -def main() -> None: +async def main() -> None: parser = ArgumentParser(description="Scrape all stock symbols") parser.add_argument( '-v', '--verbose', @@ -29,7 +29,7 @@ def main() -> None: if args.verbose: log.setLevel(logging.DEBUG) - data = asyncio.run(get_all_data(args.sequential)) + data = await get_all_data(args.sequential) if args.to_file is None: csv.writer(sys.stdout).writerows(data) @@ -39,4 +39,4 @@ def main() -> None: if __name__ == '__main__': - main() + asyncio.run(main())