优化天气插件
This commit is contained in:
@@ -172,11 +172,10 @@ class WeatherPlugin(MessagePluginInterface):
|
||||
params=params) as response:
|
||||
geoapi_json = await response.json()
|
||||
await conn_ssl.close()
|
||||
self.LOG.debug(f"geoapi_json: {geoapi_json}")
|
||||
if 'code' not in geoapi_json:
|
||||
self.LOG.error(f"API响应格式错误,缺少code字段")
|
||||
self.LOG.debug(f"未查询到城市信息:{city_name},{geoapi_json}")
|
||||
return ""
|
||||
|
||||
|
||||
if geoapi_json['code'] == '404':
|
||||
return ""
|
||||
elif geoapi_json['code'] != '200':
|
||||
|
||||
Reference in New Issue
Block a user