Recall & Review
beginner
What is the Flask
request object used for?The
request object in Flask holds all the information about the current HTTP request, like form data, query parameters, headers, and more.Click to reveal answer
beginner
How do you access form data sent via POST in Flask?
Use
request.form to get form data sent in a POST request. It acts like a dictionary with form field names as keys.Click to reveal answer
beginner
What property of
request gives you URL query parameters?request.args contains the URL query parameters as a dictionary-like object.Click to reveal answer
beginner
How can you get the HTTP method (GET, POST, etc.) of the current request?
Use
request.method to find out the HTTP method used for the request.Click to reveal answer
intermediate
What property would you use to access JSON data sent in a request?
Use
request.get_json() to get JSON data sent in the request body. It returns a Python dictionary if JSON is valid.Click to reveal answer
Which
request property holds form data sent via POST?✗ Incorrect
request.form contains form data sent in POST requests.How do you get the HTTP method of the current request in Flask?
✗ Incorrect
request.method returns the HTTP method like GET or POST.Which property contains URL query parameters?
✗ Incorrect
request.args holds the URL query parameters.To access JSON data sent in a request body, you use:
✗ Incorrect
request.json parses JSON data from the request body.Which
request property gives you access to raw request data?✗ Incorrect
request.data contains the raw request body as bytes.Explain how to access form data, query parameters, and JSON data from a Flask request object.
Think about where each type of data is sent in an HTTP request.
You got /3 concepts.
Describe how to determine the HTTP method of a request in Flask and why it might be useful.
Consider how web forms and APIs behave differently with GET and POST.
You got /3 concepts.