1. Code directly
import uvicorn from fastapi import FastAPI from pydantic import BaseModel class
Item(BaseModel): a: int = None b: int = None app = FastAPI() @app.get("/") async
def get_info(): ''' It's a simple one get request :return: Direct return data ''' data = { "username":
"test", "password": "admin123" } return data @app.get("/post_info2") async def
post_info2(a: int,b:int): ''' An algorithm with parameters get request :param a: :param b: :return: a + b
''' c = a + b result = {'a': a, 'b': b, 'a+b': c} return result @app.post(
"/post_info1") async def post_info1(request_data: Item): ''' Must pass json Of post Interface
:param request_data: json field (Item class ) :return: return a+b The sum of ''' a = request_data.a b =
request_data.b c = a + b result = {'a': a, 'b': b, 'a+b': c} return result if
__name__== '__main__': uvicorn.run(app=app, host='', port=8000)
2. Request process

3. Request results