天气查询
This commit is contained in:
@@ -522,13 +522,13 @@ class WeatherPlugin(MessagePluginInterface):
|
||||
# 获取实时天气
|
||||
conn = aiohttp.TCPConnector(ssl=False)
|
||||
now_url = f'{self.api_domain}/v7/weather/now?key={self.api_key}&location={city_id}'
|
||||
async with aiohttp.request('GET', now_url, connector=conn,timeout=20) as resp:
|
||||
async with aiohttp.request('GET', now_url, connector=conn) as resp:
|
||||
now_json = await resp.json()
|
||||
|
||||
# 获取预报
|
||||
conn = aiohttp.TCPConnector(ssl=False)
|
||||
daily_url = f'{self.api_domain}/v7/weather/7d?key={self.api_key}&location={city_id}'
|
||||
async with aiohttp.request('GET', daily_url, connector=conn,timeout=20) as resp:
|
||||
async with aiohttp.request('GET', daily_url, connector=conn) as resp:
|
||||
daily_json = await resp.json()
|
||||
|
||||
if now_json.get('code') != '200' or daily_json.get('code') != '200':
|
||||
|
||||
Reference in New Issue
Block a user