From 596f4d06ead286925f2d4be902735a1a622eeaaa Mon Sep 17 00:00:00 2001 From: snowykami Date: Sun, 29 Sep 2024 22:35:24 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20bug:=20=E4=BF=AE=E5=A4=8D=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8D=A1=E7=89=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteyuki_weather/qw_api.py | 23 +++++++++---------- .../vanilla_resource/templates/css/status.css | 3 ++- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/nonebot_plugins/liteyuki_weather/qw_api.py b/src/nonebot_plugins/liteyuki_weather/qw_api.py index 22300edd..9f7c28dc 100644 --- a/src/nonebot_plugins/liteyuki_weather/qw_api.py +++ b/src/nonebot_plugins/liteyuki_weather/qw_api.py @@ -1,7 +1,6 @@ import aiohttp from .qw_models import * -import httpx from ...utils.base.data_manager import get_memory_data from ...utils.base.language import Language @@ -94,7 +93,7 @@ async def city_lookup( "key" : key, "lang" : lang, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) return CityLookup.parse_obj(resp.json()) @@ -114,9 +113,9 @@ async def get_weather_now( "lang" : lang, "unit" : unit, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) - return resp.json() + return await resp.json() async def get_weather_daily( @@ -134,9 +133,9 @@ async def get_weather_daily( "lang" : lang, "unit" : unit, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) - return resp.json() + return await resp.json() async def get_weather_hourly( @@ -154,9 +153,9 @@ async def get_weather_hourly( "lang" : lang, "unit" : unit, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) - return resp.json() + return await resp.json() async def get_airquality( @@ -175,9 +174,9 @@ async def get_airquality( "pollutant": pollutant, "station" : station, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) - return resp.json() + return await resp.json() async def get_astronomy( key: str, @@ -192,6 +191,6 @@ async def get_astronomy( "location" : location, "date" : date, } - async with httpx.AsyncClient() as client: + async with aiohttp.ClientSession() as client: resp = await client.get(url, params=params) - return resp.json() \ No newline at end of file + return await resp.json() \ No newline at end of file diff --git a/src/resources/vanilla_resource/templates/css/status.css b/src/resources/vanilla_resource/templates/css/status.css index 64dfe126..bb60440e 100644 --- a/src/resources/vanilla_resource/templates/css/status.css +++ b/src/resources/vanilla_resource/templates/css/status.css @@ -121,9 +121,10 @@ font-size: 24px; margin-left: 20px; text-align: left; - white-space: nowrap; + white-space: normal; /* 允许换行 */ overflow: hidden; text-overflow: ellipsis; + word-break: break-all; /* 允许在单词内换行 */ z-index: 2; }