Hey,
I've updated some code and now I think it should work but the problem is I
guess with list book = {}
def api(request):
book = {}
if 'book' in request.GET:
book = request.GET['book']
url = 'https://www.googleapis.com/books/v1/volumes?q=%s' % book
reponse = requests.get(url)
book = response.json()
return render(request, 'books/api.html', {'book': book})
But I'm getting error
name 'response' is not defined
but the get request is correct with status 200, but I'm not sure how to
fetch only fields title and authors, I guess the problem is that because on
the search results are few titles and authors, what do you think Joe?
1.
book = response.json()
...
▼ Local vars <http://127.0.0.1:8000/api?book=frodo#>
VariableValue
book
'frodo'
reponse
<Response [200]>
request
<WSGIRequest: GET '/api?book=frodo'>
url
'https://www.googleapis.com/books/v1/volumes?q=frodo'
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/728bdc19-b7a6-44c9-b57f-218cd637e6b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.