committed by
GitHub
2 changed files with 465 additions and 0 deletions
@ -0,0 +1,464 @@ |
|||
<p align="center"> |
|||
<a href="https://fastapi.tiangolo.com"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" alt="FastAPI"></a> |
|||
</p> |
|||
<p align="center"> |
|||
<em>FastAPI āĻāĻā§āĻāĻā§āĻˇāĻŽāĻ¤āĻž āĻ¸āĻŽā§āĻĒāĻ¨ā§āĻ¨, āĻ¸āĻšāĻā§ āĻļā§āĻāĻžāĻ° āĻāĻŦāĻ āĻĻā§āĻ°ā§āĻ¤ āĻā§āĻĄ āĻāĻ°ā§ āĻĒā§āĻ°ā§āĻĄāĻžāĻāĻļāĻ¨ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻĢā§āĻ°āĻžāĻŽāĻā§āĻžāĻ°ā§āĻāĨ¤</em> |
|||
</p> |
|||
<p align="center"> |
|||
<a href="https://github.com/tiangolo/fastapi/actions?query=workflow%3ATest" target="_blank"> |
|||
<img src="https://github.com/tiangolo/fastapi/workflows/Test/badge.svg" alt="Test"> |
|||
</a> |
|||
<a href="https://codecov.io/gh/tiangolo/fastapi" target="_blank"> |
|||
<img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage"> |
|||
</a> |
|||
<a href="https://pypi.org/project/fastapi" target="_blank"> |
|||
<img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version"> |
|||
</a> |
|||
</p> |
|||
|
|||
--- |
|||
|
|||
**āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a> |
|||
|
|||
**āĻ¸ā§āĻ°ā§āĻ¸ āĻā§āĻĄ**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a> |
|||
|
|||
--- |
|||
|
|||
FastAPI āĻāĻāĻāĻŋ āĻāĻ§ā§āĻ¨āĻŋāĻ, āĻĻā§āĻ°ā§āĻ¤ ( āĻŦā§āĻļāĻŋ āĻā§āĻˇāĻŽāĻ¤āĻž ) āĻ¸āĻŽā§āĻĒāĻ¨ā§āĻ¨, Python 3.6+ āĻĻāĻŋā§ā§ API āĻ¤ā§āĻ°āĻŋāĻ° āĻāĻ¨ā§āĻ¯ āĻ¸ā§āĻā§āĻ¯āĻžāĻ¨ā§āĻĄāĻžāĻ°ā§āĻĄ āĻĒāĻžāĻāĻĨāĻ¨ āĻāĻžāĻāĻĒ āĻāĻā§āĻāĻŋāĻ¤ āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ āĻāĻ¯āĻŧā§āĻŦ āĻĢā§āĻ°ā§āĻŽāĻāĻ¯āĻŧāĻžāĻ°ā§āĻāĨ¤ |
|||
|
|||
āĻāĻ° āĻŽā§āĻ˛ āĻŦā§āĻļāĻŋāĻˇā§āĻā§āĻ¯ āĻā§āĻ˛ā§ āĻšāĻ˛āĻ |
|||
|
|||
- **āĻāĻ¤āĻŋ**: āĻāĻāĻŋ **NodeJS** āĻāĻŦāĻ **Go** āĻāĻ° āĻŽāĻ¤ āĻāĻžāĻ°ā§āĻ¯āĻā§āĻˇāĻŽāĻ¤āĻž āĻ¸āĻŽā§āĻĒāĻ¨ā§āĻ¨ (Starlette āĻāĻŦāĻ Pydantic āĻāĻ° āĻ¸āĻžāĻšāĻžāĻ¯ā§āĻ¯ā§)āĨ¤ [āĻĒāĻžāĻāĻĨāĻ¨ āĻāĻ° āĻĻā§āĻ°ā§āĻ¤āĻ¤āĻŽ āĻĢā§āĻ°ā§āĻŽāĻāĻ¯āĻŧāĻžāĻ°ā§āĻ āĻā§āĻ˛ā§āĻ° āĻŽāĻ§ā§āĻ¯ā§ āĻāĻāĻŋ āĻāĻāĻāĻŋ](#_11)āĨ¤ |
|||
- **āĻĻā§āĻ°ā§āĻ¤ āĻā§āĻĄ āĻāĻ°āĻž**:āĻŦā§āĻļāĻŋāĻˇā§āĻā§āĻ¯ āĻ¤ā§āĻ°āĻŋāĻ° āĻāĻ¤āĻŋ ā§¨ā§Ļā§Ļ% āĻĨā§āĻā§ ā§Šā§Ļā§Ļ% āĻŦā§āĻĻā§āĻ§āĻŋ āĻāĻ°ā§ā§ˇ \* |
|||
- **āĻ¸ā§āĻŦāĻ˛ā§āĻĒ bugs**: āĻŽāĻžāĻ¨ā§āĻŦ (āĻĄā§āĻā§āĻ˛āĻĒāĻžāĻ°) āĻ¸ā§āĻˇā§āĻ āĻ¤ā§āĻ°ā§āĻāĻŋāĻ° āĻĒā§āĻ°āĻžāĻ¯āĻŧ ā§Ēā§Ļ% āĻšā§āĻ°āĻžāĻ¸ āĻāĻ°ā§āĨ¤ \* |
|||
- **āĻ¸ā§āĻŦāĻā§āĻāĻžāĻ¤**: āĻĻā§āĻ°ā§āĻĻāĻžāĻ¨ā§āĻ¤ āĻāĻĄāĻŋāĻāĻ° āĻ¸āĻžāĻšāĻžāĻ¯ā§āĻ¯ <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> āĻ¨āĻžāĻŽā§āĻ āĻĒāĻ°āĻŋāĻāĻŋāĻ¤āĨ¤ āĻĻā§āĻ°ā§āĻ¤ āĻĄāĻŋāĻŦāĻžāĻ āĻāĻ°āĻž āĻ¯āĻžā§āĨ¤ |
|||
|
|||
- **āĻ¸āĻšāĻ**: āĻāĻāĻŋ āĻāĻŽāĻ¨ āĻāĻžāĻŦā§ āĻ¸āĻāĻžāĻ¨ā§ āĻšā§ā§āĻā§ āĻ¯ā§āĻ¨ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻĒā§ā§ āĻ¸āĻšāĻā§ āĻļā§āĻāĻž āĻāĻŦāĻ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻ¯āĻžā§āĨ¤ |
|||
- **āĻ¸āĻāĻā§āĻˇāĻŋāĻĒā§āĻ¤**: āĻā§āĻĄ āĻĒā§āĻ¨āĻ°āĻžāĻŦā§āĻ¤ā§āĻ¤āĻŋ āĻāĻŽāĻžāĻ¨ā§āĻ° āĻĒāĻžāĻļāĻžāĻĒāĻžāĻļāĻŋ, bug āĻāĻŽāĻžā§ āĻāĻŦāĻ āĻĒā§āĻ°āĻ¤āĻŋāĻāĻŋ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻā§āĻˇāĻŖāĻž āĻĨā§āĻā§ āĻāĻāĻžāĻ§āĻŋāĻ āĻĢāĻŋāĻāĻžāĻ° āĻĒāĻžāĻā§āĻž āĻ¯āĻžā§ āĨ¤ |
|||
- **āĻā§āĻ°āĻžāĻ˛ā§**: āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻāĻžāĻŦā§ āĻ¤ā§āĻ°āĻŋ āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻ¨āĻž āĻ¨āĻĨāĻŋ (documentation) āĻ¸āĻš āĻā§āĻĒāĻžāĻĻāĻ¨ āĻāĻĒāĻ¯ā§āĻāĻŋ (Production-ready) āĻā§āĻĄ āĻĒāĻžāĻā§āĻž āĻ¯āĻžā§āĨ¤ |
|||
- **āĻŽāĻžāĻ¨-āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ**: āĻāĻ° āĻāĻŋāĻ¤ā§āĻ¤āĻŋ <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (āĻ¯āĻž āĻĒā§āĻ°ā§āĻŦā§ Swagger āĻ¨āĻžāĻŽā§ āĻĒāĻ°āĻŋāĻāĻŋāĻ¤ āĻāĻŋāĻ˛) āĻāĻŦāĻ <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a> āĻāĻ° āĻāĻĻāĻ°ā§āĻļā§āĻ° āĻŽāĻžāĻ¨ā§āĻ° āĻāĻĒāĻ° |
|||
|
|||
<small>\* āĻā§āĻĒāĻžāĻĻāĻ¨āĻŽā§āĻāĻŋ āĻāĻĒā§āĻ˛āĻŋāĻā§āĻļāĻ¨ āĻŦāĻžāĻ¨āĻžāĻ¨ā§āĻ° āĻāĻ āĻĻāĻ˛ āĻĄā§āĻā§āĻ˛āĻĒāĻžāĻ° āĻāĻ° āĻŽāĻ¤āĻžāĻŽāĻ¤ āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ āĻĢāĻ˛āĻžāĻĢāĻ˛āĨ¤</small> |
|||
|
|||
## āĻ¸ā§āĻĒāĻ¨āĻ¸āĻ° āĻāĻŖ |
|||
|
|||
<!-- sponsors --> |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor -%} |
|||
{%- for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
<!-- /sponsors --> |
|||
|
|||
<a href="https://fastapi.tiangolo.com/fastapi-people/#sponsors" class="external-link" target="_blank">āĻ
āĻ¨ā§āĻ¯āĻžāĻ¨ā§āĻ¯ āĻ¸ā§āĻĒāĻ¨āĻ¸āĻ° āĻāĻŖ</a> |
|||
|
|||
## āĻŽāĻ¤āĻžāĻŽāĻ¤ āĻ¸āĻŽā§āĻš |
|||
|
|||
"_āĻāĻŽāĻŋ āĻāĻāĻāĻžāĻ˛ **FastAPI** āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻāĻŋāĨ¤ [...] āĻāĻŽāĻ°āĻž āĻāĻžāĻŦāĻāĻŋ āĻŽāĻžāĻāĻā§āĻ°ā§āĻ¸āĻĢā§āĻā§ **ML āĻ¸āĻžāĻ°ā§āĻāĻŋāĻ¸** āĻ āĻ¸āĻāĻ˛ āĻĻāĻ˛ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻāĻāĻŋ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻŦāĨ¤ āĻ¯āĻžāĻ° āĻŽāĻ§ā§āĻ¯ā§ āĻāĻŋāĻā§ āĻĒāĻŖā§āĻ¯ **Windows** āĻ āĻ¸āĻāĻ¯ā§āĻ¯āĻ¨ āĻšā§ āĻāĻŦāĻ āĻāĻŋāĻā§ **Office** āĻāĻ° āĻ¸āĻžāĻĨā§ āĻ¸āĻāĻ¯ā§āĻ¯āĻ¨ āĻšāĻā§āĻā§āĨ¤_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻāĻŦāĻŋāĻ° āĻāĻžāĻ¨ - <strong>āĻŽāĻžāĻāĻā§āĻ°ā§āĻ¸āĻĢā§āĻā§</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_āĻāĻŽāĻ°āĻž **FastAPI** āĻ˛āĻžāĻāĻŦā§āĻ°ā§āĻ°āĻŋ āĻā§āĻ°āĻšāĻŖ āĻāĻ°ā§āĻāĻŋ āĻāĻāĻāĻŋ **REST** āĻ¸āĻžāĻ°ā§āĻāĻžāĻ° āĻ¤ā§āĻ°āĻŋ āĻāĻ°āĻ¤ā§, āĻ¯āĻž **āĻāĻŦāĻŋāĻˇā§āĻ¯āĻĻā§āĻŦāĻžāĻŖā§** āĻĒāĻžāĻāĻ¯āĻŧāĻžāĻ° āĻāĻ¨ā§āĻ¯ āĻā§ā§ā§āĻ°āĻŋ āĻāĻ°āĻž āĻ¯ā§āĻ¤ā§ āĻĒāĻžāĻ°ā§āĨ¤ [āĻ˛ā§āĻĄāĻāĻāĻā§āĻ° āĻāĻ¨ā§āĻ¯]_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻĒāĻŋāĻ¯āĻŧā§āĻ°ā§ āĻŽā§āĻ˛āĻŋāĻ¨ā§, āĻāĻ¯āĻŧāĻžāĻ°ā§āĻ¸ā§āĻ˛āĻžāĻ āĻĻā§āĻĻāĻŋāĻ¨, āĻāĻŦāĻ āĻ¸āĻžāĻ āĻ¸ā§āĻŽāĻ¨ā§āĻĨ āĻŽāĻŋāĻ°āĻŋāĻ¯āĻŧāĻžāĻ˛āĻž - <strong>āĻāĻŦāĻžāĻ°</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_**Netflix** āĻāĻŽāĻžāĻĻā§āĻ° **āĻā§āĻ°āĻžāĻāĻ¸āĻŋāĻ¸ āĻŽā§āĻ¯āĻžāĻ¨ā§āĻāĻŽā§āĻ¨ā§āĻ** āĻ
āĻ°ā§āĻā§āĻ¸ā§āĻā§āĻ°ā§āĻļāĻ¨ āĻĢā§āĻ°ā§āĻŽāĻāĻ¯āĻŧāĻžāĻ°ā§āĻ: **āĻĄāĻŋāĻ¸āĻĒā§āĻ¯āĻžāĻ** āĻāĻ° āĻāĻĒā§āĻ¨ āĻ¸ā§āĻ°ā§āĻ¸ āĻ°āĻŋāĻ˛āĻŋāĻ āĻā§āĻˇāĻŖāĻž āĻāĻ°āĻ¤ā§ āĻĒā§āĻ°ā§ āĻāĻ¨āĻ¨ā§āĻĻāĻŋāĻ¤! [āĻ¯āĻžāĻāĻŋāĻ¨āĻž **FastAPI** āĻĻāĻŋāĻ¯āĻŧā§ āĻ¨āĻŋāĻ°ā§āĻŽāĻŋāĻ¤]_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻā§āĻāĻŋāĻ¨ āĻā§āĻ˛āĻŋāĻ¸āĻ¨, āĻŽāĻžāĻ°ā§āĻ āĻāĻŋāĻ˛āĻžāĻ¨ā§āĻāĻž, āĻĢāĻ°ā§āĻ¸ā§āĻ āĻŽāĻ¨āĻ¸ā§āĻ¨ - <strong>āĻ¨ā§āĻāĻĢā§āĻ˛āĻŋāĻā§āĻ¸</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"_āĻāĻŽāĻŋ **FastAPI** āĻ¨āĻŋāĻ¯āĻŧā§ āĻāĻžāĻāĻĻā§āĻ° āĻ¸āĻŽāĻžāĻ¨ āĻā§āĻ¸āĻžāĻšāĻŋāĻ¤āĨ¤ āĻāĻāĻŋ āĻā§āĻŦāĻ āĻŽāĻāĻžāĻ°!_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻŦā§āĻ°āĻžāĻ¯āĻŧāĻžāĻ¨ āĻāĻā§āĻ¨ - <strong><a href="https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855" target="_blank">āĻĒāĻžāĻāĻĨāĻ¨ āĻŦāĻžāĻāĻāĻ¸</a> āĻĒāĻĄāĻāĻžāĻ¸ā§āĻ āĻšā§āĻ¸ā§āĻ</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"\_āĻ¸āĻ¤ā§āĻ¯āĻŋāĻ, āĻāĻĒāĻ¨āĻŋ āĻ¯āĻž āĻ¤ā§āĻ°āĻŋ āĻāĻ°ā§āĻā§āĻ¨ āĻ¤āĻž āĻā§āĻŦ āĻŽāĻāĻŦā§āĻ¤ āĻāĻŦāĻ āĻĒāĻ°āĻŋāĻĒā§āĻ°ā§āĻ¨ā§ˇ āĻ
āĻ¨ā§āĻ āĻāĻĒāĻžāĻ¯āĻŧā§, āĻāĻŽāĻŋ āĻ¯āĻž **Hug** āĻ āĻāĻ°āĻ¤ā§ āĻā§ā§ā§āĻāĻŋāĻ˛āĻžāĻŽ - āĻ¤āĻž āĻāĻžāĻāĻā§ āĻ¤ā§āĻ°āĻŋ āĻāĻ°āĻ¤ā§ āĻĻā§āĻā§ āĻāĻŽāĻŋ āĻ¸āĻ¤ā§āĻ¯āĻŋāĻ āĻ
āĻ¨ā§āĻĒā§āĻ°āĻžāĻ¨āĻŋāĻ¤ā§ˇ\_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻāĻŋāĻŽā§āĻĨāĻŋ āĻā§āĻ°āĻ¸āĻ˛ā§ - <strong><a href="https://www.hug.rest/" target="_blank">Hug</a> āĻ¸ā§āĻ°āĻˇā§āĻāĻž</strong> <a href="https://news.ycombinator.com/item?id=19455465" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
"āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ REST API āĻ¤ā§āĻ°āĻŋāĻ° āĻāĻ¨ā§āĻ¯ āĻāĻāĻāĻŋ **āĻāĻ§ā§āĻ¨āĻŋāĻ āĻĢā§āĻ°ā§āĻŽāĻā§āĻžāĻ°ā§āĻ** āĻļāĻŋāĻāĻ¤ā§ āĻāĻžāĻ¨, āĻ¤āĻžāĻšāĻ˛ā§ **FastAPI** āĻĻā§āĻā§āĻ¨ [...] āĻāĻāĻŋ āĻĻā§āĻ°ā§āĻ¤, āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻ¸āĻšāĻ āĻāĻŦāĻ āĻļāĻŋāĻāĻ¤ā§āĻ āĻ¸āĻšāĻ [...]\_" |
|||
|
|||
"_āĻāĻŽāĻ°āĻž āĻāĻŽāĻžāĻĻā§āĻ° **APIs** [...] āĻāĻ° āĻāĻ¨ā§āĻ¯ **FastAPI**- āĻ¤ā§ āĻāĻ¸ā§āĻāĻŋ [...] āĻāĻŽāĻŋ āĻŽāĻ¨ā§ āĻāĻ°āĻŋ āĻāĻĒāĻ¨āĻŋāĻ āĻāĻāĻŋ āĻĒāĻāĻ¨ā§āĻĻ āĻāĻ°āĻŦā§āĻ¨ [...]_" |
|||
|
|||
<div style="text-align: right; margin-right: 10%;">āĻāĻ¨ā§āĻ¸ āĻŽāĻ¨ā§āĻāĻžāĻ¨āĻŋ - āĻŽā§āĻ¯āĻžāĻĨāĻŋāĻ āĻšā§āĻ¨āĻŋāĻŦāĻžāĻ˛ - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> āĻĒā§āĻ°āĻ¤āĻŋāĻˇā§āĻ āĻžāĻ¤āĻž - <a href="https://spacy.io" target="_blank">spaCy</a> āĻ¸ā§āĻ°āĻˇā§āĻāĻž</strong> <a href="https://twitter.com/_inesmontani/status/1144173225322143744" target="_blank"><small>(ref)</small></a> - <a href="https://twitter.com/honnibal/status/1144031421859655680" target="_blank"><small>(ref)</small></a></div> |
|||
|
|||
--- |
|||
|
|||
## **Typer**, CLI āĻāĻ° āĻāĻ¨ā§āĻ¯ FastAPI |
|||
|
|||
<a href="https://typer.tiangolo.com" target="_blank"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" style="width: 20%;"></a> |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ <abbr title="Command Line Interface">CLI</abbr> āĻ
ā§āĻ¯āĻžāĻĒ āĻŦāĻžāĻ¨āĻžāĻ¤ā§ āĻāĻžāĻ¨, āĻ¯āĻž āĻāĻŋāĻ¨āĻž āĻā§ā§āĻŦ API āĻāĻ° āĻĒāĻ°āĻŋāĻŦāĻ°ā§āĻ¤ā§ āĻāĻžāĻ°ā§āĻŽāĻŋāĻ¨āĻžāĻ˛ā§ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻšāĻŦā§, āĻ¤āĻžāĻšāĻ˛ā§ āĻĻā§āĻā§āĻ¨<a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>. |
|||
|
|||
**āĻāĻžāĻāĻĒāĻžāĻ°** āĻšāĻ˛ FastAPI āĻāĻ° āĻā§āĻ āĻāĻžāĻā§ā§āĻ° āĻŽāĻ¤āĨ¤ āĻāĻŦāĻ āĻāĻāĻŋāĻ° āĻāĻĻā§āĻĻā§āĻļā§āĻ¯ āĻāĻŋāĻ˛ **CLIs āĻāĻ° FastAPI** āĻšāĻā§āĻžāĨ¤ â¨ī¸ đ |
|||
|
|||
## āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ā§āĻ¯āĻŧāĻ¤āĻž āĻā§āĻ˛ā§ |
|||
|
|||
Python 3.7+ |
|||
|
|||
FastAPI āĻāĻŋāĻā§ āĻĻāĻžāĻ¨āĻŦā§āĻĻā§āĻ° āĻāĻžāĻāĻ§ā§ āĻĻāĻžāĻāĻĄāĻŧāĻŋāĻ¯āĻŧā§ āĻāĻā§: |
|||
|
|||
- <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> āĻāĻ¯āĻŧā§āĻŦ āĻ
āĻāĻļā§āĻ° āĻāĻ¨ā§āĻ¯. |
|||
- <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> āĻĄā§āĻāĻž āĻ
āĻāĻļāĻā§āĻ˛āĻŋāĻ° āĻāĻ¨ā§āĻ¯. |
|||
|
|||
## āĻāĻ¨āĻ¸ā§āĻāĻ˛ā§āĻļāĻ¨ āĻĒā§āĻ°āĻā§āĻ°āĻŋā§āĻž |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install fastapi |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
āĻāĻĒāĻ¨āĻžāĻ° āĻāĻāĻāĻŋ ASGI āĻ¸āĻžāĻ°ā§āĻāĻžāĻ°ā§āĻ°āĻ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ āĻšāĻŦā§, āĻĒā§āĻ°ā§āĻĄāĻžāĻāĻļāĻ¨ā§āĻ° āĻāĻ¨ā§āĻ¯ <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> āĻ
āĻĨāĻŦāĻž <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>. |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ pip install "uvicorn[standard]" |
|||
|
|||
---> 100% |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
## āĻāĻĻāĻžāĻšāĻ°āĻŖ |
|||
|
|||
### āĻ¤ā§āĻ°āĻŋ |
|||
|
|||
- `main.py` āĻ¨āĻžāĻŽā§ āĻāĻāĻāĻŋ āĻĢāĻžāĻāĻ˛ āĻ¤ā§āĻ°āĻŋ āĻāĻ°ā§āĻ¨: |
|||
|
|||
```Python |
|||
from typing import Union |
|||
|
|||
from fastapi import FastAPI |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
@app.get("/") |
|||
def read_root(): |
|||
return {"Hello": "World"} |
|||
|
|||
|
|||
@app.get("/items/{item_id}") |
|||
def read_item(item_id: int, q: Union[str, None] = None): |
|||
return {"item_id": item_id, "q": q} |
|||
``` |
|||
|
|||
<details markdown="1"> |
|||
<summary>āĻ
āĻĨāĻŦāĻž āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°ā§āĻ¨ <code>async def</code>...</summary> |
|||
|
|||
āĻ¯āĻĻāĻŋ āĻāĻĒāĻ¨āĻžāĻ° āĻā§āĻĄ `async` / `await`, āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°ā§ āĻ¤āĻžāĻšāĻ˛ā§ `async def` āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°ā§āĻ¨: |
|||
|
|||
```Python hl_lines="9 14" |
|||
from typing import Union |
|||
|
|||
from fastapi import FastAPI |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
@app.get("/") |
|||
async def read_root(): |
|||
return {"Hello": "World"} |
|||
|
|||
|
|||
@app.get("/items/{item_id}") |
|||
async def read_item(item_id: int, q: Union[str, None] = None): |
|||
return {"item_id": item_id, "q": q} |
|||
``` |
|||
|
|||
**āĻā§āĻāĻž**: |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ āĻ¨āĻž āĻāĻžāĻ¨ā§āĻ¨, _"āĻ¤āĻžāĻĄāĻŧāĻžāĻšā§āĻĄāĻŧā§?"_ āĻŦāĻŋāĻāĻžāĻāĻāĻŋ āĻĻā§āĻā§āĻ¨ <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` āĻāĻŦāĻ `await` āĻ¨āĻĨāĻŋāĻ° āĻŽāĻ§ā§āĻ¯ā§ āĻĻā§āĻā§āĻ¨ </a>. |
|||
|
|||
</details> |
|||
|
|||
### āĻāĻāĻŋ āĻāĻžāĻ˛āĻžāĻ¨ |
|||
|
|||
āĻ¸āĻžāĻ°ā§āĻāĻžāĻ° āĻāĻžāĻ˛ā§ āĻāĻ°ā§āĻ¨: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ uvicorn main:app --reload |
|||
|
|||
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) |
|||
INFO: Started reloader process [28720] |
|||
INFO: Started server process [28722] |
|||
INFO: Waiting for application startup. |
|||
INFO: Application startup complete. |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
<details markdown="1"> |
|||
<summary>āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻ¨āĻž āĻ¸āĻŽā§āĻĒāĻ°ā§āĻā§ <code>uvicorn main:app --reload</code>...</summary> |
|||
|
|||
`uvicorn main:app` āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻ¨āĻžāĻāĻŋ āĻĻā§āĻŦāĻžāĻ°āĻž āĻŦā§āĻāĻžāĻ¯āĻŧ: |
|||
|
|||
- `main`: āĻĢāĻžāĻāĻ˛ `main.py` (āĻĒāĻžāĻāĻĨāĻ¨ "āĻŽāĻĄāĻŋāĻāĻ˛")āĨ¤ |
|||
- `app`: `app = FastAPI()` āĻ˛āĻžāĻāĻ¨ āĻĻāĻŋāĻ¯āĻŧā§ `main.py` āĻāĻ° āĻāĻŋāĻ¤āĻ°ā§ āĻ¤ā§āĻ°āĻŋ āĻāĻ°āĻž āĻ
āĻŦāĻā§āĻā§āĻāĨ¤ |
|||
- `--reload`: āĻā§āĻĄ āĻĒāĻ°āĻŋāĻŦāĻ°ā§āĻ¤āĻ¨ā§āĻ° āĻĒāĻ°ā§ āĻ¸āĻžāĻ°ā§āĻāĻžāĻ° āĻĒā§āĻ¨āĻ°āĻžāĻ¯āĻŧ āĻāĻžāĻ˛ā§ āĻāĻ°ā§āĻ¨āĨ¤ āĻāĻāĻŋ āĻļā§āĻ§ā§āĻŽāĻžāĻ¤ā§āĻ° āĻĄā§āĻā§āĻ˛āĻĒāĻŽā§āĻ¨ā§āĻ āĻāĻ° āĻ¸āĻŽā§ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°ā§āĻ¨āĨ¤ |
|||
|
|||
</details> |
|||
|
|||
### āĻāĻāĻž āĻā§āĻ āĻāĻ°ā§āĻ¨ |
|||
|
|||
āĻāĻĒāĻ¨āĻžāĻ° āĻŦā§āĻ°āĻžāĻāĻāĻžāĻ° āĻā§āĻ˛ā§āĻ¨ <a href="http://127.0.0.1:8000/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1:8000/items/5?q=somequery</a> āĻāĨ¤ |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ JSON āĻ°ā§āĻ¸āĻĒāĻ¨ā§āĻ¸ āĻĻā§āĻāĻ¤ā§ āĻĒāĻžāĻŦā§āĻ¨: |
|||
|
|||
```JSON |
|||
{"item_id": 5, "q": "somequery"} |
|||
``` |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻāĻ¤āĻŋāĻŽāĻ§ā§āĻ¯ā§ āĻāĻāĻāĻŋ API āĻ¤ā§āĻ°āĻŋ āĻāĻ°ā§āĻā§āĻ¨ āĻ¯āĻž: |
|||
|
|||
- `/` āĻāĻŦāĻ `/items/{item_id}` _paths_ āĻ HTTP āĻ
āĻ¨ā§āĻ°ā§āĻ§ āĻā§āĻ°āĻšāĻŖ āĻāĻ°ā§āĨ¤ |
|||
- āĻāĻāĻ¯āĻŧ *path*āĻ `GET` <em>āĻ
āĻĒāĻžāĻ°ā§āĻļāĻ¨</em> āĻ¨ā§āĻ¯āĻŧ ( āĻ¯āĻž HTTP _methods_ āĻ¨āĻžāĻŽā§āĻ āĻĒāĻ°āĻŋāĻāĻŋāĻ¤)āĨ¤ |
|||
- _path_ `/items/{item_id}`-āĻ āĻāĻāĻāĻŋ _path āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°_ `item_id` āĻāĻā§ āĻ¯āĻž āĻāĻŋāĻ¨āĻž `int` āĻšāĻ¤ā§ āĻšāĻŦā§āĨ¤ |
|||
- _path_ `/items/{item_id}`-āĻāĻ° āĻāĻāĻāĻŋ āĻāĻā§āĻāĻŋāĻ `str` _query āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°_ `q` āĻāĻā§āĨ¤ |
|||
|
|||
### āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ |
|||
|
|||
āĻāĻāĻ¨ āĻ¯āĻžāĻ¨ <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>. |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻāĻžāĻŦā§ āĻĒā§āĻ°āĻ¸ā§āĻ¤ā§āĻ¤ āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻĻā§āĻāĻ¤ā§ āĻĒāĻžāĻŦā§āĻ¨ (<a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a> āĻĒā§āĻ°āĻĻāĻ¤ā§āĻ¤): |
|||
|
|||
 |
|||
|
|||
### āĻŦāĻŋāĻāĻ˛ā§āĻĒ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ |
|||
|
|||
āĻāĻŦāĻ āĻāĻāĻ¨ <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a> āĻ āĻ¯āĻžāĻ¨. |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻāĻžāĻŦā§ āĻĒā§āĻ°āĻ¸ā§āĻ¤ā§āĻ¤ āĻŦāĻŋāĻāĻ˛ā§āĻĒ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻĻā§āĻāĻ¤ā§ āĻĒāĻžāĻŦā§āĻ¨ (<a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a> āĻĒā§āĻ°āĻĻāĻ¤ā§āĻ¤): |
|||
|
|||
 |
|||
|
|||
## āĻāĻĻāĻžāĻšāĻ°āĻŖāĻ¸ā§āĻŦāĻ°ā§āĻĒ āĻāĻĒāĻā§āĻ°ā§āĻĄ |
|||
|
|||
āĻāĻāĻ¨ `main.py` āĻĢāĻžāĻāĻ˛āĻāĻŋ āĻĒāĻ°āĻŋāĻŦāĻ°ā§āĻ¤āĻ¨ āĻāĻ°ā§āĻ¨ āĻ¯ā§āĻ¨ āĻāĻāĻŋ `PUT` āĻ°āĻŋāĻā§ā§ā§āĻ¸ā§āĻ āĻĨā§āĻā§ āĻŦāĻĄāĻŋ āĻĒā§āĻ¤ā§ āĻĒāĻžāĻ°ā§āĨ¤ |
|||
|
|||
Python āĻ¸ā§āĻā§āĻ¯āĻžāĻ¨ā§āĻĄāĻžāĻ°ā§āĻĄ āĻ˛āĻžāĻāĻŦā§āĻ°ā§āĻ°āĻŋ, Pydantic āĻāĻ° āĻ¸āĻžāĻšāĻžāĻ¯ā§āĻ¯ā§ āĻŦāĻĄāĻŋ āĻā§āĻˇāĻŖāĻž āĻāĻ°ā§āĻ¨āĨ¤ |
|||
|
|||
```Python hl_lines="4 9-12 25-27" |
|||
from typing import Union |
|||
|
|||
from fastapi import FastAPI |
|||
from pydantic import BaseModel |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
class Item(BaseModel): |
|||
name: str |
|||
price: float |
|||
is_offer: Union[bool, None] = None |
|||
|
|||
|
|||
@app.get("/") |
|||
def read_root(): |
|||
return {"Hello": "World"} |
|||
|
|||
|
|||
@app.get("/items/{item_id}") |
|||
def read_item(item_id: int, q: Union[str, None] = None): |
|||
return {"item_id": item_id, "q": q} |
|||
|
|||
|
|||
@app.put("/items/{item_id}") |
|||
def update_item(item_id: int, item: Item): |
|||
return {"item_name": item.name, "item_id": item_id} |
|||
``` |
|||
|
|||
āĻ¸āĻžāĻ°ā§āĻāĻžāĻ°āĻāĻŋ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧāĻāĻžāĻŦā§ āĻĒā§āĻ¨āĻ°āĻžāĻ¯āĻŧ āĻ˛ā§āĻĄ āĻšāĻāĻ¯āĻŧāĻž āĻāĻāĻŋāĻ¤ (āĻāĻžāĻ°āĻŖ āĻāĻĒāĻ¨āĻŋ āĻāĻĒāĻ°ā§āĻ° `uvicorn` āĻāĻŽāĻžāĻ¨ā§āĻĄā§ `--reload` āĻ¯ā§āĻ āĻāĻ°ā§āĻā§āĻ¨)āĨ¤ |
|||
|
|||
### āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻāĻ¨ā§āĻ¨ā§āĻ¤āĻāĻ°āĻŖ |
|||
|
|||
āĻāĻāĻ¨ <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a> āĻāĻĄāĻĄā§āĻ°ā§āĻ¸ā§ āĻ¯āĻžāĻ¨. |
|||
|
|||
- āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋāĻāĻŋ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧāĻāĻžāĻŦā§ āĻāĻ¨ā§āĻ¨ā§āĻ¤ āĻšāĻ¯ā§ āĻ¯āĻžāĻŦā§, āĻ¨āĻ¤ā§āĻ¨ āĻŦāĻĄāĻŋ āĻ¸āĻš: |
|||
|
|||
 |
|||
|
|||
- "Try it out" āĻŦāĻžāĻāĻ¨ā§ āĻāĻžāĻĒā§āĻ¨, āĻāĻāĻŋ āĻāĻĒāĻ¨āĻžāĻā§ āĻĒā§āĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°āĻā§āĻ˛ā§ āĻĒā§āĻ°āĻŖ āĻāĻ°āĻ¤ā§ āĻāĻŦāĻ API āĻāĻ° āĻ¸āĻžāĻĨā§ āĻ¸āĻ°āĻžāĻ¸āĻ°āĻŋ āĻā§āĻ°āĻŋā§āĻž-āĻāĻ˛āĻžāĻĒ āĻāĻ°āĻ¤ā§ āĻĻāĻŋāĻŦā§: |
|||
|
|||
 |
|||
|
|||
- āĻ¤āĻžāĻ°āĻĒāĻ°ā§ "Execute" āĻŦāĻžāĻāĻ¨ā§ āĻāĻžāĻĒā§āĻ¨, āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ°āĻāĻžāĻ°ā§āĻ° āĻāĻ¨ā§āĻāĻžāĻ°āĻĢā§āĻ¸ āĻāĻĒāĻ¨āĻžāĻ° API āĻāĻ° āĻ¸āĻžāĻĨā§ āĻ¯ā§āĻāĻžāĻ¯ā§āĻ āĻāĻ°āĻŦā§, āĻĒā§āĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻĒāĻžāĻ āĻžāĻŦā§, āĻĢāĻ˛āĻžāĻĢāĻ˛āĻā§āĻ˛āĻŋ āĻĒāĻžāĻŦā§ āĻāĻŦāĻ āĻ¸ā§āĻā§āĻ˛āĻŋ āĻĒāĻ°ā§āĻ°āĻĻāĻžā§ āĻĻā§āĻāĻžāĻŦā§: |
|||
|
|||
 |
|||
|
|||
### āĻŦāĻŋāĻāĻ˛ā§āĻĒ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻāĻĒāĻā§āĻ°ā§āĻĄ |
|||
|
|||
āĻāĻŦāĻ āĻāĻāĻ¨ <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a> āĻ āĻ¯āĻžāĻ¨āĨ¤ |
|||
|
|||
- āĻŦāĻŋāĻāĻ˛ā§āĻĒ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋāĻ¤ā§āĻ āĻ¨āĻ¤ā§āĻ¨ āĻā§ā§ā§āĻ°āĻŋ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻāĻŦāĻ āĻŦāĻĄāĻŋ āĻĒā§āĻ°āĻ¤āĻŋāĻĢāĻ˛āĻŋāĻ¤ āĻšāĻŦā§: |
|||
|
|||
 |
|||
|
|||
### āĻ¸āĻāĻā§āĻˇāĻŋāĻĒā§āĻ¤āĻāĻ°āĻŖ |
|||
|
|||
āĻ¸āĻāĻā§āĻˇā§āĻĒā§, āĻāĻĒāĻ¨āĻŋ **āĻļā§āĻ§ā§ āĻāĻāĻŦāĻžāĻ°** āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°ā§āĻ° āĻ§āĻ°āĻ¨, āĻŦāĻĄāĻŋ āĻāĻ¤ā§āĻ¯āĻžāĻĻāĻŋ āĻĢāĻžāĻāĻļāĻ¨ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻšāĻŋāĻ¸ā§āĻŦā§ āĻā§āĻˇāĻŖāĻž āĻāĻ°ā§āĻ¨āĨ¤ |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻ¸ā§āĻāĻŋ āĻāĻ§ā§āĻ¨āĻŋāĻ āĻĒāĻžāĻāĻĨāĻ¨ā§āĻ° āĻ¸āĻžāĻĨā§ āĻāĻ°ā§āĻ¨āĨ¤ |
|||
|
|||
āĻāĻĒāĻ¨āĻžāĻā§ āĻ¨āĻ¤ā§āĻ¨ āĻāĻ°ā§ āĻ¨āĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āĻ āĻā§āĻ¨ āĻ˛āĻžāĻāĻŦā§āĻ°ā§āĻ°āĻŋāĻ° āĻŦāĻžāĻā§āĻ¯ āĻāĻ āĻ¨, āĻĢāĻžāĻāĻļāĻ¨ āĻŦāĻž āĻā§āĻ˛āĻžāĻ¸ āĻāĻŋāĻā§āĻ āĻļāĻŋāĻāĻ¤ā§ āĻšāĻā§āĻā§ āĻ¨āĻžāĨ¤ |
|||
|
|||
āĻļā§āĻ§ā§āĻ āĻāĻ§ā§āĻ¨āĻŋāĻ **Python 3.6+** |
|||
|
|||
āĻāĻĻāĻžāĻšāĻ°āĻŖāĻ¸ā§āĻŦāĻ°ā§āĻĒ, `int` āĻāĻ° āĻāĻ¨ā§āĻ¯: |
|||
|
|||
```Python |
|||
item_id: int |
|||
``` |
|||
|
|||
āĻ
āĻĨāĻŦāĻž āĻāĻ°āĻ āĻāĻāĻŋāĻ˛ `Item` āĻŽāĻĄā§āĻ˛ā§āĻ° āĻāĻ¨ā§āĻ¯: |
|||
|
|||
```Python |
|||
item: Item |
|||
``` |
|||
|
|||
...āĻāĻŦāĻ āĻ¸ā§āĻ āĻāĻāĻ āĻā§āĻˇāĻŖāĻžāĻ° āĻ¸āĻžāĻĨā§ āĻāĻĒāĻ¨āĻŋ āĻĒāĻžāĻŦā§āĻ¨: |
|||
|
|||
- āĻāĻĄāĻŋāĻāĻ° āĻ¸āĻžāĻšāĻžāĻ¯ā§āĻ¯, āĻ¯ā§āĻŽāĻ¨ |
|||
- āĻ¸āĻŽāĻžāĻĒā§āĻ¤āĻŋāĨ¤ |
|||
- āĻ§āĻ°āĻŖ āĻ¯āĻžāĻāĻžāĻ |
|||
- āĻ¤āĻĨā§āĻ¯ āĻ¯āĻžāĻāĻžāĻāĻāĻ°āĻŖ: |
|||
- āĻĄā§āĻāĻž āĻ
āĻŦā§āĻ§ āĻšāĻ˛ā§ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻāĻŦāĻ āĻĒāĻ°āĻŋāĻˇā§āĻāĻžāĻ° āĻ¤ā§āĻ°ā§āĻāĻŋāĻ° āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻ¨āĻžāĨ¤ |
|||
- āĻāĻŽāĻ¨āĻāĻŋ āĻāĻā§āĻ°āĻāĻžāĻŦā§ āĻ¨ā§āĻ¸ā§āĻ āĻāĻ°āĻž JSON āĻ
āĻŦāĻā§āĻā§āĻā§āĻ° āĻāĻ¨ā§āĻ¯ āĻŦā§āĻ§āĻ¤āĻžāĨ¤ |
|||
- āĻĒā§āĻ°ā§āĻ°āĻŋāĻ¤ āĻ¤āĻĨā§āĻ¯ <abbr title="āĻ¯āĻž āĻĒāĻ°āĻŋāĻāĻŋāĻ¤: serialization, parsing, marshalling">āĻ°ā§āĻĒāĻžāĻ¨ā§āĻ¤āĻ°</abbr>: āĻ¯āĻž āĻ¨ā§āĻāĻā§āĻžāĻ°ā§āĻ āĻĨā§āĻā§ āĻĒāĻžāĻāĻĨāĻ¨ā§āĻ° āĻ¤āĻĨā§āĻ¯ āĻāĻŦāĻ āĻ§āĻ°āĻ¨ā§ āĻāĻ¸ā§, āĻāĻŦāĻ āĻ¸ā§āĻāĻžāĻ¨ āĻĨā§āĻā§ āĻĒā§āĻž: |
|||
|
|||
- JSONāĨ¤ |
|||
- āĻĒāĻžāĻĨ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°āĨ¤ |
|||
- āĻā§ā§ā§āĻ°āĻŋ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°āĨ¤ |
|||
- āĻā§āĻāĻŋāĻ |
|||
- āĻšā§āĻĄāĻžāĻ° |
|||
- āĻĢāĻ°ā§āĻŽ |
|||
- āĻĢāĻžāĻāĻ˛ |
|||
|
|||
- āĻāĻāĻāĻĒā§āĻ āĻĄā§āĻāĻžāĻ° <abbr title="āĻ¯āĻž āĻĒāĻ°āĻŋāĻāĻŋāĻ¤: serialization, parsing, marshalling">āĻ°ā§āĻĒāĻžāĻ¨ā§āĻ¤āĻ°</abbr>: āĻĒāĻžāĻāĻĨāĻ¨ āĻĄā§āĻāĻž āĻāĻŦāĻ āĻāĻžāĻāĻĒ āĻĨā§āĻā§ āĻ¨ā§āĻāĻāĻ¯āĻŧāĻžāĻ°ā§āĻ āĻĄā§āĻāĻžāĻ¤ā§ āĻ°ā§āĻĒāĻžāĻ¨ā§āĻ¤āĻ° āĻāĻ°āĻž (JSON āĻšāĻŋāĻ¸āĻžāĻŦā§): |
|||
-āĻĒāĻžāĻāĻĨāĻ¨ āĻāĻžāĻāĻĒā§ āĻ°ā§āĻĒāĻžāĻ¨ā§āĻ¤āĻ° āĻāĻ°ā§āĻ¨ (`str`, `int`, `float`, `bool`, `list`, āĻāĻ¤ā§āĻ¯āĻžāĻĻāĻŋ)āĨ¤ |
|||
- `datetime` āĻ
āĻŦāĻā§āĻā§āĻāĨ¤ |
|||
- `UUID` objeāĻ
āĻŦāĻā§āĻā§āĻctsāĨ¤ |
|||
- āĻĄāĻžāĻāĻžāĻŦā§āĻ¸ āĻŽāĻĄā§āĻ˛āĨ¤ |
|||
- ...āĻāĻŦāĻ āĻāĻ°ā§ āĻ
āĻ¨ā§āĻāĨ¤ |
|||
- āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ API āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ, 2āĻāĻŋ āĻŦāĻŋāĻāĻ˛ā§āĻĒ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ°āĻāĻžāĻ°ā§āĻ° āĻāĻ¨ā§āĻāĻžāĻ°āĻĢā§āĻ¸ āĻ¸āĻš: |
|||
- āĻ¸ā§āĻ¯āĻŧāĻžāĻāĻžāĻ° āĻāĻ āĻāĻ (Swagger UI)āĨ¤ |
|||
- āĻ°āĻŋāĻĄāĻ (ReDoc)āĨ¤ |
|||
|
|||
--- |
|||
|
|||
āĻĒā§āĻ°ā§āĻŦāĻŦāĻ°ā§āĻ¤ā§ āĻā§āĻĄ āĻāĻĻāĻžāĻšāĻ°āĻŖā§ āĻĢāĻŋāĻ°ā§ āĻāĻ¸āĻž āĻ¯āĻžāĻ, **FastAPI** āĻ¯āĻž āĻāĻ°āĻŦā§: |
|||
|
|||
- `GET` āĻāĻŦāĻ `PUT` āĻ
āĻ¨ā§āĻ°ā§āĻ§ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻĒāĻĨā§ `item_id` āĻāĻā§ āĻāĻŋāĻ¨āĻž āĻ¤āĻž āĻ¯āĻžāĻāĻžāĻ āĻāĻ°āĻŦā§āĨ¤ |
|||
- `GET` āĻāĻŦāĻ `PUT` āĻ
āĻ¨ā§āĻ°ā§āĻ§ā§āĻ° āĻāĻ¨ā§āĻ¯ `item_id` āĻāĻžāĻāĻĒ `int` āĻāĻ° āĻšāĻ¤ā§ āĻšāĻŦā§ āĻ¤āĻž āĻ¯āĻžāĻāĻžāĻ āĻāĻ°āĻŦā§āĨ¤ |
|||
- āĻ¯āĻĻāĻŋ āĻ¨āĻž āĻšāĻ¯āĻŧ āĻ¤āĻŦā§ āĻā§āĻ˛āĻžāĻ¯āĻŧā§āĻ¨ā§āĻ āĻāĻāĻāĻŋ āĻāĻĒāĻ¯ā§āĻā§āĻ¤, āĻĒāĻ°āĻŋāĻˇā§āĻāĻžāĻ° āĻ¤ā§āĻ°ā§āĻāĻŋ āĻĻā§āĻāĻ¤ā§ āĻĒāĻžāĻŦā§āĻ¨āĨ¤ |
|||
- `GET` āĻ
āĻ¨ā§āĻ°ā§āĻ§ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻāĻāĻāĻŋ āĻāĻā§āĻāĻŋāĻ āĻā§āĻ¯ā§āĻ¯āĻŧā§āĻ°āĻŋ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻ¨āĻžāĻŽāĻ `q` (āĻ¯ā§āĻŽāĻ¨ `http://127.0.0.1:8000/items/foo?q=somequery`) āĻāĻā§ āĻāĻŋ āĻ¤āĻž āĻā§āĻ āĻāĻ°āĻŦā§āĨ¤ |
|||
- āĻ¯ā§āĻšā§āĻ¤ā§ `q` āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ°āĻāĻŋ `= None` āĻĻāĻŋāĻ¯āĻŧā§ āĻā§āĻˇāĻŖāĻž āĻāĻ°āĻž āĻšāĻ¯āĻŧā§āĻā§, āĻ¤āĻžāĻ āĻāĻāĻŋ āĻāĻā§āĻāĻŋāĻāĨ¤ |
|||
- `None` āĻāĻžāĻĄāĻŧāĻž āĻāĻāĻŋ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ā§āĻ¯āĻŧ āĻšāĻ¤ā§ (āĻ¯ā§āĻŽāĻ¨ `PUT` āĻāĻ° āĻā§āĻˇā§āĻ¤ā§āĻ°ā§ āĻšā§ā§āĻā§)āĨ¤ |
|||
- `/items/{item_id}` āĻāĻ° āĻāĻ¨ā§āĻ¯ `PUT` āĻ
āĻ¨ā§āĻ°ā§āĻ§ā§āĻ° āĻŦāĻĄāĻŋ JSON āĻšāĻŋāĻ¸āĻžāĻŦā§ āĻĒāĻĄāĻŧā§āĻ¨: |
|||
- āĻ˛āĻā§āĻˇ āĻāĻ°ā§āĻ¨, `name` āĻāĻāĻāĻŋ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ā§āĻ¯āĻŧ āĻ
ā§āĻ¯āĻžāĻā§āĻ°āĻŋāĻŦāĻŋāĻāĻ āĻšāĻŋāĻ¸āĻžāĻŦā§ āĻŦāĻŋāĻŦā§āĻāĻ¨āĻž āĻāĻ°ā§āĻā§ āĻāĻŦāĻ āĻāĻāĻŋ `str` āĻšāĻ¤ā§ āĻšāĻŦā§āĨ¤ |
|||
- āĻ˛āĻā§āĻˇ āĻāĻ°ā§āĻ¨ āĻāĻāĻžāĻ¨ā§, `price` āĻ
ā§āĻ¯āĻžāĻā§āĻ°āĻŋāĻŦāĻŋāĻāĻāĻāĻŋ āĻāĻŦāĻļā§āĻ¯āĻ āĻāĻŦāĻ āĻāĻāĻŋ `float` āĻšāĻ¤ā§ āĻšāĻŦā§āĨ¤ |
|||
- āĻ˛āĻā§āĻˇ āĻāĻ°ā§āĻ¨ `is_offer` āĻāĻāĻāĻŋ āĻāĻā§āĻāĻŋāĻ āĻ
ā§āĻ¯āĻžāĻā§āĻ°āĻŋāĻŦāĻŋāĻāĻ āĻāĻŦāĻ āĻāĻāĻŋ `bool` āĻšāĻ¤ā§ āĻšāĻŦā§ āĻ¯āĻĻāĻŋ āĻāĻĒāĻ¸ā§āĻĨāĻŋāĻ¤ āĻĨāĻžāĻā§āĨ¤ |
|||
- āĻāĻ āĻ¸āĻŦāĻāĻŋ āĻāĻā§āĻ°āĻāĻžāĻŦā§ āĻ
āĻŦāĻ¸ā§āĻĨāĻžāĻ¨āĻ°āĻ¤ JSON āĻ
āĻŦāĻā§āĻā§āĻāĻā§āĻ˛āĻŋāĻ¤ā§āĻ āĻāĻžāĻ āĻāĻ°āĻŦā§āĨ¤ |
|||
- āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧāĻāĻžāĻŦā§ JSON āĻšāĻ¤ā§ āĻāĻŦāĻ JSON āĻĨā§āĻā§ āĻāĻ¨āĻāĻžāĻ°ā§āĻ āĻāĻ°ā§āĻ¨āĨ¤ |
|||
- OpenAPI āĻĻāĻŋāĻ¯āĻŧā§ āĻ¸āĻŦāĻāĻŋāĻā§ āĻĄāĻā§āĻŽā§āĻ¨ā§āĻ āĻāĻ°ā§āĻ¨, āĻ¯āĻž āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻ¯ā§āĻ¤ā§ āĻĒāĻžāĻ°ā§: |
|||
- āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋāĨ¤ |
|||
- āĻ
āĻ¨ā§āĻ āĻāĻžāĻˇāĻžāĻ° āĻāĻ¨ā§āĻ¯ āĻ¸ā§āĻŦāĻ¯āĻŧāĻāĻā§āĻ°āĻŋāĻ¯āĻŧ āĻā§āĻ˛āĻžāĻ¯āĻŧā§āĻ¨ā§āĻ āĻā§āĻĄ āĻ¤ā§āĻ°āĻŋāĻ° āĻŦā§āĻ¯āĻŦāĻ¸ā§āĻĨāĻžāĨ¤ |
|||
- āĻ¸āĻ°āĻžāĻ¸āĻ°āĻŋ 2āĻāĻŋ āĻā§āĻ°āĻŋā§āĻžāĻļā§āĻ˛ āĻ¨āĻŋāĻ°ā§āĻĻā§āĻļāĻŋāĻāĻž āĻ¨āĻĨāĻŋ āĻāĻ¯āĻŧā§āĻŦ āĻĒā§āĻˇā§āĻ āĻĒā§āĻ°āĻĻāĻžāĻ¨ āĻāĻ°āĻž āĻšā§ā§āĻā§āĨ¤ |
|||
|
|||
--- |
|||
|
|||
āĻāĻŽāĻ°āĻž āĻāĻ¤āĻā§āĻˇāĻ¨ āĻļā§āĻ§ā§ āĻāĻ° āĻĒā§āĻˇā§āĻ āĻ¤ā§āĻ°āĻŋ āĻāĻ°ā§āĻāĻŋ, āĻāĻŋāĻ¨ā§āĻ¤ā§ āĻāĻĒāĻ¨āĻŋ āĻāĻ¤āĻŽāĻ§ā§āĻ¯ā§āĻ āĻāĻāĻŋ āĻāĻŋāĻāĻžāĻŦā§ āĻāĻžāĻ āĻāĻ°ā§ āĻ¤āĻžāĻ° āĻ§āĻžāĻ°āĻŖāĻžāĻ āĻĒā§ā§ā§ āĻāĻŋā§ā§āĻā§āĻ¨āĨ¤ |
|||
|
|||
āĻ¨āĻŋāĻŽā§āĻ¨ā§āĻā§āĻ¤ āĻ˛āĻžāĻāĻ¨ āĻā§āĻ˛ā§ āĻĒāĻ°āĻŋāĻŦāĻ°ā§āĻ¤āĻ¨ āĻāĻ°āĻžāĻ° āĻā§āĻˇā§āĻāĻž āĻāĻ°ā§āĻ¨: |
|||
|
|||
```Python |
|||
return {"item_name": item.name, "item_id": item_id} |
|||
``` |
|||
|
|||
...āĻĒā§āĻ°ā§āĻŦā§: |
|||
|
|||
```Python |
|||
... "item_name": item.name ... |
|||
``` |
|||
|
|||
...āĻĒāĻ°āĻŦāĻ°ā§āĻ¤ā§āĻ¤ā§: |
|||
|
|||
```Python |
|||
... "item_price": item.price ... |
|||
``` |
|||
|
|||
...āĻāĻŦāĻ āĻĻā§āĻā§āĻ¨ āĻāĻŋāĻāĻžāĻŦā§ āĻāĻĒāĻ¨āĻžāĻ° āĻāĻĄāĻŋāĻāĻ° āĻāĻĒāĻžāĻĻāĻžāĻ¨āĻā§āĻ˛ā§āĻā§ āĻ¸ā§āĻāĻā§āĻ°āĻŋā§āĻāĻžāĻŦā§-āĻ¸āĻŽā§āĻĒāĻ¨ā§āĻ¨ āĻāĻ°āĻŦā§ āĻāĻŦāĻ āĻ¤āĻžāĻĻā§āĻ° āĻ§āĻ°āĻ¨ āĻāĻžāĻ¨āĻ¤ā§ āĻĒāĻžāĻ°āĻŦā§: |
|||
|
|||
 |
|||
|
|||
āĻāĻ°āĻ āĻŦā§āĻļāĻŋāĻˇā§āĻā§āĻ¯ āĻ¸āĻŽā§āĻĒāĻ¨ā§āĻ¨ āĻāĻĻāĻžāĻšāĻ°āĻŖā§āĻ° āĻāĻ¨ā§āĻ¯, āĻĻā§āĻā§āĻ¨ <a href="https://fastapi.tiangolo.com/tutorial/">āĻāĻŋāĻāĻā§āĻ°āĻŋā§āĻžāĻ˛ - āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ°āĻāĻžāĻ°ā§āĻ° āĻāĻžāĻāĻĄ</a>. |
|||
|
|||
**āĻ¸ā§āĻĒā§āĻ˛āĻžāĻ° āĻ¸āĻ¤āĻ°ā§āĻāĻ¤āĻž**: āĻāĻŋāĻāĻā§āĻ°āĻŋā§āĻžāĻ˛ - āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ°āĻāĻžāĻ°ā§āĻ° āĻāĻžāĻāĻĄ āĻ¨āĻŋāĻŽā§āĻ¨ā§āĻā§āĻ¤ āĻŦāĻŋāĻˇā§āĻā§āĻ˛āĻŋ āĻ
āĻ¨ā§āĻ¤āĻ°ā§āĻā§āĻā§āĻ¤ āĻāĻ°ā§: |
|||
|
|||
- **āĻšā§āĻĄāĻžāĻ°**, **āĻā§āĻāĻŋāĻ**, **āĻĢāĻ°ā§āĻŽ āĻĢāĻŋāĻ˛ā§āĻĄ** āĻāĻŦāĻ **āĻĢāĻžāĻāĻ˛āĻā§āĻ˛āĻŋ** āĻāĻŽāĻ¨ āĻ
āĻ¨ā§āĻ¯āĻžāĻ¨ā§āĻ¯ āĻāĻžā§āĻāĻž āĻĨā§āĻā§ āĻĒā§āĻ¯āĻžāĻ°āĻžāĻŽāĻŋāĻāĻžāĻ° āĻā§āĻˇāĻŖāĻž āĻāĻ°āĻžāĨ¤ |
|||
- `maximum_length` āĻŦāĻž `regex` āĻāĻ° āĻŽāĻ¤ā§ **āĻ¯āĻžāĻāĻžāĻāĻāĻ°āĻŖ āĻŦāĻžāĻ§āĻžāĻŽā§āĻā§āĻ¤āĻŋ** āĻ¸ā§āĻ āĻāĻ°āĻž āĻšāĻ¯āĻŧ āĻāĻŋāĻāĻžāĻŦā§, āĻ¤āĻž āĻ¨āĻŋā§ā§ āĻāĻ˛ā§āĻāĻ¨āĻž āĻāĻ°āĻž āĻšāĻŦā§āĨ¤ |
|||
- āĻāĻāĻāĻŋ āĻā§āĻŦ āĻļāĻā§āĻ¤āĻŋāĻļāĻžāĻ˛ā§ āĻāĻŦāĻ āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻž āĻ¸āĻšāĻ <abbr title="also known as components, resources, providers, services, injectables">āĻĄāĻŋāĻĒā§āĻ¨ā§āĻĄā§āĻ¨ā§āĻ¸āĻŋ āĻāĻ¨āĻā§āĻāĻļāĻ¨</abbr> āĻĒāĻĻā§āĻ§āĻ¤āĻŋ |
|||
- **OAuth2** āĻāĻŦāĻ **JWT āĻā§āĻā§āĻ¨** āĻāĻŦāĻ **HTTP Basic** auth āĻ¸āĻš āĻ¨āĻŋāĻ°āĻžāĻĒāĻ¤ā§āĻ¤āĻž āĻāĻŦāĻ āĻ
āĻ¨ā§āĻŽā§āĻĻāĻ¨āĻĒā§āĻ°āĻžāĻĒā§āĻ¤āĻŋ āĻ¸āĻŽā§āĻĒāĻ°ā§āĻāĻŋāĻ¤ āĻŦāĻŋāĻˇā§āĻ¸āĻŽā§āĻšā§āĻ° āĻāĻĒāĻ°āĨ¤ |
|||
- **āĻāĻā§āĻ°āĻāĻžāĻŦā§ āĻ
āĻŦāĻ¸ā§āĻĨāĻžāĻ¨āĻ°āĻ¤ JSON āĻŽāĻĄā§āĻ˛** āĻā§āĻˇāĻŖāĻž āĻāĻ°āĻžāĻ° āĻāĻ¨ā§āĻ¯ āĻāĻ°āĻ āĻāĻ¨ā§āĻ¨āĻ¤ (āĻāĻŋāĻ¨ā§āĻ¤ā§ āĻ¸āĻŽāĻžāĻ¨ āĻ¸āĻšāĻ) āĻā§āĻļāĻ˛ (Pydantic āĻā§ āĻ§āĻ¨ā§āĻ¯āĻŦāĻžāĻĻ)āĨ¤ |
|||
- āĻāĻ°ā§ āĻ
āĻ¤āĻŋāĻ°āĻŋāĻā§āĻ¤ āĻŦā§āĻļāĻŋāĻˇā§āĻā§āĻ¯ (āĻ¸ā§āĻāĻžāĻ°āĻ˛ā§āĻāĻā§ āĻ§āĻ¨ā§āĻ¯āĻŦāĻžāĻĻ) āĻšāĻŋāĻ¸āĻžāĻŦā§: |
|||
- **WebSockets** |
|||
- **GraphQL** |
|||
- HTTPX āĻāĻŦāĻ `pytest` āĻāĻŋāĻ¤ā§āĻ¤āĻŋāĻ āĻ
āĻ¤ā§āĻ¯āĻ¨ā§āĻ¤ āĻ¸āĻšāĻ āĻĒāĻ°ā§āĻā§āĻˇāĻž |
|||
- **CORS** |
|||
- **Cookie Sessions** |
|||
- ...āĻāĻŦāĻ āĻāĻ°ā§āĨ¤ |
|||
|
|||
## āĻāĻ°ā§āĻŽāĻā§āĻˇāĻŽāĻ¤āĻž |
|||
|
|||
āĻ¸ā§āĻŦāĻžāĻ§ā§āĻ¨ TechEmpower Benchmarks āĻĻā§āĻāĻžāĻ¯āĻŧ āĻ¯ā§ **FastAPI** āĻ
ā§āĻ¯āĻžāĻĒā§āĻ˛āĻŋāĻā§āĻļāĻ¨āĻā§āĻ˛āĻŋ Uvicorn-āĻāĻ° āĻ
āĻ§ā§āĻ¨ā§ āĻāĻ˛āĻŽāĻžāĻ¨ āĻĻā§āĻ°ā§āĻ¤āĻ¤āĻŽ<a href="https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=query&l=zijzen-7" class="external-link" target="_blank">āĻĒāĻžāĻāĻĨāĻ¨ āĻĢā§āĻ°ā§āĻŽāĻāĻ¯āĻŧāĻžāĻ°ā§āĻāĻā§āĻ˛āĻŋāĻ° āĻŽāĻ§ā§āĻ¯ā§ āĻāĻāĻāĻŋ,</a> āĻļā§āĻ§ā§āĻŽāĻžāĻ¤ā§āĻ° Starlette āĻāĻŦāĻ Uvicorn-āĻāĻ° āĻĒāĻ° (FastAPI āĻĻā§āĻŦāĻžāĻ°āĻž āĻ
āĻā§āĻ¯āĻ¨ā§āĻ¤āĻ°ā§āĻŖāĻāĻžāĻŦā§ āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤)āĨ¤ (\*) |
|||
|
|||
āĻāĻāĻŋ āĻ¸āĻŽā§āĻĒāĻ°ā§āĻā§ āĻāĻ°āĻ āĻŦā§āĻāĻ¤ā§, āĻĻā§āĻā§āĻ¨ <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>. |
|||
|
|||
## āĻāĻā§āĻāĻŋāĻ āĻ¨āĻŋāĻ°ā§āĻāĻ°āĻļā§āĻ˛āĻ¤āĻž |
|||
|
|||
Pydantic āĻĻā§āĻŦāĻžāĻ°āĻž āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤: |
|||
|
|||
- <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - āĻĻā§āĻ°ā§āĻ¤ JSON āĻāĻ° āĻāĻ¨ā§āĻ¯ <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>. |
|||
- <a href="https://github.com/JoshData/python-email-validator" target="_blank"><code>email_validator</code></a> - āĻāĻŽā§āĻ˛ āĻ¯āĻžāĻāĻžāĻāĻāĻ°āĻŖā§āĻ° āĻāĻ¨ā§āĻ¯āĨ¤ |
|||
|
|||
āĻ¸ā§āĻāĻžāĻ°āĻ˛ā§āĻ āĻĻā§āĻŦāĻžāĻ°āĻž āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤: |
|||
|
|||
- <a href="https://www.python-httpx.org" target="_blank"><code>httpx</code></a> - āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ `TestClient` āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻ¤ā§ āĻāĻžāĻ¨ āĻ¤āĻžāĻšāĻ˛ā§ āĻāĻŦāĻļā§āĻ¯āĻāĨ¤ |
|||
- <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ āĻĒā§āĻ°āĻĻāĻ¤ā§āĻ¤ āĻā§āĻŽāĻĒā§āĻ˛ā§āĻ āĻ°ā§āĻĒāĻ°ā§āĻāĻž āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻ¤ā§ āĻāĻžāĻ¨ āĻ¤āĻžāĻšāĻ˛ā§ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨āĨ¤ |
|||
- <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - āĻāĻĒāĻ¨āĻŋ āĻ¯āĻĻāĻŋ āĻĢāĻ°ā§āĻŽ āĻ¸āĻšāĻžāĻ¯āĻŧāĻ¤āĻž āĻāĻ°āĻ¤ā§ āĻāĻžāĻ¨ āĻ¤āĻžāĻšāĻ˛ā§ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, `request.form()` āĻ¸āĻšāĨ¤ |
|||
- <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - `SessionMiddleware` āĻ¸āĻšāĻžāĻ¯āĻŧāĻ¤āĻžāĻ° āĻāĻ¨ā§āĻ¯ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨āĨ¤ |
|||
- <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - āĻ¸ā§āĻāĻžāĻ°āĻ˛ā§āĻā§āĻ° SchemaGenerator āĻ¸āĻžāĻĒā§āĻ°ā§āĻ āĻāĻ° āĻāĻ¨ā§āĻ¯ āĻĒā§āĻ°ā§ā§āĻāĻ¨ (āĻāĻĒāĻ¨āĻžāĻ° āĻ¸āĻŽā§āĻāĻžāĻŦāĻ¤ FastAPI āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨ āĻ¨ā§āĻ)āĨ¤ |
|||
- <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - `GraphQLApp` āĻ¸āĻšāĻžāĻ¯āĻŧāĻ¤āĻžāĻ° āĻāĻ¨ā§āĻ¯ āĻĒā§āĻ°ā§ā§āĻāĻ¨āĨ¤ |
|||
- <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - āĻāĻĒāĻ¨āĻŋ `UJSONResponse` āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻ¤ā§ āĻāĻžāĻāĻ˛ā§ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨āĨ¤ |
|||
|
|||
FastAPI / Starlette āĻĻā§āĻŦāĻžāĻ°āĻž āĻŦā§āĻ¯āĻŦāĻšā§āĻ¤: |
|||
|
|||
- <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - āĻ¸āĻžāĻ°ā§āĻāĻžāĻ°ā§āĻ° āĻāĻ¨ā§āĻ¯ āĻ¯āĻž āĻāĻĒāĻ¨āĻžāĻ° āĻ
ā§āĻ¯āĻžāĻĒā§āĻ˛āĻŋāĻā§āĻļāĻ¨ āĻ˛ā§āĻĄ āĻāĻ°ā§ āĻāĻŦāĻ āĻĒāĻ°āĻŋāĻŦā§āĻļāĻ¨ āĻāĻ°ā§āĨ¤ |
|||
- <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - āĻāĻĒāĻ¨āĻŋ `ORJSONResponse` āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻāĻ°āĻ¤ā§ āĻāĻžāĻāĻ˛ā§ āĻĒā§āĻ°āĻ¯āĻŧā§āĻāĻ¨āĨ¤ |
|||
|
|||
āĻāĻĒāĻ¨āĻŋ āĻāĻ āĻ¸āĻŦ āĻāĻ¨āĻ¸ā§āĻāĻ˛ āĻāĻ°āĻ¤ā§ āĻĒāĻžāĻ°ā§āĻ¨ `pip install fastapi[all]` āĻĻāĻŋā§ā§. |
|||
|
|||
## āĻ˛āĻžāĻāĻ¸ā§āĻ¨ā§āĻ¸ |
|||
|
|||
āĻāĻ āĻĒā§āĻ°āĻā§āĻā§āĻ MIT āĻ˛āĻžāĻāĻ¸ā§āĻ¨ā§āĻ¸ āĻ¨ā§āĻ¤āĻŋāĻŽāĻžāĻ˛āĻžāĻ° āĻ
āĻ§ā§āĻ¨ā§ āĻļāĻ°ā§āĻ¤āĻžā§āĻŋāĻ¤āĨ¤ |
@ -0,0 +1 @@ |
|||
INHERIT: ../en/mkdocs.yml |
LoadingâĻ
Reference in new issue