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} |
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.
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