Made execution order correct

This commit is contained in:
Profitroll 2023-03-12 22:58:55 +01:00
parent b74ce9ec89
commit 9bf4663b9e

View File

@ -26,7 +26,7 @@ async def cli_create_user() -> None:
email = input(f"Choose email for user '{username}': ").strip() email = input(f"Choose email for user '{username}': ").strip()
password = input(f"Choose password for user '{username}': ").strip() password = input(f"Choose password for user '{username}': ").strip()
try: try:
result = await create_user(username, email, password) result_1 = await create_user(username, email, password)
# asyncio.run(create_user(username, email, password)) # asyncio.run(create_user(username, email, password))
configSet("username", username, "posting", "api") configSet("username", username, "posting", "api")
configSet("password", password, "posting", "api") configSet("password", password, "posting", "api")
@ -41,6 +41,7 @@ async def cli_create_user() -> None:
print("You're done!", flush=True) print("You're done!", flush=True)
await http_session.close() await http_session.close()
exit() exit()
return None
async def cli_create_album() -> None: async def cli_create_album() -> None:
@ -51,7 +52,7 @@ async def cli_create_album() -> None:
name = input("Choose a name for your album: ").strip() name = input("Choose a name for your album: ").strip()
title = input(f"Choose a title for album '{name}': ").strip() title = input(f"Choose a title for album '{name}': ").strip()
try: try:
result = await create_album(name, title) result_2 = await create_album(name, title)
# asyncio.run(create_album(name, title)) # asyncio.run(create_album(name, title))
configSet("album", name, "posting", "api") configSet("album", name, "posting", "api")
except Exception as exp: except Exception as exp:
@ -61,6 +62,7 @@ async def cli_create_album() -> None:
print("You're done!", flush=True) print("You're done!", flush=True)
await http_session.close() await http_session.close()
exit() exit()
return None
if args.create_user or args.create_album: if args.create_user or args.create_album:
@ -68,10 +70,9 @@ if args.create_user or args.create_album:
tasks = [] tasks = []
if args.create_user: if args.create_user:
tasks.append(loop.create_task(cli_create_user())) loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_user())]))
if args.create_album: if args.create_album:
tasks.append(loop.create_task(cli_create_album())) loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_album())]))
loop.run_until_complete(asyncio.wait(tasks))
loop.close() loop.close()