{"id":28285871,"url":"https://github.com/metinqardasov11/fastapi","last_synced_at":"2026-04-26T08:37:58.823Z","repository":{"id":284262524,"uuid":"934158619","full_name":"MetinQardasov11/FastApi","owner":"MetinQardasov11","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-17T11:23:49.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T22:17:03.857Z","etag":null,"topics":["api","fastapi","http-methods","pydantic-models","python","typing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetinQardasov11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-17T11:21:15.000Z","updated_at":"2025-02-21T19:04:58.000Z","dependencies_parsed_at":"2025-03-25T02:24:31.550Z","dependency_job_id":null,"html_url":"https://github.com/MetinQardasov11/FastApi","commit_stats":null,"previous_names":["alvingasimov/fastapi","metinqardasov11/fastapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MetinQardasov11/FastApi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetinQardasov11%2FFastApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetinQardasov11%2FFastApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetinQardasov11%2FFastApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetinQardasov11%2FFastApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetinQardasov11","download_url":"https://codeload.github.com/MetinQardasov11/FastApi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetinQardasov11%2FFastApi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32291249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T08:29:33.829Z","status":"ssl_error","status_checked_at":"2026-04-26T08:29:18.366Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fastapi","http-methods","pydantic-models","python","typing"],"created_at":"2025-05-21T20:11:01.480Z","updated_at":"2026-04-26T08:37:58.816Z","avatar_url":"https://github.com/MetinQardasov11.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://fastapi.tiangolo.com\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png\" alt=\"FastAPI\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eFastAPI framework, high performance, easy to learn, fast to code, ready for production\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/fastapi/fastapi/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/fastapi/fastapi/actions/workflows/test.yml/badge.svg?event=push\u0026branch=master\" alt=\"Test\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/fastapi\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://coverage-badge.samuelcolvin.workers.dev/fastapi/fastapi.svg\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/fastapi\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/fastapi?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/fastapi\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**Documentation**: \u003ca href=\"https://fastapi.tiangolo.com\" target=\"_blank\"\u003ehttps://fastapi.tiangolo.com\u003c/a\u003e\n\n**Source Code**: \u003ca href=\"https://github.com/fastapi/fastapi\" target=\"_blank\"\u003ehttps://github.com/fastapi/fastapi\u003c/a\u003e\n\n---\n\nFastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints.\n\nThe key features are:\n\n* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).\n* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *\n* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *\n* **Intuitive**: Great editor support. \u003cabbr title=\"also known as auto-complete, autocompletion, IntelliSense\"\u003eCompletion\u003c/abbr\u003e everywhere. Less time debugging.\n* **Easy**: Designed to be easy to use and learn. Less time reading docs.\n* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.\n* **Robust**: Get production-ready code. With automatic interactive documentation.\n* **Standards-based**: Based on (and fully compatible with) the open standards for APIs: \u003ca href=\"https://github.com/OAI/OpenAPI-Specification\" class=\"external-link\" target=\"_blank\"\u003eOpenAPI\u003c/a\u003e (previously known as Swagger) and \u003ca href=\"https://json-schema.org/\" class=\"external-link\" target=\"_blank\"\u003eJSON Schema\u003c/a\u003e.\n\n\u003csmall\u003e* estimation based on tests on an internal development team, building production applications.\u003c/small\u003e\n\n## Sponsors\n\n\u003c!-- sponsors --\u003e\n\n\u003ca href=\"https://blockbee.io?ref=fastapi\" target=\"_blank\" title=\"BlockBee Cryptocurrency Payment Gateway\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/blockbee.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/scalar/scalar/?utm_source=fastapi\u0026utm_medium=website\u0026utm_campaign=main-badge\" target=\"_blank\" title=\"Scalar: Beautiful Open-Source API References from Swagger/OpenAPI files\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/scalar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.propelauth.com/?utm_source=fastapi\u0026utm_campaign=1223\u0026utm_medium=mainbadge\" target=\"_blank\" title=\"Auth, user management and more for your B2B product\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/propelauth.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://zuplo.link/fastapi-gh\" target=\"_blank\" title=\"Zuplo: Deploy, Secure, Document, and Monetize your FastAPI\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/zuplo.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://liblab.com?utm_source=fastapi\" target=\"_blank\" title=\"liblab - Generate SDKs from FastAPI\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/liblab.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://docs.render.com/deploy-fastapi?utm_source=deploydoc\u0026utm_medium=referral\u0026utm_campaign=fastapi\" target=\"_blank\" title=\"Deploy \u0026 scale any full-stack web app on Render. Focus on building apps, not infra.\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/render.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.coderabbit.ai/?utm_source=fastapi\u0026utm_medium=badge\u0026utm_campaign=fastapi\" target=\"_blank\" title=\"Cut Code Review Time \u0026 Bugs in Half with CodeRabbit\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/coderabbit.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://subtotal.com/?utm_source=fastapi\u0026utm_medium=sponsorship\u0026utm_campaign=open-source\" target=\"_blank\" title=\"The Gold Standard in Retail Account Linking\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/subtotal.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://docs.railway.com/guides/fastapi?utm_medium=integration\u0026utm_source=docs\u0026utm_campaign=fastapi\" target=\"_blank\" title=\"Deploy enterprise applications at startup speed\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/railway.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://databento.com/?utm_source=fastapi\u0026utm_medium=sponsor\u0026utm_content=display\" target=\"_blank\" title=\"Pay as you go for market data\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/databento.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://speakeasy.com/editor?utm_source=fastapi+repo\u0026utm_medium=github+sponsorship\" target=\"_blank\" title=\"SDKs for your API | Speakeasy\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/speakeasy.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.svix.com/\" target=\"_blank\" title=\"Svix - Webhooks as a service\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/svix.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.stainlessapi.com/?utm_source=fastapi\u0026utm_medium=referral\" target=\"_blank\" title=\"Stainless | Generate best-in-class SDKs\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/stainless.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.permit.io/blog/implement-authorization-in-fastapi?utm_source=github\u0026utm_medium=referral\u0026utm_campaign=fastapi\" target=\"_blank\" title=\"Fine-Grained Authorization for FastAPI\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/permit.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.interviewpal.com/?utm_source=fastapi\u0026utm_medium=open-source\u0026utm_campaign=dev-hiring\" target=\"_blank\" title=\"InterviewPal - AI Interview Coach for Engineers and Devs\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/interviewpal.png\"\u003e\u003c/a\u003e\n\u003ca href=\"https://dribia.com/en/\" target=\"_blank\" title=\"Dribia - Data Science within your reach\"\u003e\u003cimg src=\"https://fastapi.tiangolo.com/img/sponsors/dribia.png\"\u003e\u003c/a\u003e\n\n\u003c!-- /sponsors --\u003e\n\n\u003ca href=\"https://fastapi.tiangolo.com/fastapi-people/#sponsors\" class=\"external-link\" target=\"_blank\"\u003eOther sponsors\u003c/a\u003e\n\n## Opinions\n\n\"_[...] I'm using **FastAPI** a ton these days. [...] I'm actually planning to use it for all of my team's **ML services at Microsoft**. Some of them are getting integrated into the core **Windows** product and some **Office** products._\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eKabir Khan - \u003cstrong\u003eMicrosoft\u003c/strong\u003e \u003ca href=\"https://github.com/fastapi/fastapi/pull/26\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003ePiero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - \u003cstrong\u003eUber\u003c/strong\u003e \u003ca href=\"https://eng.uber.com/ludwig-v0-2/\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eKevin Glisson, Marc Vilanova, Forest Monsen - \u003cstrong\u003eNetflix\u003c/strong\u003e \u003ca href=\"https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_I’m over the moon excited about **FastAPI**. It’s so fun!_\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eBrian Okken - \u003cstrong\u003e\u003ca href=\"https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855\" target=\"_blank\"\u003ePython Bytes\u003c/a\u003e podcast host\u003c/strong\u003e \u003ca href=\"https://x.com/brianokken/status/1112220079972728832\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted **Hug** to be - it's really inspiring to see someone build that._\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eTimothy Crosley - \u003cstrong\u003e\u003ca href=\"https://github.com/hugapi/hug\" target=\"_blank\"\u003eHug\u003c/a\u003e creator\u003c/strong\u003e \u003ca href=\"https://news.ycombinator.com/item?id=19455465\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_If you're looking to learn one **modern framework** for building REST APIs, check out **FastAPI** [...] It's fast, easy to use and easy to learn [...]_\"\n\n\"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eInes Montani - Matthew Honnibal - \u003cstrong\u003e\u003ca href=\"https://explosion.ai\" target=\"_blank\"\u003eExplosion AI\u003c/a\u003e founders - \u003ca href=\"https://spacy.io\" target=\"_blank\"\u003espaCy\u003c/a\u003e creators\u003c/strong\u003e \u003ca href=\"https://x.com/_inesmontani/status/1144173225322143744\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e - \u003ca href=\"https://x.com/honnibal/status/1144031421859655680\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n\"_If anyone is looking to build a production Python API, I would highly recommend **FastAPI**. It is **beautifully designed**, **simple to use** and **highly scalable**, it has become a **key component** in our API first development strategy and is driving many automations and services such as our Virtual TAC Engineer._\"\n\n\u003cdiv style=\"text-align: right; margin-right: 10%;\"\u003eDeon Pillsbury - \u003cstrong\u003eCisco\u003c/strong\u003e \u003ca href=\"https://www.linkedin.com/posts/deonpillsbury_cisco-cx-python-activity-6963242628536487936-trAp/\" target=\"_blank\"\u003e\u003csmall\u003e(ref)\u003c/small\u003e\u003c/a\u003e\u003c/div\u003e\n\n---\n\n## **Typer**, the FastAPI of CLIs\n\n\u003ca href=\"https://typer.tiangolo.com\" target=\"_blank\"\u003e\u003cimg src=\"https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg\" style=\"width: 20%;\"\u003e\u003c/a\u003e\n\nIf you are building a \u003cabbr title=\"Command Line Interface\"\u003eCLI\u003c/abbr\u003e app to be used in the terminal instead of a web API, check out \u003ca href=\"https://typer.tiangolo.com/\" class=\"external-link\" target=\"_blank\"\u003e**Typer**\u003c/a\u003e.\n\n**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀\n\n## Requirements\n\nFastAPI stands on the shoulders of giants:\n\n* \u003ca href=\"https://www.starlette.dev/\" class=\"external-link\" target=\"_blank\"\u003eStarlette\u003c/a\u003e for the web parts.\n* \u003ca href=\"https://docs.pydantic.dev/\" class=\"external-link\" target=\"_blank\"\u003ePydantic\u003c/a\u003e for the data parts.\n\n## Installation\n\nCreate and activate a \u003ca href=\"https://fastapi.tiangolo.com/virtual-environments/\" class=\"external-link\" target=\"_blank\"\u003evirtual environment\u003c/a\u003e and then install FastAPI:\n\n\u003cdiv class=\"termy\"\u003e\n\n```console\n$ pip install \"fastapi[standard]\"\n\n---\u003e 100%\n```\n\n\u003c/div\u003e\n\n**Note**: Make sure you put `\"fastapi[standard]\"` in quotes to ensure it works in all terminals.\n\n## Example\n\n### Create it\n\nCreate a file `main.py` with:\n\n```Python\nfrom typing import Union\n\nfrom fastapi import FastAPI\n\napp = FastAPI()\n\n\n@app.get(\"/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\ndef read_item(item_id: int, q: Union[str, None] = None):\n    return {\"item_id\": item_id, \"q\": q}\n```\n\n\u003cdetails markdown=\"1\"\u003e\n\u003csummary\u003eOr use \u003ccode\u003easync def\u003c/code\u003e...\u003c/summary\u003e\n\nIf your code uses `async` / `await`, use `async def`:\n\n```Python hl_lines=\"9  14\"\nfrom typing import Union\n\nfrom fastapi import FastAPI\n\napp = FastAPI()\n\n\n@app.get(\"/\")\nasync def read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\nasync def read_item(item_id: int, q: Union[str, None] = None):\n    return {\"item_id\": item_id, \"q\": q}\n```\n\n**Note**:\n\nIf you don't know, check the _\"In a hurry?\"_ section about \u003ca href=\"https://fastapi.tiangolo.com/async/#in-a-hurry\" target=\"_blank\"\u003e`async` and `await` in the docs\u003c/a\u003e.\n\n\u003c/details\u003e\n\n### Run it\n\nRun the server with:\n\n\u003cdiv class=\"termy\"\u003e\n\n```console\n$ fastapi dev main.py\n\n ╭────────── FastAPI CLI - Development mode ───────────╮\n │                                                     │\n │  Serving at: http://127.0.0.1:8000                  │\n │                                                     │\n │  API docs: http://127.0.0.1:8000/docs               │\n │                                                     │\n │  Running in development mode, for production use:   │\n │                                                     │\n │  fastapi run                                        │\n │                                                     │\n ╰─────────────────────────────────────────────────────╯\n\nINFO:     Will watch for changes in these directories: ['/home/user/code/awesomeapp']\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\nINFO:     Started reloader process [2248755] using WatchFiles\nINFO:     Started server process [2248757]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\n```\n\n\u003c/div\u003e\n\n\u003cdetails markdown=\"1\"\u003e\n\u003csummary\u003eAbout the command \u003ccode\u003efastapi dev main.py\u003c/code\u003e...\u003c/summary\u003e\n\nThe command `fastapi dev` reads your `main.py` file, detects the **FastAPI** app in it, and starts a server using \u003ca href=\"https://www.uvicorn.dev\" class=\"external-link\" target=\"_blank\"\u003eUvicorn\u003c/a\u003e.\n\nBy default, `fastapi dev` will start with auto-reload enabled for local development.\n\nYou can read more about it in the \u003ca href=\"https://fastapi.tiangolo.com/fastapi-cli/\" target=\"_blank\"\u003eFastAPI CLI docs\u003c/a\u003e.\n\n\u003c/details\u003e\n\n### Check it\n\nOpen your browser at \u003ca href=\"http://127.0.0.1:8000/items/5?q=somequery\" class=\"external-link\" target=\"_blank\"\u003ehttp://127.0.0.1:8000/items/5?q=somequery\u003c/a\u003e.\n\nYou will see the JSON response as:\n\n```JSON\n{\"item_id\": 5, \"q\": \"somequery\"}\n```\n\nYou already created an API that:\n\n* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.\n* Both _paths_ take `GET` \u003cem\u003eoperations\u003c/em\u003e (also known as HTTP _methods_).\n* The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`.\n* The _path_ `/items/{item_id}` has an optional `str` _query parameter_ `q`.\n\n### Interactive API docs\n\nNow go to \u003ca href=\"http://127.0.0.1:8000/docs\" class=\"external-link\" target=\"_blank\"\u003ehttp://127.0.0.1:8000/docs\u003c/a\u003e.\n\nYou will see the automatic interactive API documentation (provided by \u003ca href=\"https://github.com/swagger-api/swagger-ui\" class=\"external-link\" target=\"_blank\"\u003eSwagger UI\u003c/a\u003e):\n\n![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)\n\n### Alternative API docs\n\nAnd now, go to \u003ca href=\"http://127.0.0.1:8000/redoc\" class=\"external-link\" target=\"_blank\"\u003ehttp://127.0.0.1:8000/redoc\u003c/a\u003e.\n\nYou will see the alternative automatic documentation (provided by \u003ca href=\"https://github.com/Rebilly/ReDoc\" class=\"external-link\" target=\"_blank\"\u003eReDoc\u003c/a\u003e):\n\n![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)\n\n## Example upgrade\n\nNow modify the file `main.py` to receive a body from a `PUT` request.\n\nDeclare the body using standard Python types, thanks to Pydantic.\n\n```Python hl_lines=\"4  9-12  25-27\"\nfrom typing import Union\n\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\n\napp = FastAPI()\n\n\nclass Item(BaseModel):\n    name: str\n    price: float\n    is_offer: Union[bool, None] = None\n\n\n@app.get(\"/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\ndef read_item(item_id: int, q: Union[str, None] = None):\n    return {\"item_id\": item_id, \"q\": q}\n\n\n@app.put(\"/items/{item_id}\")\ndef update_item(item_id: int, item: Item):\n    return {\"item_name\": item.name, \"item_id\": item_id}\n```\n\nThe `fastapi dev` server should reload automatically.\n\n### Interactive API docs upgrade\n\nNow go to \u003ca href=\"http://127.0.0.1:8000/docs\" class=\"external-link\" target=\"_blank\"\u003ehttp://127.0.0.1:8000/docs\u003c/a\u003e.\n\n* The interactive API documentation will be automatically updated, including the new body:\n\n![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)\n\n* Click on the button \"Try it out\", it allows you to fill the parameters and directly interact with the API:\n\n![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)\n\n* Then click on the \"Execute\" button, the user interface will communicate with your API, send the parameters, get the results and show them on the screen:\n\n![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)\n\n### Alternative API docs upgrade\n\nAnd now, go to \u003ca href=\"http://127.0.0.1:8000/redoc\" class=\"external-link\" target=\"_blank\"\u003ehttp://127.0.0.1:8000/redoc\u003c/a\u003e.\n\n* The alternative documentation will also reflect the new query parameter and body:\n\n![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)\n\n### Recap\n\nIn summary, you declare **once** the types of parameters, body, etc. as function parameters.\n\nYou do that with standard modern Python types.\n\nYou don't have to learn a new syntax, the methods or classes of a specific library, etc.\n\nJust standard **Python**.\n\nFor example, for an `int`:\n\n```Python\nitem_id: int\n```\n\nor for a more complex `Item` model:\n\n```Python\nitem: Item\n```\n\n...and with that single declaration you get:\n\n* Editor support, including:\n    * Completion.\n    * Type checks.\n* Validation of data:\n    * Automatic and clear errors when the data is invalid.\n    * Validation even for deeply nested JSON objects.\n* \u003cabbr title=\"also known as: serialization, parsing, marshalling\"\u003eConversion\u003c/abbr\u003e of input data: coming from the network to Python data and types. Reading from:\n    * JSON.\n    * Path parameters.\n    * Query parameters.\n    * Cookies.\n    * Headers.\n    * Forms.\n    * Files.\n* \u003cabbr title=\"also known as: serialization, parsing, marshalling\"\u003eConversion\u003c/abbr\u003e of output data: converting from Python data and types to network data (as JSON):\n    * Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc).\n    * `datetime` objects.\n    * `UUID` objects.\n    * Database models.\n    * ...and many more.\n* Automatic interactive API documentation, including 2 alternative user interfaces:\n    * Swagger UI.\n    * ReDoc.\n\n---\n\nComing back to the previous code example, **FastAPI** will:\n\n* Validate that there is an `item_id` in the path for `GET` and `PUT` requests.\n* Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.\n    * If it is not, the client will see a useful, clear error.\n* Check if there is an optional query parameter named `q` (as in `http://127.0.0.1:8000/items/foo?q=somequery`) for `GET` requests.\n    * As the `q` parameter is declared with `= None`, it is optional.\n    * Without the `None` it would be required (as is the body in the case with `PUT`).\n* For `PUT` requests to `/items/{item_id}`, read the body as JSON:\n    * Check that it has a required attribute `name` that should be a `str`.\n    * Check that it has a required attribute `price` that has to be a `float`.\n    * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.\n    * All this would also work for deeply nested JSON objects.\n* Convert from and to JSON automatically.\n* Document everything with OpenAPI, that can be used by:\n    * Interactive documentation systems.\n    * Automatic client code generation systems, for many languages.\n* Provide 2 interactive documentation web interfaces directly.\n\n---\n\nWe just scratched the surface, but you already get the idea of how it all works.\n\nTry changing the line with:\n\n```Python\n    return {\"item_name\": item.name, \"item_id\": item_id}\n```\n\n...from:\n\n```Python\n        ... \"item_name\": item.name ...\n```\n\n...to:\n\n```Python\n        ... \"item_price\": item.price ...\n```\n\n...and see how your editor will auto-complete the attributes and know their types:\n\n![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)\n\nFor a more complete example including more features, see the \u003ca href=\"https://fastapi.tiangolo.com/tutorial/\"\u003eTutorial - User Guide\u003c/a\u003e.\n\n**Spoiler alert**: the tutorial - user guide includes:\n\n* Declaration of **parameters** from other different places as: **headers**, **cookies**, **form fields** and **files**.\n* How to set **validation constraints** as `maximum_length` or `regex`.\n* A very powerful and easy to use **\u003cabbr title=\"also known as components, resources, providers, services, injectables\"\u003eDependency Injection\u003c/abbr\u003e** system.\n* Security and authentication, including support for **OAuth2** with **JWT tokens** and **HTTP Basic** auth.\n* More advanced (but equally easy) techniques for declaring **deeply nested JSON models** (thanks to Pydantic).\n* **GraphQL** integration with \u003ca href=\"https://strawberry.rocks\" class=\"external-link\" target=\"_blank\"\u003eStrawberry\u003c/a\u003e and other libraries.\n* Many extra features (thanks to Starlette) as:\n    * **WebSockets**\n    * extremely easy tests based on HTTPX and `pytest`\n    * **CORS**\n    * **Cookie Sessions**\n    * ...and more.\n\n## Performance\n\nIndependent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as \u003ca href=\"https://www.techempower.com/benchmarks/#section=test\u0026runid=7464e520-0dc2-473d-bd34-dbdfd7e85911\u0026hw=ph\u0026test=query\u0026l=zijzen-7\" class=\"external-link\" target=\"_blank\"\u003eone of the fastest Python frameworks available\u003c/a\u003e, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)\n\nTo understand more about it, see the section \u003ca href=\"https://fastapi.tiangolo.com/benchmarks/\" class=\"internal-link\" target=\"_blank\"\u003eBenchmarks\u003c/a\u003e.\n\n## Dependencies\n\nFastAPI depends on Pydantic and Starlette.\n\n### `standard` Dependencies\n\nWhen you install FastAPI with `pip install \"fastapi[standard]\"` it comes with the `standard` group of optional dependencies:\n\nUsed by Pydantic:\n\n* \u003ca href=\"https://github.com/JoshData/python-email-validator\" target=\"_blank\"\u003e\u003ccode\u003eemail-validator\u003c/code\u003e\u003c/a\u003e - for email validation.\n\nUsed by Starlette:\n\n* \u003ca href=\"https://www.python-httpx.org\" target=\"_blank\"\u003e\u003ccode\u003ehttpx\u003c/code\u003e\u003c/a\u003e - Required if you want to use the `TestClient`.\n* \u003ca href=\"https://jinja.palletsprojects.com\" target=\"_blank\"\u003e\u003ccode\u003ejinja2\u003c/code\u003e\u003c/a\u003e - Required if you want to use the default template configuration.\n* \u003ca href=\"https://github.com/Kludex/python-multipart\" target=\"_blank\"\u003e\u003ccode\u003epython-multipart\u003c/code\u003e\u003c/a\u003e - Required if you want to support form \u003cabbr title=\"converting the string that comes from an HTTP request into Python data\"\u003e\"parsing\"\u003c/abbr\u003e, with `request.form()`.\n\nUsed by FastAPI:\n\n* \u003ca href=\"https://www.uvicorn.dev\" target=\"_blank\"\u003e\u003ccode\u003euvicorn\u003c/code\u003e\u003c/a\u003e - for the server that loads and serves your application. This includes `uvicorn[standard]`, which includes some dependencies (e.g. `uvloop`) needed for high performance serving.\n* `fastapi-cli[standard]` - to provide the `fastapi` command.\n    * This includes `fastapi-cloud-cli`, which allows you to deploy your FastAPI application to \u003ca href=\"https://fastapicloud.com\" class=\"external-link\" target=\"_blank\"\u003eFastAPI Cloud\u003c/a\u003e.\n\n### Without `standard` Dependencies\n\nIf you don't want to include the `standard` optional dependencies, you can install with `pip install fastapi` instead of `pip install \"fastapi[standard]\"`.\n\n### Without `fastapi-cloud-cli`\n\nIf you want to install FastAPI with the standard dependencies but without the `fastapi-cloud-cli`, you can install with `pip install \"fastapi[standard-no-fastapi-cloud-cli]\"`.\n\n### Additional Optional Dependencies\n\nThere are some additional dependencies you might want to install.\n\nAdditional optional Pydantic dependencies:\n\n* \u003ca href=\"https://docs.pydantic.dev/latest/usage/pydantic_settings/\" target=\"_blank\"\u003e\u003ccode\u003epydantic-settings\u003c/code\u003e\u003c/a\u003e - for settings management.\n* \u003ca href=\"https://docs.pydantic.dev/latest/usage/types/extra_types/extra_types/\" target=\"_blank\"\u003e\u003ccode\u003epydantic-extra-types\u003c/code\u003e\u003c/a\u003e - for extra types to be used with Pydantic.\n\nAdditional optional FastAPI dependencies:\n\n* \u003ca href=\"https://github.com/ijl/orjson\" target=\"_blank\"\u003e\u003ccode\u003eorjson\u003c/code\u003e\u003c/a\u003e - Required if you want to use `ORJSONResponse`.\n* \u003ca href=\"https://github.com/esnme/ultrajson\" target=\"_blank\"\u003e\u003ccode\u003eujson\u003c/code\u003e\u003c/a\u003e - Required if you want to use `UJSONResponse`.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetinqardasov11%2Ffastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetinqardasov11%2Ffastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetinqardasov11%2Ffastapi/lists"}