mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 20:17:39 +08:00
🐛 hotfix: 天气拉取异常
This commit is contained in:
parent
596f4d06ea
commit
e6ea1b700f
@ -1,6 +1,7 @@
|
||||
import aiohttp
|
||||
|
||||
from .qw_models import *
|
||||
import httpx
|
||||
|
||||
from ...utils.base.data_manager import get_memory_data
|
||||
from ...utils.base.language import Language
|
||||
@ -93,7 +94,7 @@ async def city_lookup(
|
||||
"key" : key,
|
||||
"lang" : lang,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return CityLookup.parse_obj(resp.json())
|
||||
|
||||
@ -113,9 +114,9 @@ async def get_weather_now(
|
||||
"lang" : lang,
|
||||
"unit" : unit,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return await resp.json()
|
||||
return resp.json()
|
||||
|
||||
|
||||
async def get_weather_daily(
|
||||
@ -133,9 +134,9 @@ async def get_weather_daily(
|
||||
"lang" : lang,
|
||||
"unit" : unit,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return await resp.json()
|
||||
return resp.json()
|
||||
|
||||
|
||||
async def get_weather_hourly(
|
||||
@ -153,9 +154,9 @@ async def get_weather_hourly(
|
||||
"lang" : lang,
|
||||
"unit" : unit,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return await resp.json()
|
||||
return resp.json()
|
||||
|
||||
|
||||
async def get_airquality(
|
||||
@ -174,9 +175,9 @@ async def get_airquality(
|
||||
"pollutant": pollutant,
|
||||
"station" : station,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return await resp.json()
|
||||
return resp.json()
|
||||
|
||||
async def get_astronomy(
|
||||
key: str,
|
||||
@ -191,6 +192,6 @@ async def get_astronomy(
|
||||
"location" : location,
|
||||
"date" : date,
|
||||
}
|
||||
async with aiohttp.ClientSession() as client:
|
||||
async with httpx.AsyncClient() as client:
|
||||
resp = await client.get(url, params=params)
|
||||
return await resp.json()
|
||||
return resp.json()
|
Loading…
Reference in New Issue
Block a user