main function now async
This commit is contained in:
parent
19d5d1e3eb
commit
83281f3625
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,4 +3,6 @@
|
|||||||
# PyCharm:
|
# PyCharm:
|
||||||
/.idea/
|
/.idea/
|
||||||
# Distribution / packaging:
|
# Distribution / packaging:
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
# Python cache:
|
||||||
|
__pycache__/
|
@ -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())
|
||||||
|
Loading…
Reference in New Issue
Block a user