1👍
✅
First problem your api call
i strongly advice you to use requests otherwise you will do stuff like locality = query.replace(' ', '%20')
which urlencodes spaces but what about all the other stuff like öäü + * ? etc. ?
import requests
api_params = {'api_key':locu_api, 'locality': locality, 'category':'restaurant'}
apicall = requests.get(api_url, params=api_params)
json_respons = apicall.json()
Your second problem is (Daniel Roseman mentioned it) that this is a view (which should be in the views.py) and has to return a http response. docs
copypasta
from django.http import HttpResponse
import datetime
def current_datetime(request):
now = datetime.datetime.now()
html = "<html><body>It is now %s.</body></html>" % now
# this will return a html as a http response
return HttpResponse(html)
before asking basics you should do the django tutorial
👤yamm
Source:stackexchange.com