Skip to content
dreamcode
dreamcode
Back to map
Requests + responses · Lesson 39 of 44
+15 XP on finish
PYTHON APPLIED

Handling HTTP requests and responses

Every web request carries data: query parameters in the URL, headers with metadata, and optionally a body with JSON or form data. Your backend reads these inputs, processes them, and returns a response with a status code indicating success or failure.

How it reads
request.args.get('q') reads a query parameter from the URL
200 is the HTTP status code meaning the request succeeded
The response body is a JSON object with query, results, and count
Cloud tip: Common status codes: 200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error.
Check your understanding
Answer all 3 to complete this lesson · +15 XP
1. How do you read a URL query parameter named 'q' in Flask?
2. What HTTP status code means 'resource not found'?
3. What part of an HTTP request typically carries JSON data?