+ 3
Usefulness of python http module
What exactly is the point of the **http module** in Python since we could compile python with SSL support (through the ssl module) to ignore certificate errors. Sebastian Pacurar David Ashton
3 Respostas
+ 5
ĆœĂŻÂąÄĂž
yes, in terms of fetching or updating data. and also you can make basic severs using http modules which i also don't recommend. by servers i mean to have your own endpoints like localhost to be '/' as endpoint.
in case you connect your server to a DB, and accessing 'localhost:3000/products' (3000 is a port, i just give that number as an example, you can configure any port number you want, except for 80 or 443 which are needed by http and https protocols to communicate through) endpoint it will perform a GET only for your products from your database (let's say you also have users in the DB. The products endpoint will return only the products you have stored in your database). you can't fully achieve that using http module. because you need to configure the MVC structure. Model would be the structure of your DB call and Controller, how the data is processed.
so for the servers plus a DB connection with CRUD (Call, Read, Update, Delete) operations i would recommend you using Flask or Django
+ 5
http is simply hyper text transfer protocol, it's a very lightweight module for http methods (GET, POST, UPDATE, PUT, DELETE). but because it's lightweight i don't recommend it, only for simple things, like fetching data from an API based on some headers you put in the request.
ssl is a bit different, meaning you can create a websocket under a secured layer. it's like you would have https - hyper text transfer protocol secured.
it's been a long while since I've used these specific modules, but i would recommend going for the requests (easier to handle) module, or urllib3 (more customizable) module, if you want to fetch or update data from an API.
and if you intend to build a web server, flask (for smaller and easier to maintain applications) or django (for bigger applications) would be the choice, if you want to do it in python of course
+ 3
Sebastian Pacurar, if I understood what you said, it's kinda better/recommended to use the **requests module** or the **urllib module** since the **http module** is light weight and not so secure right?