From the course: Full Stack Web Development with Flask
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Sending a JSON response - Flask Tutorial
From the course: Full Stack Web Development with Flask
Sending a JSON response
- Sending a JSON response. In this video, we're going to take a look at the response object and how to create two very simple APIs to send a JSON response. Recall that a response object is a class that is consist of about six parameters, and the three parameters you see in pink here are the most commonly used parameters. So let's go into the code and see how this is done. Now, let's go and do an example using the post, I mean the response. Now the response is a little bit tricky because again you'll only use that to create APIs. So, let's just say that I'm going to go and create an API and in the URL when I type in API it's going to pass me some data and show me some, and send me some data back to the requester, which is me, right. So, let's go in the code and do something like that. In here, I'm going to just write a very simple API to dump this course data back to the browser, or to the user, using the Response class.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Creating the base template8m 28s
-
(Locked)
Creating child templates6m 54s
-
(Locked)
Passing data to the view10m 27s
-
(Locked)
Accessing data via request and response objects1m 37s
-
(Locked)
URL variables6m 34s
-
(Locked)
Working with the GET method9m 46s
-
(Locked)
Working with the POST method3m 2s
-
(Locked)
Sending a JSON response8m 1s
-
-
-
-