venkat-srinivasan-nexusflow commited on
Commit
6b9a6c0
β€’
1 Parent(s): d18c34d

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +10 -5
tools.py CHANGED
@@ -285,7 +285,6 @@ class Tools:
285
  """
286
  all_reviews = []
287
  for place_name in place_names:
288
- print (f"Found {place_name}!")
289
  if isinstance(place_name, str):
290
  if location and isinstance(location, list) and len(location) > 0:
291
  # Sometimes location will be a list of relevant places from the API.
@@ -304,11 +303,17 @@ class Tools:
304
  and "results" in place_name
305
  and "name" in place_name["results"]
306
  ):
307
- place_name = place_name["results"]["name"]
308
- place_name += ", " + place_name["results"]["vicinity"]
 
 
 
309
  elif isinstance(place_name, dict) and "name" in place_name:
310
- place_name = place_name["name"]
311
- place_name += ", " + place_name["vicinity"]
 
 
 
312
 
313
  print (f"Reformatted it as {place_name}!")
314
  place_details = self.get_latitude_longitude(place_name)
 
285
  """
286
  all_reviews = []
287
  for place_name in place_names:
 
288
  if isinstance(place_name, str):
289
  if location and isinstance(location, list) and len(location) > 0:
290
  # Sometimes location will be a list of relevant places from the API.
 
303
  and "results" in place_name
304
  and "name" in place_name["results"]
305
  ):
306
+ if "vicinity" in place_name["results"]:
307
+ vicinity = ", " + place_name["results"]["vicinity"]
308
+ else:
309
+ vicinity = ""
310
+ place_name = place_name["results"]["name"] + vicinity
311
  elif isinstance(place_name, dict) and "name" in place_name:
312
+ if "vicinity" in place_name:
313
+ vicinity = ", " + place_name["vicinity"]
314
+ else:
315
+ vicinity = ""
316
+ place_name = place_name["name"] + vicinity
317
 
318
  print (f"Reformatted it as {place_name}!")
319
  place_details = self.get_latitude_longitude(place_name)