Skip to content

Collection of educational examples about the HTTP protocol

License

Notifications You must be signed in to change notification settings

lcarnevale/http-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hypertext Transfer Protocol

In this lecture, I’ll provide a walkthrough of how to build a HTTP client-server model using Bottle, Requests and cURL.

You'll create CRUD APIs for creating, reading, update and delete products within a shopping list.

Method Pathname Body Type
POST /products JSON
GET /products
PUT /products/{product} Plain Text
DELETE /products/{product}

HTTP Overview

The Hypertext Transfer Protocol (HTTP) is a web's application-layer protocol that implements the client-server model:

  • the client requests, receives and "displays" web objects, and
  • the server sends objects in response to requests.

A HTTP client initiates a TCP connection (creates socket) to server, over the port 80. The server accepts the TCP connection from client. The hosts exchange HTTP messages before to close the TCP connection.

Install Requirements

Create a virtual environment and install requirements as follow:

sudo pip3 install virtualenv
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

References