Skip to content

Commit

Permalink
Enhance : search Ignore if tm request fails
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Feb 6, 2024
1 parent f6212e9 commit 6468955
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides classes for handling API requests."""

# -*- coding: utf-8 -*-
from distutils.util import strtobool
import itertools
Expand Down Expand Up @@ -647,9 +648,7 @@ def request_geonames(request):
"bbox": geojson,
"adminName2": f'ISO3 : {feature["properties"]["iso_3"]}',
"name": request.GET.get("q"),
"countryName": feature["properties"][
"name"
],
"countryName": feature["properties"]["name"],
"adminName1": feature["properties"]["cid"],
}

Expand Down Expand Up @@ -697,7 +696,10 @@ def request_geonames(request):
if len(lst) >= 1:
keyword = lst[1]
if tm_url:
tm_res = requests.get(f"{tm_url}/{int(keyword)}/")
try:
tm_res = requests.get(f"{tm_url}/{int(keyword)}/")
except Exception as ex:
pass
if tm_res.ok:
tm_res = tm_res.json()
if "areaOfInterest" in tm_res:
Expand Down

0 comments on commit 6468955

Please sign in to comment.