diff --git a/src/plugins/nonebot_plugin_heweather/weather_data.py b/src/plugins/nonebot_plugin_heweather/weather_data.py index 01c0c18..9572fc6 100644 --- a/src/plugins/nonebot_plugin_heweather/weather_data.py +++ b/src/plugins/nonebot_plugin_heweather/weather_data.py @@ -84,11 +84,10 @@ async def _get_city_id(self, api_type: str = "lookup"): logger.debug(res) if res["code"] == "404": raise CityNotFoundError() - elif res["code"] != "200": + if res["code"] != "200": raise APIError(f'错误! 错误代码: {res["code"]}{self.__reference}') - else: - self.city_name = res["location"][0]["name"] - return res["location"][0]["id"] + self.city_name = res["location"][0]["name"] + return res["location"][0]["id"] def _data_validate(self): if self.now.code != "200" or self.daily.code != "200":