Skip to content
Extraits de code Groupes Projets
Valider 3ef92d58 rédigé par Tulir Asokan's avatar Tulir Asokan
Parcourir les fichiers

Remove the other usage of asyncio.run

parent bddb5608
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -30,6 +30,7 @@ parser.add_argument("--output-dir", help="Directory to write packs to", default= ...@@ -30,6 +30,7 @@ parser.add_argument("--output-dir", help="Directory to write packs to", default=
type=str) type=str)
parser.add_argument("pack", help="Sticker pack URLs to import", action="append", nargs="*") parser.add_argument("pack", help="Sticker pack URLs to import", action="append", nargs="*")
args = parser.parse_args() args = parser.parse_args()
loop = asyncio.get_event_loop()
async def whoami(url: URL, access_token: str) -> str: async def whoami(url: URL, access_token: str) -> str:
...@@ -51,7 +52,7 @@ except FileNotFoundError: ...@@ -51,7 +52,7 @@ except FileNotFoundError:
homeserver_url = input("Homeserver URL: ") homeserver_url = input("Homeserver URL: ")
access_token = input("Access token: ") access_token = input("Access token: ")
whoami_url = URL(homeserver_url) / "_matrix" / "client" / "r0" / "account" / "whoami" whoami_url = URL(homeserver_url) / "_matrix" / "client" / "r0" / "account" / "whoami"
user_id = asyncio.run(whoami(whoami_url, access_token)) user_id = loop.run_until_complete(whoami(whoami_url, access_token))
with open(args.config, "w") as config_file: with open(args.config, "w") as config_file:
json.dump({ json.dump({
"homeserver": homeserver_url, "homeserver": homeserver_url,
...@@ -255,4 +256,4 @@ async def main(): ...@@ -255,4 +256,4 @@ async def main():
await client.disconnect() await client.disconnect()
asyncio.get_event_loop().run_until_complete(main()) loop.run_until_complete(main())
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter