Flask Python
Flask Python
A P P L I C AT I O N S TA C K
CREATING MINDS
THE BASICS
• What is a Web Server?
A web server is a software program that delivers web content to clients over
the Internet or other networks. It is responsible for receiving and processing
HTTP requests from clients (such as web browsers), and sending back the
corresponding HTTP responses along with the requested content (such as
HTML pages, images, videos, etc.).
This allows you to pass Python variables into HTML templates like this:
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>Hello {{ username }}</h1>
</body>
</html>
API-APPLICATION PROGRAMMING INTERFACE
– An API is a set of rules that specifies how two software programs can
interact with each other.
– defines a set of endpoints that allow client applications to access a web-
based service or database
– can be accessed over the internet using standard HTTP requests (such as
GET, POST, and DELETE)
– typically return data in a machine-readable format such as JSON or
XML.
REST API (REPRESENTATIONAL STATE TRANSFER)
– REST API is a software architectural style used for building web services.
– It is based on a client-server model and uses HTTP requests to POST (create),
PUT (update), GET (read), and DELETE (delete) data.
– REST is a lightweight, flexible and scalable alternative to more heavyweight
protocols like SOAP (Simple Object Access Protocol).
– REST APIs are widely used for building modern web and mobile applications.
(Web services are software applications that use standardized protocols, such as
HTTP, to exchange data over the internet. Two types – SOAP and RESTful) )
FLASK-SMOREST
• Flask-Smorest is a Flask extension that provides a simple and easy-to-use
framework for building REST APIs.
• Flask-Smorest also provides a number of features like
– request and response handling
– input validation
– automatic documentation generation
FLASK-JWT
• Flask-JWT is a Flask extension that provides an easy-to-use
authentication library for securing Flask-based web applications.
• It implements JSON Web Tokens (JWT), an open standard for
secure communication between parties.
• Flask-JWT can be used with any RESTful API built with Flask, and
it supports token-based authentication, which eliminates the need to
store user credentials on the server
• With Flask-JWT, you can add authentication to your Flask
application by adding a few lines of code.
SQLALCHEMY - OBJECT RELATIONAL
MAPPER (ORM)
• SQLAlchemy is a Python library for interacting with relational databases.
• allows you to interact with databases in a more Pythonic way, without
having to write raw SQL statements.
• provides a high-level API for working with databases, including SQLite,
MySQL, and PostgreSQL.
• allows you to define your own classes and tables, as well as map your
classes to existing tables.
• provides a full suite of tools for working with schema and data migrations,
making it easier to evolve your database as your application changes.
Web Server
Web Framework
API- REST
SUMMARY
TO
REMEMBER
JWT – JSON Web Tokens
ORM
IN YOUR SPARE TIME