From fd2080aece9ce46a63fc144b13215e97a099846e Mon Sep 17 00:00:00 2001
From: impocode <109408819+impocode@users.noreply.github.com>
Date: Fri, 26 Aug 2022 19:45:24 +0500
Subject: [PATCH] =?utf8?q?=F0=9F=8C=90=20Add=20Russian=20translation=20for?=
=?utf8?q?=20`docs/ru/docs/index.md`=20(#5289)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
README.md | 1 -
docs/en/docs/index.md | 1 -
docs/ru/docs/index.md | 329 +++++++++++++++++++++---------------------
3 files changed, 163 insertions(+), 168 deletions(-)
diff --git a/README.md b/README.md
index 326ad22795..390fc3033e 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,6 @@ FastAPI is a modern, fast (high-performance), web framework for building APIs wi
The key features are:
* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
-
* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
* **Intuitive**: Great editor support. Completion everywhere. Less time debugging.
diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md
index 17163ba014..24ce14e235 100644
--- a/docs/en/docs/index.md
+++ b/docs/en/docs/index.md
@@ -32,7 +32,6 @@ FastAPI is a modern, fast (high-performance), web framework for building APIs wi
The key features are:
* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
-
* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
* **Intuitive**: Great editor support. Completion everywhere. Less time debugging.
diff --git a/docs/ru/docs/index.md b/docs/ru/docs/index.md
index 932bb21390..448e2c7079 100644
--- a/docs/ru/docs/index.md
+++ b/docs/ru/docs/index.md
@@ -1,50 +1,48 @@
-
-{!../../../docs/missing-translation.md!}
-
-
- FastAPI framework, high performance, easy to learn, fast to code, ready for production
+ ÐоÑовÑй к внедÑÐµÐ½Ð¸Ñ Ð²ÑÑокопÑоизводиÑелÑнÑй ÑÑеймвоÑк, пÑоÑÑой в изÑÑении и ÑазÑабоÑке.
-
-
+
+
-
+
-
+
+
+
+
---
-**Documentation**: https://fastapi.tiangolo.com
+**ÐокÑменÑаÑиÑ**: https://fastapi.tiangolo.com
-**Source Code**: https://github.com/tiangolo/fastapi
+**ÐÑÑ
однÑй код**: https://github.com/tiangolo/fastapi
---
-FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
-
-The key features are:
+FastAPI â ÑÑо ÑовÑеменнÑй, бÑÑÑÑÑй (вÑÑокопÑоизводиÑелÑнÑй) веб-ÑÑеймвоÑк Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ API иÑполÑзÑÑ Python 3.6+, в оÑнове коÑоÑого Ð»ÐµÐ¶Ð¸Ñ ÑÑандаÑÑÐ½Ð°Ñ Ð°Ð½Ð½Ð¾ÑаÑÐ¸Ñ Ñипов Python.
-* **Fast**: Very high performance, on par with **NodeJS** and **Go** (thanks to Starlette and Pydantic). [One of the fastest Python frameworks available](#performance).
+ÐлÑÑевÑе оÑобенноÑÑи:
-* **Fast to code**: Increase the speed to develop features by about 200% to 300%. *
-* **Fewer bugs**: Reduce about 40% of human (developer) induced errors. *
-* **Intuitive**: Great editor support. Completion everywhere. Less time debugging.
-* **Easy**: Designed to be easy to use and learn. Less time reading docs.
-* **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs.
-* **Robust**: Get production-ready code. With automatic interactive documentation.
-* **Standards-based**: Based on (and fully compatible with) the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
+* **СкоÑоÑÑÑ**: ÐÑÐµÐ½Ñ Ð²ÑÑÐ¾ÐºÐ°Ñ Ð¿ÑоизводиÑелÑноÑÑÑ, на ÑÑовне **NodeJS** и **Go** (благодаÑÑ Starlette и Pydantic). [Ðдин из ÑамÑÑ
бÑÑÑÑÑÑ
ÑÑеймвоÑков Python](#_10).
+* **ÐÑÑÑÑоÑа ÑазÑабоÑки**: УвелиÑÑÑе ÑкоÑоÑÑÑ ÑазÑабоÑки пÑимеÑно на 200â300%. *
+* **ÐенÑÑе оÑибок**: СокÑаÑиÑе пÑимеÑно на 40% колиÑеÑÑво оÑибок, вÑзваннÑÑ
Ñеловеком (ÑазÑабоÑÑиком). *
+* **ÐнÑÑиÑивно понÑÑнÑй**: ÐÑлиÑÐ½Ð°Ñ Ð¿Ð¾Ð´Ð´ÐµÑжка ÑедакÑоÑа. ÐвÑозавеÑÑение везде. ÐенÑÑе вÑемени на оÑладкÑ.
+* **ÐÑгкоÑÑÑ**: РазÑабоÑан Ñак, ÑÑÐ¾Ð±Ñ ÐµÐ³Ð¾ бÑло легко иÑполÑзоваÑÑ Ð¸ оÑваиваÑÑ. ÐенÑÑе вÑемени на ÑÑение докÑменÑаÑии.
+* **ÐÑаÑкоÑÑÑ**: СведиÑе к минимÑÐ¼Ñ Ð´ÑблиÑование кода. ÐаждÑй обÑÑвленнÑй паÑамеÑÑ - опÑеделÑÐµÑ Ð½ÐµÑколÑко ÑÑнкÑий. ÐенÑÑе оÑибок.
+* **ÐадежноÑÑÑ**: ÐолÑÑиÑе гоÑовÑй к ÑабоÑе код. С авÑомаÑиÑеÑкой инÑеÑакÑивной докÑменÑаÑией.
+* **Ðа оÑнове ÑÑандаÑÑов**: ÐÑнован на оÑкÑÑÑÑÑ
ÑÑандаÑÑаÑ
API и полноÑÑÑÑ ÑовмеÑÑим Ñ Ð½Ð¸Ð¼Ð¸: OpenAPI (Ñанее извеÑÑном как Swagger) и JSON Schema.
-* estimation based on tests on an internal development team, building production applications.
+* оÑенка на оÑнове ÑеÑÑов внÑÑÑенней ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ ÑазÑабоÑÑиков, ÑоздаÑÑиÑ
пÑоизводÑÑвеннÑе пÑиложениÑ.
-## Sponsors
+## СпонÑоÑÑ
@@ -59,66 +57,66 @@ The key features are:
-Other sponsors
+ÐÑÑгие ÑпонÑоÑÑ
-## Opinions
+## ÐÑзÑвÑ
-"_[...] 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._"
+"_РпоÑледнее вÑÐµÐ¼Ñ Ñ Ð¼Ð½Ð¾Ð³Ð¾ где иÑполÑзÑÑ **FastAPI**. [...] Ðа Ñамом деле Ñ Ð¿Ð»Ð°Ð½Ð¸ÑÑÑ Ð¸ÑполÑзоваÑÑ ÐµÐ³Ð¾ Ð´Ð»Ñ Ð²ÑеÑ
**ÑеÑвиÑов маÑинного обÑÑÐµÐ½Ð¸Ñ Ð¼Ð¾ÐµÐ¹ ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ Ð² Microsoft**. ÐекоÑоÑÑе из ниÑ
инÑегÑиÑÑÑÑÑÑ Ð² оÑновной пÑодÑÐºÑ **Windows**, а некоÑоÑÑе â в пÑодÑкÑÑ **Office**._"
Kabir Khan -
Microsoft (ref)
---
-"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
+"_ÐÑ Ð¸ÑполÑзовали библиоÑÐµÐºÑ **FastAPI** Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑеÑвеÑа **REST**, к коÑоÑÐ¾Ð¼Ñ Ð¼Ð¾Ð¶Ð½Ð¾ делаÑÑ Ð·Ð°Ð¿ÑоÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ **пÑогнозов**. [Ð´Ð»Ñ Ludwig]_"
Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala -
Uber (ref)
---
-"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
+"_**Netflix** Ñада обÑÑвиÑÑ Ð¾ вÑпÑÑке опенÑоÑÑного ÑÑеймвоÑка Ð´Ð»Ñ Ð¾ÑкеÑÑÑовки **анÑикÑизиÑного ÑпÑавлениÑ**: **Dispatch**! [Ñоздана Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ **FastAPI**]_"
Kevin Glisson, Marc Vilanova, Forest Monsen -
Netflix (ref)
---
-"_Iâm over the moon excited about **FastAPI**. Itâs so fun!_"
+"_Я в полном воÑÑоÑге Ð¾Ñ **FastAPI**. ÐÑо Ñак веÑело!_"
---
-"_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._"
+"_ЧеÑÑно говоÑÑ, Ñо, ÑÑо Ð²Ñ Ñоздали, вÑглÑÐ´Ð¸Ñ Ð¾ÑÐµÐ½Ñ Ñолидно и оÑполиÑовано. Ðо многиÑ
ÑмÑÑлаÑ
Ñ Ñ
оÑел, ÑÑÐ¾Ð±Ñ **Hug** бÑл именно Ñаким â ÑÑо дейÑÑвиÑелÑно вдоÑ
новлÑеÑ, когда кÑо-Ñо ÑоздаÑÑ Ñакое._"
---
-"_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 [...]_"
+"_ÐÑли Ð²Ñ Ñ
оÑиÑе изÑÑиÑÑ ÐºÐ°ÐºÐ¾Ð¹-нибÑÐ´Ñ **ÑовÑеменнÑй ÑÑеймвоÑк** Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ REST API, ознакомÑÑеÑÑ Ñ **FastAPI** [...] Ðн бÑÑÑÑÑй, лÑгкий и пÑоÑÑой в изÑÑении [...]_"
-"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
+"_ÐÑ Ð¿ÐµÑеÑли на **FastAPI** Ð´Ð»Ñ Ð½Ð°ÑиÑ
**API** [...] Я дÑмаÑ, вам Ñоже понÑавиÑÑÑ [...]_"
---
-## **Typer**, the FastAPI of CLIs
+## **Typer**, инÑеÑÑÐµÐ¹Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð½Ð¾Ð¹ ÑÑÑоки Ð´Ð»Ñ FastAPI
-If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**.
+ÐÑли Ð²Ñ ÑоздаеÑе пÑиложение CLI Ð´Ð»Ñ Ð¸ÑполÑÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð² ÑеÑминале вмеÑÑо веб-API, ознакомÑÑеÑÑ Ñ **Typer**.
-**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. â¨ï¸ ð
+**Typer** â младÑий бÑÐ°Ñ FastAPI. Рон пÑедназнаÑен Ð´Ð»Ñ Ð¸ÑполÑÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð² каÑеÑÑве **инÑеÑÑейÑа командной ÑÑÑоки Ð´Ð»Ñ FastAPI**. â¨ï¸ ð
-## Requirements
+## ÐавиÑимоÑÑи
Python 3.6+
-FastAPI stands on the shoulders of giants:
+FastAPI ÑÑÐ¾Ð¸Ñ Ð½Ð° плеÑаÑ
гиганÑов:
-* Starlette for the web parts.
-* Pydantic for the data parts.
+* Starlette Ð´Ð»Ñ ÑаÑÑи ÑвÑзанной Ñ Ð²ÐµÐ±Ð¾Ð¼.
+* Pydantic Ð´Ð»Ñ ÑаÑÑи ÑвÑзанной Ñ Ð´Ð°Ð½Ð½Ñми.
-## Installation
+## УÑÑановка
@@ -130,7 +128,7 @@ $ pip install fastapi
-You will also need an ASGI server, for production such as Uvicorn or Hypercorn.
+Ðам Ñакже понадобиÑÑÑ ÑеÑÐ²ÐµÑ ASGI Ð´Ð»Ñ Ð¿ÑоизводÑÑва, Ñакой как Uvicorn или Hypercorn.
@@ -142,11 +140,11 @@ $ pip install "uvicorn[standard]"
-## Example
+## ÐÑимеÑ
-### Create it
+### Создание
-* Create a file `main.py` with:
+* СоздайÑе Ñайл `main.py` Ñо ÑледÑÑÑим ÑодеÑжимÑм:
```Python
from typing import Union
@@ -167,9 +165,9 @@ def read_item(item_id: int, q: Union[str, None] = None):
```
-Or use async def
...
+Ðли иÑполÑзÑйÑе async def
...
-If your code uses `async` / `await`, use `async def`:
+ÐÑли Ð²Ð°Ñ ÐºÐ¾Ð´ иÑполÑзÑÐµÑ `async` / `await`, иÑполÑзÑйÑе `async def`:
```Python hl_lines="9 14"
from typing import Union
@@ -189,15 +187,15 @@ async def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
```
-**Note**:
+**ÐÑимеÑание**:
-If you don't know, check the _"In a hurry?"_ section about `async` and `await` in the docs.
+ÐÑли Ð²Ñ Ð½Ðµ знаеÑе, пÑовеÑÑÑе Ñаздел _"ТоÑопиÑеÑÑ?"_ в докÑменÑаÑии об `async` и `await`.
-### Run it
+### ÐапÑÑк
-Run the server with:
+ÐапÑÑÑиÑе ÑеÑÐ²ÐµÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ:
@@ -214,54 +212,54 @@ INFO: Application startup complete.
-About the command uvicorn main:app --reload
...
+Ркоманде uvicorn main:app --reload
...
-The command `uvicorn main:app` refers to:
+Ðоманда `uvicorn main:app` оÑноÑиÑÑÑ Ðº:
-* `main`: the file `main.py` (the Python "module").
-* `app`: the object created inside of `main.py` with the line `app = FastAPI()`.
-* `--reload`: make the server restart after code changes. Only do this for development.
+* `main`: Ñайл `main.py` (модÑÐ»Ñ Python).
+* `app`: обÑекÑ, ÑозданнÑй внÑÑÑи `main.py` Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ ÑÑÑоки `app = FastAPI()`.
+* `--reload`: пеÑезапÑÑк ÑеÑвеÑа поÑле Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÐºÐ¾Ð´Ð°. ÐелайÑе ÑÑо ÑолÑко во вÑÐµÐ¼Ñ ÑазÑабоÑки.
-### Check it
+### ÐÑовеÑка
-Open your browser at http://127.0.0.1:8000/items/5?q=somequery.
+ÐÑкÑойÑе бÑаÑÐ·ÐµÑ Ð½Ð° http://127.0.0.1:8000/items/5?q=somequery.
-You will see the JSON response as:
+ÐÑ ÑвидиÑе ÑледÑÑÑий JSON оÑвеÑ:
```JSON
{"item_id": 5, "q": "somequery"}
```
-You already created an API that:
+ÐÑ Ñже Ñоздали API, коÑоÑÑй:
-* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
-* Both _paths_ take `GET` operations (also known as HTTP _methods_).
-* The _path_ `/items/{item_id}` has a _path parameter_ `item_id` that should be an `int`.
-* The _path_ `/items/{item_id}` has an optional `str` _query parameter_ `q`.
+* ÐолÑÑÐ°ÐµÑ HTTP-запÑоÑÑ Ð¿Ð¾ _пÑÑÑм_ `/` и `/items/{item_id}`.
+* РпеÑвÑй и вÑоÑой _пÑÑÑ_ иÑполÑзÑÑÑ `GET` опеÑаÑии (Ñакже извеÑÑнÑе как HTTP _меÑодÑ_).
+* _пÑÑÑ_ `/items/{item_id}` Ð¸Ð¼ÐµÐµÑ _паÑамеÑÑ Ð¿ÑÑи_ `item_id`, коÑоÑÑй должен бÑÑÑ `int`.
+* _пÑÑÑ_ `/items/{item_id}` Ð¸Ð¼ÐµÐµÑ Ð½ÐµÐ¾Ð±ÑзаÑелÑнÑй `str` _паÑамеÑÑ Ð·Ð°Ð¿ÑоÑа_ `q`.
-### Interactive API docs
+### ÐнÑеÑакÑÐ¸Ð²Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ Ð¿Ð¾ API
-Now go to http://127.0.0.1:8000/docs.
+ÐеÑейдиÑе на http://127.0.0.1:8000/docs.
-You will see the automatic interactive API documentation (provided by Swagger UI):
+ÐÑ ÑвидиÑе авÑомаÑиÑеÑкÑÑ Ð¸Ð½ÑеÑакÑивнÑÑ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ API (пÑедоÑÑавленнÑÑ Swagger UI):

-### Alternative API docs
+### ÐлÑÑеÑнаÑÐ¸Ð²Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ Ð¿Ð¾ API
-And now, go to http://127.0.0.1:8000/redoc.
+Ð ÑепеÑÑ Ð¿ÐµÑейдиÑе на http://127.0.0.1:8000/redoc.
-You will see the alternative automatic documentation (provided by ReDoc):
+ÐÑ ÑвидиÑе алÑÑеÑнаÑивнÑÑ Ð°Ð²ÑомаÑиÑеÑкÑÑ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ (пÑедоÑÑавленнÑÑ ReDoc):

-## Example upgrade
+## ÐÑÐ¸Ð¼ÐµÑ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ
-Now modify the file `main.py` to receive a body from a `PUT` request.
+ТепеÑÑ Ð¸Ð·Ð¼ÐµÐ½Ð¸Ñе Ñайл `main.py`, ÑÑÐ¾Ð±Ñ Ð¿Ð¾Ð»ÑÑиÑÑ Ñело оÑвеÑа из `PUT` запÑоÑа.
-Declare the body using standard Python types, thanks to Pydantic.
+ÐбÑÑвиÑе Ñело, иÑполÑзÑÑ ÑÑандаÑÑнÑÑ ÑипизаÑÐ¸Ñ Python, ÑпаÑибо Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Union
@@ -293,174 +291,173 @@ def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
```
-The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
+СеÑÐ²ÐµÑ Ð´Ð¾Ð»Ð¶ÐµÐ½ пеÑезагÑÑзиÑÑÑÑ Ð°Ð²ÑомаÑиÑеÑки (поÑÐ¾Ð¼Ñ ÑÑо Ð²Ñ Ð´Ð¾Ð±Ð°Ð²Ð¸Ð»Ð¸ `--reload` к команде `uvicorn` вÑÑе).
-### Interactive API docs upgrade
+### ÐнÑеÑакÑивное обновление докÑменÑаÑии API
-Now go to http://127.0.0.1:8000/docs.
+ÐеÑейдиÑе на http://127.0.0.1:8000/docs.
-* The interactive API documentation will be automatically updated, including the new body:
+* ÐнÑеÑакÑÐ¸Ð²Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ API бÑÐ´ÐµÑ Ð°Ð²ÑомаÑиÑеÑки обновлÑÑÑÑÑ, вклÑÑÐ°Ñ Ð½Ð¾Ð²Ð¾Ðµ Ñело:

-* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
+* ÐажмиÑе на ÐºÐ½Ð¾Ð¿ÐºÑ "Try it out", ÑÑо Ð¿Ð¾Ð·Ð²Ð¾Ð»Ð¸Ñ Ð²Ð°Ð¼ заполниÑÑ Ð¿Ð°ÑамеÑÑÑ Ð¸ напÑÑмÑÑ Ð²Ð·Ð°Ð¸Ð¼Ð¾Ð´ÐµÐ¹ÑÑвоваÑÑ Ñ API:

-* 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:
+* ÐаÑем нажмиÑе ÐºÐ½Ð¾Ð¿ÐºÑ "Execute", полÑзоваÑелÑÑкий инÑеÑÑÐµÐ¹Ñ ÑвÑжеÑÑÑ Ñ Ð²Ð°Ñим API, оÑпÑÐ°Ð²Ð¸Ñ Ð¿Ð°ÑамеÑÑÑ, полÑÑÐ¸Ñ ÑезÑлÑÑаÑÑ Ð¸ оÑобÑÐ°Ð·Ð¸Ñ Ð¸Ñ
на ÑкÑане:

-### Alternative API docs upgrade
+### ÐлÑÑеÑнаÑивное обновление докÑменÑаÑии API
-And now, go to http://127.0.0.1:8000/redoc.
+Ð ÑепеÑÑ Ð¿ÐµÑейдиÑе на http://127.0.0.1:8000/redoc.
-* The alternative documentation will also reflect the new query parameter and body:
+* ÐлÑÑеÑнаÑÐ¸Ð²Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ Ñакже бÑÐ´ÐµÑ Ð¾ÑÑажаÑÑ Ð½Ð¾Ð²Ñй паÑамеÑÑ Ð¸ Ñело запÑоÑа:

-### Recap
+### ÐодведÑм иÑоги
-In summary, you declare **once** the types of parameters, body, etc. as function parameters.
+Таким обÑазом, Ð²Ñ Ð¾Ð±ÑÑвлÑеÑе **один Ñаз** ÑÐ¸Ð¿Ñ Ð¿Ð°ÑамеÑÑов, Ñело и Ñ. д. в каÑеÑÑве паÑамеÑÑов ÑÑнкÑии.
-You do that with standard modern Python types.
+ÐÑ Ð´ÐµÐ»Ð°ÐµÑе ÑÑо иÑплÑзÑÑ ÑÑандаÑÑнÑÑ ÑовÑеменнÑÑ ÑипизаÑÐ¸Ñ Python.
-You don't have to learn a new syntax, the methods or classes of a specific library, etc.
+Ðам не нÑжно изÑÑаÑÑ Ð½Ð¾Ð²Ñй ÑинÑакÑиÑ, меÑÐ¾Ð´Ñ Ð¸Ð»Ð¸ клаÑÑÑ ÐºÐ¾Ð½ÐºÑеÑной библиоÑеки и Ñ. д.
-Just standard **Python 3.6+**.
+ТолÑко ÑÑандаÑÑнÑй **Python 3.6+**.
-For example, for an `int`:
+ÐапÑимеÑ, Ð´Ð»Ñ `int`:
```Python
item_id: int
```
-or for a more complex `Item` model:
+или Ð´Ð»Ñ Ð±Ð¾Ð»ÐµÐµ Ñложной модели `Item`:
```Python
item: Item
```
-...and with that single declaration you get:
+... и Ñ ÑÑим единÑÑвеннÑм обÑÑвлением Ð²Ñ Ð¿Ð¾Ð»ÑÑаеÑе:
-* Editor support, including:
- * Completion.
- * Type checks.
-* Validation of data:
- * Automatic and clear errors when the data is invalid.
- * Validation even for deeply nested JSON objects.
-* Conversion of input data: coming from the network to Python data and types. Reading from:
+* ÐоддеÑжка ÑедакÑоÑа, в Ñом ÑиÑле:
+ * ÐвÑозавеÑÑение.
+ * ÐÑовеÑка Ñипов.
+* ÐалидаÑÐ¸Ñ Ð´Ð°Ð½Ð½ÑÑ
:
+ * ÐвÑомаÑиÑеÑкие и ÑеÑкие оÑибки, когда даннÑе недейÑÑвиÑелÑнÑ.
+ * ÐÑовеÑка даже Ð´Ð»Ñ Ð³Ð»Ñбоко вложеннÑÑ
обÑекÑов JSON.
+* ÐÑеобÑазование вÑ
однÑÑ
даннÑÑ
: поÑÑÑпаÑÑие из ÑеÑи в обÑекÑÑ Python Ñ ÑоблÑдением Ñипов. ЧÑение из:
* JSON.
- * Path parameters.
- * Query parameters.
+ * ÐаÑамеÑÑов пÑÑи.
+ * ÐаÑамеÑÑов запÑоÑа.
* Cookies.
- * Headers.
- * Forms.
- * Files.
-* Conversion of output data: converting from Python data and types to network data (as JSON):
- * Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc).
- * `datetime` objects.
- * `UUID` objects.
- * Database models.
- * ...and many more.
-* Automatic interactive API documentation, including 2 alternative user interfaces:
+ * Ðаголовков.
+ * ФоÑм.
+ * Файлов.
+* ÐÑеобÑазование вÑÑ
однÑÑ
даннÑÑ
: пÑеобÑазование обÑекÑов Python в даннÑе пеÑедаваемÑе по ÑеÑи инÑеÑÐ½ÐµÑ (Ñакие как JSON):
+ * ÐÑеобÑазование Ñипов Python (`str`, `int`, `float`, `bool`, `list`, и Ñ.д.).
+ * ÐбÑекÑÑ `datetime`.
+ * ÐбÑекÑÑ `UUID`.
+ * Ðодели баз даннÑÑ
.
+ * ...и многое дÑÑгое.
+* ÐвÑомаÑиÑеÑÐºÐ°Ñ Ð¸Ð½ÑеÑакÑÐ¸Ð²Ð½Ð°Ñ Ð´Ð¾ÐºÑменÑаÑÐ¸Ñ Ð¿Ð¾ API, вклÑÑÐ°Ñ 2 алÑÑеÑнаÑивнÑÑ
полÑзоваÑелÑÑкиÑ
инÑеÑÑейÑа:
* Swagger UI.
* ReDoc.
---
-Coming back to the previous code example, **FastAPI** will:
-
-* Validate that there is an `item_id` in the path for `GET` and `PUT` requests.
-* Validate that the `item_id` is of type `int` for `GET` and `PUT` requests.
- * If it is not, the client will see a useful, clear error.
-* 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.
- * As the `q` parameter is declared with `= None`, it is optional.
- * Without the `None` it would be required (as is the body in the case with `PUT`).
-* For `PUT` requests to `/items/{item_id}`, Read the body as JSON:
- * Check that it has a required attribute `name` that should be a `str`.
- * Check that it has a required attribute `price` that has to be a `float`.
- * Check that it has an optional attribute `is_offer`, that should be a `bool`, if present.
- * All this would also work for deeply nested JSON objects.
-* Convert from and to JSON automatically.
-* Document everything with OpenAPI, that can be used by:
- * Interactive documentation systems.
- * Automatic client code generation systems, for many languages.
-* Provide 2 interactive documentation web interfaces directly.
+ÐозвÑаÑаÑÑÑ Ðº пÑедÑдÑÑÐµÐ¼Ñ Ð¿ÑимеÑÑ ÐºÐ¾Ð´Ð°, **FastAPI** бÑдеÑ:
+
+* ÐÑовеÑÑÑÑ Ð½Ð°Ð»Ð¸Ñие `item_id` в пÑÑи Ð´Ð»Ñ Ð·Ð°Ð¿ÑоÑов `GET` и `PUT`.
+* ÐÑовеÑÑÑÑ, ÑÑо `item_id` Ð¸Ð¼ÐµÐµÑ Ñип `int` Ð´Ð»Ñ Ð·Ð°Ð¿ÑоÑов `GET` и `PUT`.
+ * ÐÑли ÑÑо не Ñак, ÐºÐ»Ð¸ÐµÐ½Ñ ÑÐ²Ð¸Ð´Ð¸Ñ Ð¿Ð¾Ð»ÐµÐ·Ð½ÑÑ ÑÑÑкÑÑ Ð¾ÑибкÑ.
+* ÐÑовеÑÑÑÑ, еÑÑÑ Ð»Ð¸ необÑзаÑелÑнÑй паÑамеÑÑ Ð·Ð°Ð¿ÑоÑа Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ `q` (напÑимеÑ, `http://127.0.0.1:8000/items/foo?q=somequery`) Ð´Ð»Ñ `GET` запÑоÑов.
+ * ÐоÑколÑÐºÑ Ð¿Ð°ÑамеÑÑ `q` обÑÑвлен Ñ `= None`, он ÑвлÑеÑÑÑ Ð½ÐµÐ¾Ð±ÑзаÑелÑнÑм.
+ * Ðез `None` он бÑл Ð±Ñ Ð½ÐµÐ¾Ð±Ñ
одим (как Ñело в ÑлÑÑае Ñ `PUT`).
+* ÐÐ»Ñ `PUT` запÑоÑов к `/items/{item_id}` ÑиÑаÑÑ Ñело как JSON:
+ * ÐÑовеÑÑÑÑ, ÑÑо Ñ Ð½ÐµÐ³Ð¾ еÑÑÑ Ð¾Ð±ÑзаÑелÑнÑй аÑÑибÑÑ `name`, коÑоÑÑй должен бÑÑÑ `str`.
+ * ÐÑовеÑÑÑÑ, ÑÑо Ñ Ð½ÐµÐ³Ð¾ еÑÑÑ Ð¾Ð±ÑзаÑелÑнÑй аÑÑибÑÑ `price`, коÑоÑÑй должен бÑÑÑ `float`.
+ * ÐÑовеÑÑÑÑ, ÑÑо Ñ Ð½ÐµÐ³Ð¾ еÑÑÑ Ð½ÐµÐ¾Ð±ÑзаÑелÑнÑй аÑÑибÑÑ `is_offer`, коÑоÑÑй должен бÑÑÑ `bool`, еÑли он пÑиÑÑÑÑÑвÑеÑ.
+ * ÐÑе ÑÑо Ñакже бÑÐ´ÐµÑ ÑабоÑаÑÑ Ð´Ð»Ñ Ð³Ð»Ñбоко вложеннÑÑ
обÑекÑов JSON.
+* ÐÑеобÑазовÑваÑÑ Ð¸Ð· и в JSON авÑомаÑиÑеÑки.
+* ÐокÑменÑиÑоваÑÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ OpenAPI вÑе, ÑÑо Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð¸ÑполÑзовано:
+ * СиÑÑÐµÐ¼Ñ Ð¸Ð½ÑеÑакÑивной докÑменÑаÑии.
+ * СиÑÑÐµÐ¼Ñ Ð°Ð²ÑомаÑиÑеÑкой генеÑаÑии клиенÑÑкого кода Ð´Ð»Ñ Ð¼Ð½Ð¾Ð³Ð¸Ñ
ÑзÑков.
+* ÐбеÑпеÑÐ¸Ñ 2 инÑеÑакÑивнÑÑ
веб-инÑеÑÑейÑа докÑменÑаÑии напÑÑмÑÑ.
---
-We just scratched the surface, but you already get the idea of how it all works.
+ÐÑ ÑолÑко немного копнÑли повеÑÑ
ноÑÑÑ, но Ð²Ñ Ñже понÑли, как вÑе ÑÑо ÑабоÑаеÑ.
-Try changing the line with:
+ÐопÑобÑйÑе измениÑÑ ÑÑÑÐ¾ÐºÑ Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ:
```Python
return {"item_name": item.name, "item_id": item_id}
```
-...from:
+...из:
```Python
... "item_name": item.name ...
```
-...to:
+...в:
```Python
... "item_price": item.price ...
```
-...and see how your editor will auto-complete the attributes and know their types:
+... и поÑмоÑÑиÑе, как Ð²Ð°Ñ ÑедакÑÐ¾Ñ Ð±ÑÐ´ÐµÑ Ð°Ð²ÑомаÑиÑеÑки заполнÑÑÑ Ð°ÑÑибÑÑÑ Ð¸ ÑзнаваÑÑ Ð¸Ñ
ÑипÑ:

-For a more complete example including more features, see the Tutorial - User Guide.
+Ðолее полнÑй пÑÐ¸Ð¼ÐµÑ Ñ Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸ÑелÑнÑми ÑÑнкÑиÑми Ñм. в УÑебное ÑÑководÑÑво - Ð ÑководÑÑво полÑзоваÑелÑ.
-**Spoiler alert**: the tutorial - user guide includes:
+**ÐÑÑоÑожно, ÑпойлеÑ**: ÑÑководÑÑво полÑзоваÑÐµÐ»Ñ Ð²ÐºÐ»ÑÑÐ°ÐµÑ Ð² ÑебÑ:
-* Declaration of **parameters** from other different places as: **headers**, **cookies**, **form fields** and **files**.
-* How to set **validation constraints** as `maximum_length` or `regex`.
-* A very powerful and easy to use **Dependency Injection** system.
-* Security and authentication, including support for **OAuth2** with **JWT tokens** and **HTTP Basic** auth.
-* More advanced (but equally easy) techniques for declaring **deeply nested JSON models** (thanks to Pydantic).
-* Many extra features (thanks to Starlette) as:
- * **WebSockets**
- * **GraphQL**
- * extremely easy tests based on `requests` and `pytest`
+* ÐбÑÑвление **паÑамеÑÑов** из дÑÑгиÑ
меÑÑ, ÑакиÑ
как: **заголовки**, **cookies**, **Ð¿Ð¾Ð»Ñ ÑоÑмÑ** и **ÑайлÑ**.
+* Ðак ÑÑÑановиÑÑ **огÑаниÑиÑелÑнÑе пÑовеÑки** Ñакие как `maximum_length` или `regex`.
+* ÐÑÐµÐ½Ñ Ð¼Ð¾ÑÐ½Ð°Ñ Ð¸ пÑоÑÑÐ°Ñ Ð² иÑполÑзовании ÑиÑÑема **внедÑÐµÐ½Ð¸Ñ Ð·Ð°Ð²Ð¸ÑимоÑÑей**.
+* ÐезопаÑноÑÑÑ Ð¸ аÑÑенÑиÑикаÑиÑ, вклÑÑÐ°Ñ Ð¿Ð¾Ð´Ð´ÐµÑÐ¶ÐºÑ **OAuth2** Ñ **Ñокенами JWT** и **HTTP Basic** аÑÑенÑиÑикаÑиÑ.
+* Ðолее пÑодвинÑÑÑе (но ÑÑÐ¾Ð»Ñ Ð¶Ðµ пÑоÑÑÑе) меÑÐ¾Ð´Ñ Ð¾Ð±ÑÑÐ²Ð»ÐµÐ½Ð¸Ñ **глÑбоко вложеннÑÑ
моделей JSON** (ÑпаÑибо Pydantic).
+* **GraphQL** инÑегÑаÑÐ¸Ñ Ñ Strawberry и дÑÑгими библиоÑеками.
+* ÐножеÑÑво дополниÑелÑнÑÑ
ÑÑнкÑий (благодаÑÑ Starlette), ÑакиÑ
как:
+ * **Ðеб-ÑокеÑÑ**
+ * оÑÐµÐ½Ñ Ð¿ÑоÑÑÑе ÑеÑÑÑ Ð½Ð° оÑнове `requests` и `pytest`
* **CORS**
- * **Cookie Sessions**
- * ...and more.
+ * **Cookie ÑеанÑÑ(ÑеÑÑии)**
+ * ...и многое дÑÑгое.
-## Performance
+## ÐÑоизводиÑелÑноÑÑÑ
-Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as one of the fastest Python frameworks available, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
+ÐезавиÑимÑе ÑеÑÑÑ TechEmpower показÑваÑÑ Ð¿ÑÐ¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ **FastAPI**, ÑабоÑаÑÑие под ÑпÑавлением Uvicorn, как один из ÑамÑÑ
бÑÑÑÑÑÑ
доÑÑÑпнÑÑ
ÑÑеймвоÑков Python, ÑÑÑÑпаÑÑий ÑолÑко Ñамим Starlette и Uvicorn (иÑполÑзÑемÑÑ
внÑÑÑи FastAPI). (*)
-To understand more about it, see the section Benchmarks.
+ЧÑÐ¾Ð±Ñ ÑзнаÑÑ Ð±Ð¾Ð»ÑÑе об ÑÑом, Ñм. Ñаздел ТеÑÑÑ Ð¿ÑоизводиÑелÑноÑÑи.
-## Optional Dependencies
+## ÐеобÑзаÑелÑнÑе завиÑимоÑÑи
-Used by Pydantic:
+ÐÑполÑзÑеÑÑÑ Pydantic:
-* ujson
- for faster JSON "parsing".
-* email_validator
- for email validation.
+* ujson
- Ð´Ð»Ñ Ð±Ð¾Ð»ÐµÐµ бÑÑÑÑого JSON "паÑÑинга".
+* email_validator
- Ð´Ð»Ñ Ð¿ÑовеÑки ÑлекÑÑонной поÑÑÑ.
-Used by Starlette:
+ÐÑполÑзÑеÑÑÑ Starlette:
-* requests
- Required if you want to use the `TestClient`.
-* jinja2
- Required if you want to use the default template configuration.
-* python-multipart
- Required if you want to support form "parsing", with `request.form()`.
-* itsdangerous
- Required for `SessionMiddleware` support.
-* pyyaml
- Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
-* graphene
- Required for `GraphQLApp` support.
-* ujson
- Required if you want to use `UJSONResponse`.
+* requests
- ÐбÑзаÑелÑно, еÑли Ð²Ñ Ñ
оÑиÑе иÑполÑзоваÑÑ `TestClient`.
+* jinja2
- ÐбÑзаÑелÑно, еÑли Ð²Ñ Ñ
оÑиÑе иÑполÑзоваÑÑ ÐºÐ¾Ð½ÑигÑÑаÑÐ¸Ñ Ñаблона по ÑмолÑаниÑ.
+* python-multipart
- ÐбÑзаÑелÑно, еÑли Ð²Ñ Ñ
оÑиÑе поддеÑживаÑÑ ÑоÑÐ¼Ñ "паÑÑинга" Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ `request.form()`.
+* itsdangerous
- ÐбÑзаÑелÑно, Ð´Ð»Ñ Ð¿Ð¾Ð´Ð´ÐµÑжки `SessionMiddleware`.
+* pyyaml
- ÐбÑзаÑелÑно, Ð´Ð»Ñ Ð¿Ð¾Ð´Ð´ÐµÑжки `SchemaGenerator` Starlette (возможно, вам ÑÑо не нÑжно Ñ FastAPI).
+* ujson
- ÐбÑзаÑелÑно, еÑли Ð²Ñ Ñ
оÑиÑе иÑполÑзоваÑÑ `UJSONResponse`.
-Used by FastAPI / Starlette:
+ÐÑполÑзÑеÑÑÑ FastAPI / Starlette:
-* uvicorn
- for the server that loads and serves your application.
-* orjson
- Required if you want to use `ORJSONResponse`.
+* uvicorn
- ÑеÑвеÑ, коÑоÑÑй загÑÑÐ¶Ð°ÐµÑ Ð¸ обÑлÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð²Ð°Ñе пÑиложение.
+* orjson
- ÐбÑзаÑелÑно, еÑли Ð²Ñ Ñ
оÑиÑе иÑполÑзоваÑÑ `ORJSONResponse`.
-You can install all of these with `pip install fastapi[all]`.
+ÐÑ Ð¼Ð¾Ð¶ÐµÑе ÑÑÑановиÑÑ Ð²Ñе ÑÑо Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ `pip install "fastapi[all]"`.
-## License
+## ÐиÑензиÑ
-This project is licensed under the terms of the MIT license.
+ÐÑÐ¾Ñ Ð¿ÑÐ¾ÐµÐºÑ ÑаÑпÑоÑÑÑанÑеÑÑÑ Ð½Ð° ÑÑловиÑÑ
лиÑензии MIT.
--
2.47.3