Commit 377a52e1 authored by Pierre Arnaud's avatar Pierre Arnaud

Fix JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)

parent d8fc4ff5
......@@ -379,13 +379,12 @@ def territories(request):
url = '{}/poi/search'.format(petitpois_api)
r = requests.get(url, params=dict(k=["service-d-information"], limit=0, w=name))
if r.json().get("errors"):
error["error"] = _("Error: ") + r.json().get("errors").get("where")
return error
elif r.status_code != 200:
if r.status_code != 200:
error["error"] = _("API error")
return error
elif r.json().get("errors"):
error["error"] = _("Error: ") + r.json().get("errors").get("where")
return error
petitpois_responses.append(r.json())
# If territory is a country, don't show multimodal info services
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment