fix reference to RequestException
This commit is contained in:
parent
b7d8bcb9b5
commit
05b489982b
|
@ -20,6 +20,8 @@ import random
|
|||
import re
|
||||
import urllib2
|
||||
|
||||
from requests import RequestException
|
||||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.safestring import mark_safe
|
||||
|
@ -171,7 +173,7 @@ def get_suggestions(request, cell, user_data, places_data):
|
|||
try:
|
||||
data_result = requests.get(maplayer.geojson_url, timeout=2,
|
||||
without_user=True, cache_duration=300).json()
|
||||
except requests.RequestException:
|
||||
except RequestException:
|
||||
pass
|
||||
else:
|
||||
city_slug = slugify(city)
|
||||
|
@ -206,7 +208,7 @@ def get_suggestions(request, cell, user_data, places_data):
|
|||
try:
|
||||
search_result = requests.get(url, timeout=2, without_user=True,
|
||||
cache_duration=300).json()
|
||||
except requests.RequestException:
|
||||
except RequestException:
|
||||
continue
|
||||
if not search_result:
|
||||
continue
|
||||
|
@ -220,7 +222,7 @@ def get_suggestions(request, cell, user_data, places_data):
|
|||
try:
|
||||
data_result = requests.get(url, timeout=2, without_user=True,
|
||||
cache_duration=300).json()
|
||||
except requests.RequestException:
|
||||
except RequestException:
|
||||
continue
|
||||
if not data_result.get('features'):
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue