From 6a498cc04f94977fed58bde8cb023e4d26d73ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=85=89-k?= <36470587+kxgx@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:38:10 +0800 Subject: [PATCH] Update weather.py --- bin/weather.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/weather.py b/bin/weather.py index 1a21482..fb03f0f 100644 --- a/bin/weather.py +++ b/bin/weather.py @@ -35,15 +35,15 @@ def get_area_id(city_name): for district, info in districts.items(): if info['NAMECN'] == city_name: return info['AREAID'] - logging.error("City name '%s' not found in city data", city_name) + logging.error("城市名称 '%s' 在城市数据中未找到", city_name) else: - logging.error("Empty data received from city.js") + logging.error("从city.js接收到的数据为空") except requests.RequestException as e: - logging.error("Network error when retrieving city data: %s", e) + logging.error("检索城市数据时发生网络错误: %s", e) except json.JSONDecodeError as e: - logging.error("JSON decode error when parsing city data: %s", e) + logging.error("解析城市数据时发生JSON解码错误: %s", e) return None - + def get_current_city(): """获取当前城市名称""" url = "http://ip-api.com/json/?lang=zh-CN"