hgmiya commited on
Commit
19a8d54
·
verified ·
1 Parent(s): 5ffc0c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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. (e.g., '東京', '横浜')
45
 
46
  Returns:
47
- city id. If not get, return None.
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
- return city.get('id')
 
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}")