Requests, responses and URLs
How a web page reaches you
- You type a URL or click a link. Your browser sends a request to a server
- The server runs some code (for us: a Python function)
- It sends back a response: usually HTML, sometimes JSON or an image
- Your browser shows it
Parts of a URL
https://shiftswap.example/shifts/7/claim?from=home
| Part | Example |
|---|---|
| Protocol | https — the S means it's encrypted |
| Domain | shiftswap.example — which server |
| Path | /shifts/7/claim — which page or action |
| Query string | ?from=home — extra details |
Methods: GET and POST
- GET — "show me something". Loading a page. Should never change anything
- POST — "do something". Submitting a form, taking a shift, logging out
Status codes
| Code | Means |
|---|---|
| 200 | OK |
| 302 | Redirect — go to another page |
| 400 | Bad request — something in the request was wrong |
| 401 / 403 | Not logged in / not allowed |
| 404 | Not found |
| 500 | The server's code crashed |
Try it
In Chrome or Edge, press F12 to open DevTools and click the Network tab. Reload any website. Each line is one request — click one and find its method and status code.
