Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,10 +41,10 @@ def get_city_id(city_name):
|
|
41 |
"""A tool that get city ID from city name.
|
42 |
|
43 |
Args:
|
44 |
-
city_name: The city name that want to get city id written in Japanese.
|
45 |
|
46 |
Returns:
|
47 |
-
|
48 |
"""
|
49 |
|
50 |
# XMLのURL
|
@@ -59,7 +59,8 @@ def get_city_id(city_name):
|
|
59 |
root = ET.fromstring(xml_string)
|
60 |
for city in root.findall('.//city'):
|
61 |
if city.get('title') == city_name:
|
62 |
-
|
|
|
63 |
return None
|
64 |
except requests.exceptions.RequestException as e:
|
65 |
print(f"Error during request: {e}")
|
|
|
41 |
"""A tool that get city ID from city name.
|
42 |
|
43 |
Args:
|
44 |
+
city_name: The city name that you want to get city id written in Japanese.
|
45 |
|
46 |
Returns:
|
47 |
+
city_id. If not get, return None.
|
48 |
"""
|
49 |
|
50 |
# XMLのURL
|
|
|
59 |
root = ET.fromstring(xml_string)
|
60 |
for city in root.findall('.//city'):
|
61 |
if city.get('title') == city_name:
|
62 |
+
city_id = city.get('id')
|
63 |
+
return f"city_id is {city_id}"
|
64 |
return None
|
65 |
except requests.exceptions.RequestException as e:
|
66 |
print(f"Error during request: {e}")
|