mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 08:31:08 -05:00
Add timeout to requests calls
This commit is contained in:
@@ -52,8 +52,8 @@ class LocationSearchView(View):
|
||||
response = requests.get(
|
||||
'https://nominatim.openstreetmap.org/search',
|
||||
params=params,
|
||||
headers={'User-Agent': 'ThrillWiki/1.0'}
|
||||
)
|
||||
headers={'User-Agent': 'ThrillWiki/1.0'},
|
||||
timeout=60)
|
||||
response.raise_for_status()
|
||||
results = response.json()
|
||||
except requests.RequestException as e:
|
||||
@@ -170,8 +170,8 @@ def reverse_geocode(request):
|
||||
'format': 'json',
|
||||
'addressdetails': 1
|
||||
},
|
||||
headers={'User-Agent': 'ThrillWiki/1.0'}
|
||||
)
|
||||
headers={'User-Agent': 'ThrillWiki/1.0'},
|
||||
timeout=60)
|
||||
response.raise_for_status()
|
||||
result = response.json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user