aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-09-08 01:09:06 +0300
committerTulir Asokan <tulir@maunium.net>2020-09-08 01:09:06 +0300
commit3ef92d588ab7bd99a38945a4dd7dff487283aa23 (patch)
tree391351c835b65c0464d9378a6c88225d67dcc22b
parentbddb5608bc7890a430205568794054e7bebe7c30 (diff)
Remove the other usage of asyncio.run
-rw-r--r--import.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/import.py b/import.py
index 1dcbed5..bb1438d 100644
--- a/import.py
+++ b/import.py
@@ -30,6 +30,7 @@ parser.add_argument("--output-dir", help="Directory to write packs to", default=
type=str)
parser.add_argument("pack", help="Sticker pack URLs to import", action="append", nargs="*")
args = parser.parse_args()
+loop = asyncio.get_event_loop()
async def whoami(url: URL, access_token: str) -> str:
@@ -51,7 +52,7 @@ except FileNotFoundError:
homeserver_url = input("Homeserver URL: ")
access_token = input("Access token: ")
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:
json.dump({
"homeserver": homeserver_url,
@@ -255,4 +256,4 @@ async def main():
await client.disconnect()
-asyncio.get_event_loop().run_until_complete(main())
+loop.run_until_complete(main())
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage