HTTP

The request/response protocol browsers and servers use to communicate on the web.

HTTP (HyperText Transfer Protocol) is the language of the web. A browser sends an HTTP request for a URL, and a server sends back an HTTP response — usually an HTML page, along with a status code like 200 (OK) or 404 (Not Found).

Requests use methods: GET fetches a page, while POST sends data to change something (like submitting a form). Your Python code runs on the server and produces the response.

Example
GET /about HTTP/1.1          <- the browser asks
Host: example.com

HTTP/1.1 200 OK              <- the server answers
Content-Type: text/html

<h1>About us</h1>

Where this shows up in real Python

HTTP is the language of every web request: browsers, APIs, and your own requests.get() calls all speak it.

Commonly used HTTP tools

  • GET / POST — fetch data / send data
  • 200, 404, 500 — OK, not found, server error
  • headers — extra info like content type
  • requests.get(url) — make an HTTP request from Python

Official documentation: MDN Web Docs: HTTP

Related lessons