main function now async

This commit is contained in:
Daniil Fajnberg 2021-11-13 20:39:54 +01:00
parent 19d5d1e3eb
commit 83281f3625
2 changed files with 6 additions and 4 deletions

4
.gitignore vendored
View File

@ -3,4 +3,6 @@
# PyCharm: # PyCharm:
/.idea/ /.idea/
# Distribution / packaging: # Distribution / packaging:
*.egg-info/ *.egg-info/
# Python cache:
__pycache__/

View File

@ -8,7 +8,7 @@ from pathlib import Path
from . import get_all_data, log from . import get_all_data, log
def main() -> None: async def main() -> None:
parser = ArgumentParser(description="Scrape all stock symbols") parser = ArgumentParser(description="Scrape all stock symbols")
parser.add_argument( parser.add_argument(
'-v', '--verbose', '-v', '--verbose',
@ -29,7 +29,7 @@ def main() -> None:
if args.verbose: if args.verbose:
log.setLevel(logging.DEBUG) 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: if args.to_file is None:
csv.writer(sys.stdout).writerows(data) csv.writer(sys.stdout).writerows(data)
@ -39,4 +39,4 @@ def main() -> None:
if __name__ == '__main__': if __name__ == '__main__':
main() asyncio.run(main())