diff scobot/index/download_tasks.py @ 16:7a87ba2f00d9

reformat, fix some types, make more async
author drewp@bigasterisk.com
date Fri, 19 Jul 2024 00:49:38 -0700
parents 6622bacb0b84
children
line wrap: on
line diff
--- a/scobot/index/download_tasks.py	Fri Jul 19 00:30:47 2024 -0700
+++ b/scobot/index/download_tasks.py	Fri Jul 19 00:49:38 2024 -0700
@@ -14,8 +14,8 @@
     cache_expiration=datetime.timedelta(seconds=86400),
     tags=['city'],  # todo ratelimit based on tag
 )
-def getCityMutableJson(url: Url):
-    create_link_artifact("get", url)
+async def getCityMutableJson(url: Url):
+    await create_link_artifact("get", url)
     req = httpx.get(url)  # todo async
     req.raise_for_status()
     return req.json()
@@ -24,8 +24,8 @@
 @task(task_run_name=lambda: f'getHttp-{int(time.time())}',
       cache_key_fn=lambda _, args: f'getHttp-{args["url"]}',
       tags=['city'])
-def getCityPermanent(url: Url) -> str:
-    create_link_artifact("get", url)
+async def getCityPermanent(url: Url) -> str:
+    await create_link_artifact("get", url)
     req = httpx.get(url)
     req.raise_for_status()
     return req.text