Author: admin
-
Query Parameters
The query is the set of key-value pairs that go after the ? in a URL, separated by & characters. For example, in the URL:http://127.0.0.1:8000/items/?skip=0&limit=10 …the query parameters are: As they are part of the URL, they are “naturally” strings. But when you declare them with Python types (in the example above, as int), they are converted to that type…
-
Path Parameters
The value of the path parameter item_id will be passed to your function as the argument item_id. So, if you run this example and go to http://127.0.0.1:8000/items/foo, you will see a response of:{“item_id”:”foo”} Path parameters with types¶ In this case, item_id is declared to be an int. Check This will give you editor support inside of your function, with error checks, completion,…
-
First Steps
Copy that to a file main.py. Run the live server: Note The command uvicorn main:app refers to: That line shows the URL where your app is being served, in your local machine. Check it¶ Open your browser at http://127.0.0.1:8000. You will see the JSON response as:{“message”: “Hello World”} Interactive API docs¶ Now go to http://127.0.0.1:8000/docs. You will see the automatic…
-
User Guide
This tutorial shows you how to use FastAPI with most of its features, step by step. Each section gradually builds on the previous ones, but it’s structured to separate topics, so that you can go directly to any specific one to solve your specific API needs. It is also built to work as a future reference. So…
-
Flask-WTF
Why WTF Useful? WTF is useful due to the following factors. The WT Forms is a flexible, form rendering, and validation library used to provide the user interface. Install Flask-WTF To use the WT forms, we need to install the flask-wtf library which can be installed using pip installer. The module contains a Form class…
-
Flask SQLAlchemy
Flask SQLAlchemy is an ORM tool which establishes the relationship between the objects and the tables of the relational databases. The mapping between the both is important because the python is capable of storing the data in the form of objects whereas the database stores the data in the form of relational tables, i.e. the…
-
Flask SQLite
Flask can make use of the SQLite3 module of the python to create the database web applications. In this section of the tutorial, we will create a CRUD (create – read – update – delete) application. Since we have given a detailed overview of how a python application can interact with the SQLite database, to…
-
Flask-Mail Extension
Considering the fact that flask is a micro framework, it has its limitations in providing the facilities to the developer. Although, there are several extensions to the flask like Mail, WTF, SQLite, SQLAlchemy, etc. which facilitates the developer to provide some basic facilities to the user. In this section of the tutorial, we will study…
-
Flask Flashing
In the web applications, there are scenarios where the developer might need to flash the messages to provide feedback to the users for the behavior of the application in different cases. Flask provides the flash() method, in the same way, the client-side scripting language like JavaScript uses the alerts or the python GUI framework Tkinter…
-
Flask Redirect and Errors
Flask class provides the redirect() function which redirects the user to some specified URL with the specified status code. An HTTP status code is a response from the server to the request of the browser. When we visit a website, a request is sent to the server, and the server then responds to the browser’s…