Compare commits

..

274 Commits

Author SHA1 Message Date
Sebastián Ramírez
a0209a0d2c 🔖 Release version 0.67.0 2021-07-21 20:00:39 +02:00
Sebastián Ramírez
099aab79e6 📝 Update release notes 2021-07-21 19:59:38 +02:00
github-actions
7dc5b94d45 📝 Update release notes 2021-07-21 17:54:42 +00:00
Sebastián Ramírez
684c0077cc Add support for dataclasses in request bodies and response_model (#3577) 2021-07-21 19:54:08 +02:00
github-actions
75d8a6b5c2 📝 Update release notes 2021-07-21 14:39:54 +00:00
Sebastián Ramírez
96fdfc53cc Support dataclasses in responses (#3576)
Co-authored-by: amit lissack <amit@opentrons.com>
2021-07-21 14:39:12 +00:00
github-actions
49517d3310 📝 Update release notes 2021-07-21 13:16:08 +00:00
Ehigie Aito
9355cc4eaa 📝 Add external link: How to Create A Fake Certificate Authority And Generate TLS Certs for FastAPI (#2839)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-21 13:15:33 +00:00
github-actions
1ce59152e7 📝 Update release notes 2021-07-21 12:44:53 +00:00
jaystone776
1241f7f0b7 ✏ Fix code highlighted line in: body-nested-models.md (#3463) 2021-07-21 14:44:15 +02:00
github-actions
fd74c0f6a4 📝 Update release notes 2021-07-21 12:42:05 +00:00
jaystone776
e4eac12c34 ✏ Fix typo in body-nested-models.md (#3462)
Typo in line 201, *where* should be *were*
2021-07-21 14:41:24 +02:00
github-actions
b235653a6c 📝 Update release notes 2021-07-21 12:37:40 +00:00
David Brakman
4cb4bdb984 ✏ Fix typo "might me" -> "might be" in docs/en/docs/tutorial/schema-extra-example.md (#3362)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-21 12:37:06 +00:00
github-actions
ba596152d9 📝 Update release notes 2021-07-21 12:28:48 +00:00
Shahriyar Rzayev
a1227624c8 📝 Add external link: Building simple E-Commerce with NuxtJS and FastAPI (#3271)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-21 12:28:15 +00:00
github-actions
9ce1ae771c 📝 Update release notes 2021-07-21 12:21:46 +00:00
Rodrigo Arenas
b9fed9b485 📝 Add external link: Serve a machine learning model using Sklearn, FastAPI and Docker (#2974)
Co-authored-by: rodrigoarenas456 <31422766+rodrigoarenas456@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-21 14:20:53 +02:00
github-actions
0d97e1f97d 📝 Update release notes 2021-07-21 12:15:08 +00:00
Marcelo Trylesinski
1ce7258a01 ✏️ Fix typo on docstring in datastructures file (#2887) 2021-07-21 14:14:34 +02:00
github-actions
bcd06fdfdf 📝 Update release notes 2021-07-21 12:11:22 +00:00
Marcelo Trylesinski
fc35b7d18d 🎨 Improve style for sponsors, add radius border (#2388)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-21 14:10:47 +02:00
github-actions
8c12ab0d5b 📝 Update release notes 2021-07-21 11:15:03 +00:00
Sebastián Ramírez
38194a29bc 📝 Add External Link: Deploy FastAPI on Ubuntu and Serve using Caddy 2 Web Server (#3572) 2021-07-21 13:14:28 +02:00
github-actions
6b65de6033 📝 Update release notes 2021-07-21 11:12:47 +00:00
github-actions
f80230d654 📝 Update release notes 2021-07-21 11:11:43 +00:00
github-actions
f6cc418d79 📝 Update release notes 2021-07-21 11:10:13 +00:00
github-actions
3ce9407093 📝 Update release notes 2021-07-21 11:08:47 +00:00
github-actions
ef1716c39e 📝 Update release notes 2021-07-21 10:42:13 +00:00
Sebastián Ramírez
9ab7da6562 👷 Update GitHub Action latest-changes, strike 2 (#3575) 2021-07-21 10:41:32 +00:00
Sebastián Ramírez
fcfff5e8e5 👷 Update GitHub Action latest-changes (#3574) 2021-07-21 10:33:42 +00:00
Sebastián Ramírez
67ef62a4dd 👷 Update GitHub Action latest-changes (#3573) 2021-07-21 09:54:27 +00:00
Sebastián Ramírez
7741635b3b 🔧 Add External Link, replaces #1898 (#3571) 2021-07-21 09:39:12 +00:00
Sebastián Ramírez
3d81bc638b 👷 Rename and clarify CI workflow job names (#3570) 2021-07-21 11:24:40 +02:00
github-actions
c1801738b0 📝 Update release notes 2021-07-21 08:52:50 +00:00
Sebastián Ramírez
ba84f167f5 🔧 Sort external links in docs to have the most recent at the top (#3568) 2021-07-21 10:52:10 +02:00
Sebastián Ramírez
0a38c51b9e 🔖 Release 0.66.1 2021-07-19 21:26:52 +02:00
Sebastián Ramírez
db5b2bdf56 📝 Update release notes 2021-07-19 21:21:40 +02:00
github-actions
5ac84120b3 📝 Update release notes 2021-07-19 19:15:35 +00:00
Thomas Grainger
2d296c5d07 🔧 Configure strict pytest options and update/refactor tests (#2790)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-19 21:14:58 +02:00
github-actions
71c96d9eb9 📝 Update release notes 2021-07-19 12:49:41 +00:00
Mark H
5342a0a00f 🌐 Add basic setup for German translations (#3522) 2021-07-19 14:49:09 +02:00
github-actions
163b086f21 📝 Update release notes 2021-07-19 12:47:20 +00:00
oandersonmagalhaes
0876d3df1d 🌐 Add Portuguese translation for docs/tutorial/security/index.md (#3507)
Co-authored-by: Izabela Guerreiro <izaguerreiro@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-19 14:46:39 +02:00
github-actions
50baf5e804 📝 Update release notes 2021-07-19 12:33:34 +00:00
Lucas
3d6da2c32d 🌐 Add Portuguese translation for docs/deployment/index.md (#3337) 2021-07-19 14:32:54 +02:00
github-actions
e721d04350 📝 Update release notes 2021-07-05 11:45:43 +00:00
Sebastián Ramírez
8cc6f9baac ⬆️ Upgrade python-jose dependency for tests (#3468) 2021-07-05 13:45:03 +02:00
Sebastián Ramírez
dfd453e001 📝 Update release notes 2021-07-04 21:18:45 +02:00
Sebastián Ramírez
7e9d5aacf8 🔖 Release version 0.66.0 2021-07-04 20:59:46 +02:00
Sebastián Ramírez
d27a218bc3 📝 Update release notes 2021-07-04 20:58:49 +02:00
github-actions
0c4ded88fe 📝 Update release notes 2021-07-04 18:54:19 +00:00
Rubikoid
0e0931d308 🐛 Fix include/exclude for dicts in jsonable_encoder (#2016)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-04 20:53:40 +02:00
github-actions
dcfa9eb8fe 📝 Update release notes 2021-07-04 17:35:19 +00:00
Camila Gutierrez
6ebf60b175 🌐 Add Spanish translation for tutorial/query-params.md (#2243)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-04 19:34:46 +02:00
github-actions
a4d0724a97 📝 Update release notes 2021-07-04 17:06:51 +00:00
Juan Funez
c235e9b78c 🌐 Add Spanish translation for advanced/response-directly.md (#1253)
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 19:06:18 +02:00
github-actions
5fa3e239db 📝 Update release notes 2021-07-04 14:15:04 +00:00
Juan Funez
3d1b107d70 🌐 Add Spanish translation for advanced/additional-status-codes.md (#1252)
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 16:14:29 +02:00
github-actions
18e0828daf 📝 Update release notes 2021-07-04 12:50:02 +00:00
Juan Funez
f16c7729bd 🌐 Add Spanish translation for advanced/path-operation-advanced-configuration.md (#1251)
Co-authored-by: Camila Gutierrez <mariacamilagl@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Co-authored-by: Camila Gutierrez <mariacamilagl30@gmail.com>
2021-07-04 14:49:31 +02:00
Sebastián Ramírez
9f3c8cd139 📝 Update release notes, add links to docs 2021-07-03 21:59:39 +02:00
github-actions
a7a35aee61 📝 Update release notes 2021-07-03 19:52:03 +00:00
Sebastián Ramírez
dc5a966548 Allow setting the response_class to RedirectResponse and returning the URL from the function (#3457) 2021-07-03 21:51:28 +02:00
github-actions
ea8d7f689e 📝 Update release notes 2021-07-03 17:16:33 +00:00
Jacob Magnusson
0ed6c92341 🐛 Support custom OpenAPI / JSON Schema fields in the generated output OpenAPI (#1429)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 19:15:59 +02:00
Sebastián Ramírez
79f52c76cf 🔖 Release version 0.65.3 2021-07-03 18:33:32 +02:00
Sebastián Ramírez
b725e9eb45 📝 Update release notes 2021-07-03 18:32:50 +02:00
Sebastián Ramírez
787e54b096 📝 Update release notes 2021-07-03 18:30:46 +02:00
github-actions
15fd60b29a 📝 Update release notes 2021-07-03 16:26:48 +00:00
Sebastián Ramírez
edf6b2d61f ♻ Assume request bodies contain JSON when no Content-Type header is provided (#3456) 2021-07-03 18:25:12 +02:00
github-actions
7eb17fc874 📝 Update release notes 2021-07-03 15:13:30 +00:00
Nasaruddin
7e4bfaf0e9 🌐 Initialize Indonesian translations (#3014)
Co-authored-by: Nasaruddin <nasaruddin@skorpoints.com>
2021-07-03 17:12:51 +02:00
github-actions
e1d4fc5325 📝 Update release notes 2021-07-03 14:47:21 +00:00
Camila Gutierrez
faec748ef6 🌐 Add Spanish translation of Tutorial - Path Parameters (#2219)
Co-authored-by: Pedro A. Moreno <pedabraham@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 16:46:49 +02:00
github-actions
afec8c4580 📝 Update release notes 2021-07-03 14:14:01 +00:00
Camila Gutierrez
8a1f0aa3b6 🌐 Add Spanish translation of Tutorial - First Steps (#2208)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-03 16:13:28 +02:00
github-actions
f784644510 📝 Update release notes 2021-07-02 15:18:24 +00:00
github-actions[bot]
710a2f745c 👥 Update FastAPI People (#3450)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 17:17:49 +02:00
github-actions
bd230fe473 📝 Update release notes 2021-07-02 15:00:53 +00:00
Mário Victor Ribeiro Silva
9c5b000956 🌐 Portuguese translation of Tutorial - Body - Fields (#3420)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 17:00:11 +02:00
github-actions
a9f2a25feb 📝 Update release notes 2021-07-02 14:54:56 +00:00
jaystone776
c00c2d1ecf 🌐 Add Chinese translation for Tutorial - Request - Forms - and - Files (#3249)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:54:22 +02:00
github-actions
dd7bbae837 📝 Update release notes 2021-07-02 14:44:04 +00:00
jaystone776
0a84d48a82 🌐 Add Chinese translation for Tutorial - Handling - Errors (#3299)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:43:28 +02:00
github-actions
e5d0b97dee 📝 Update release notes 2021-07-02 14:36:34 +00:00
jaystone776
811c3f873f 🌐 Add Chinese translation for Tutorial - Form - Data (#3248)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:35:58 +02:00
github-actions
662fc81544 📝 Update release notes 2021-07-02 14:27:36 +00:00
github-actions[bot]
5e2f2d541d 👥 Update FastAPI People (#3319)
Co-authored-by: github-actions <github-actions@github.com>
2021-07-02 16:27:02 +02:00
github-actions
8116d8158b 📝 Update release notes 2021-07-02 14:24:16 +00:00
jaystone776
e6836781d5 🌐 Add Chinese translation for Tutorial - Body - Updates (#3237)
Co-authored-by: Xie Wei <ampedee@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:23:41 +02:00
github-actions
098088c763 📝 Update release notes 2021-07-02 14:21:11 +00:00
Hareru
4bf9a52043 🌐 Add Chinese translation for FastAPI People (#3112)
Co-authored-by: Xie Wei <ampedee@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:20:36 +02:00
github-actions
eb6f964ede 📝 Update release notes 2021-07-02 14:18:44 +00:00
Sam Courtemanche
4473a9bcbf 🌐 Add French translation for Project Generation (#3197)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:18:06 +02:00
github-actions
fdc7c96ece 📝 Update release notes 2021-07-02 14:14:28 +00:00
Sam Courtemanche
a694be81ae 🌐 Add French translation for Python Types Intro (#3185) 2021-07-02 16:13:52 +02:00
github-actions
0abb743e9c 📝 Update release notes 2021-07-02 14:12:43 +00:00
Sam Courtemanche
acda3f06b0 🌐 Add French translation for External Links (#3103)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-07-02 16:12:05 +02:00
github-actions
3127bc4e05 📝 Update release notes 2021-07-02 14:06:45 +00:00
Ruidy
18b24df9c8 🌐 Add French translation for Alternatives, Inspiration and Comparisons (#3020)
Co-authored-by: Jérôme Fink <jerome.fink@student.unamur.be>
Co-authored-by: Sam Courtemanche <sam.courtemanche.ipod@gmail.com>
2021-07-02 16:06:10 +02:00
github-actions
b27758fe13 📝 Update release notes 2021-07-02 14:03:22 +00:00
BoYanZh
a0b2006230 🌐 Fix Chinese translation code snippet mismatch in Tutorial - Python Types Intro 2021-07-02 16:02:45 +02:00
github-actions
bd143ffa5a 📝 Update release notes 2021-07-02 13:43:04 +00:00
Fabio Serrao
77c1988a8b 🌐 Add Portuguese translation for Development Contributing (#1364) 2021-07-02 15:42:29 +02:00
github-actions
26a36f79fa 📝 Update release notes 2021-06-29 21:23:00 +00:00
Sebastián Ramírez
97d8d4016b ⬆ Upgrade docs development dependency on typer-cli to >=0.0.12 to fix conflicts (#3429) 2021-06-29 23:22:23 +02:00
github-actions
246e80512d 📝 Update release notes 2021-06-29 12:24:59 +00:00
jaystone776
fc6827d68a 🌐 Add Chinese translation for Tutorial - Request - Files (#3244)
Co-authored-by: Xie Wei <ampedee@gmail.com>
2021-06-29 14:24:19 +02:00
Sebastián Ramírez
4d91f978d2 🔖 Release version 0.65.2 2021-06-09 10:17:27 +02:00
Sebastián Ramírez
aabe2c7d66 📝 Update release notes 2021-06-09 10:16:25 +02:00
Sebastián Ramírez
377234ad8e 🔒 Create Security Policy 2021-06-07 14:55:40 +02:00
github-actions
38b785813f 📝 Update release notes 2021-06-07 10:46:59 +00:00
Patrick Wang
fa7e3c996e 🐛 Check Content-Type request header before assuming JSON (#2118)
Co-authored-by: Patrick Wang <patrickkwang@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-06-07 12:46:18 +02:00
github-actions
90120dd6e8 📝 Update release notes 2021-06-07 08:53:24 +00:00
Sebastián Ramírez
36772548b7 🔧 Update sponsors badge, course bundle (#3340)
* 🔧 Update sponsors badge, course bundle

* 🍱 Update course bundle SVG sizes
2021-06-07 10:52:44 +02:00
github-actions
40bb0c5f36 📝 Update release notes 2021-05-26 09:26:47 +00:00
Sebastián Ramírez
60918d25a1 🔧 Add new gold sponsor Jina 🎉 (#3291) 2021-05-26 11:26:06 +02:00
github-actions
3afce2c4b8 📝 Update release notes 2021-05-25 15:06:28 +00:00
Sebastián Ramírez
9f6f25d54c 🔧 Add new banner sponsor badge for FastAPI courses bundle (#3288) 2021-05-25 17:05:39 +02:00
Sebastián Ramírez
d5b09cd958 🔧 Add new banner sponsor badge for FastAPI courses bundle (#3288) 2021-05-25 17:05:04 +02:00
github-actions
aece74982d 📝 Update release notes 2021-05-16 18:28:24 +00:00
Sebastián Ramírez
2b1e5b9f82 👷 Upgrade Issue Manager GitHub Action (#3236) 2021-05-16 20:27:45 +02:00
Sebastián Ramírez
43df5d05ed 🔖 Release FastAPI version 0.65.1 2021-05-11 23:19:14 +02:00
github-actions
eaa49ebd20 📝 Update release notes 2021-05-11 21:17:51 +00:00
Sebastián Ramírez
a6293397bc 📌 Upgrade pydantic pin, to handle security vulnerability CVE-2021-29510 (#3213) 2021-05-11 23:17:17 +02:00
Sebastián Ramírez
b890bd1dc5 🔖 Release version 0.65.0 2021-05-10 17:45:21 +02:00
github-actions
3819a11b5f 📝 Update release notes 2021-05-10 14:09:42 +00:00
Hannes Küttner
4aed0411e9 ⬆️ Upgrade Starlette to 0.14.2, including internal UJSONResponse migrated from Starlette (#2335) 2021-05-10 16:09:04 +02:00
github-actions
04ac466748 📝 Update release notes 2021-05-10 08:11:22 +00:00
Sebastián Ramírez
d75126a4ce 👷 Add GitHub Action cache to speed up CI installs (#3204) 2021-05-10 10:10:48 +02:00
github-actions
c654e8384b 📝 Update release notes 2021-05-10 07:47:11 +00:00
Sebastián Ramírez
7c9d0168ff ⬆️ Upgrade setup-python GitHub Action to v2 (#3203) 2021-05-10 09:46:32 +02:00
github-actions
e956ba4d4a 📝 Update release notes 2021-05-10 07:27:43 +00:00
neternefer
85b32f51ff 🌐 Initialize new language Polish for translations (#3170)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-10 09:27:07 +02:00
github-actions
08fabb7b2e 📝 Update release notes 2021-05-10 07:16:15 +00:00
Sebastián Ramírez
273b2cd646 🐛 Fix docs script to generate a new translation language with overrides boilerplate (#3202) 2021-05-10 09:15:39 +02:00
github-actions
de1a5125f8 📝 Update release notes 2021-05-08 17:51:32 +00:00
Sebastián Ramírez
da86791224 Add new Deta banner badge with new sponsorship tier 🙇 (#3194) 2021-05-08 19:50:56 +02:00
Sebastián Ramírez
c646eaa6bb ✏️ Fix typo/order in release notes 2021-05-07 14:25:21 +02:00
github-actions
bf44b428dd 📝 Update release notes 2021-05-07 12:19:57 +00:00
github-actions[bot]
c2907b189c 👥 Update FastAPI People (#3189)
Co-authored-by: github-actions <github-actions@github.com>
2021-05-07 14:19:19 +02:00
github-actions
75317d230b 📝 Update release notes 2021-05-07 12:05:45 +00:00
Sebastián Ramírez
e662654c49 🔊 Update FastAPI People to allow better debugging (#3188) 2021-05-07 14:04:54 +02:00
Sebastián Ramírez
2a67321130 🔖 Release version 0.64.0 2021-05-07 10:15:26 +02:00
Sebastián Ramírez
8d9d2c0d3f 📝 Update release notes 2021-05-07 10:14:21 +02:00
github-actions
dc6a78c357 📝 Update release notes 2021-05-06 15:48:23 +00:00
T
73d1def114 📝 Add link to article in Russian "FastAPI: знакомимся с фреймворком" (#2564) 2021-05-06 17:47:49 +02:00
github-actions
3dc74ba29f 📝 Update release notes 2021-05-06 15:42:53 +00:00
dompatmore
d9d6031db5 📝 Add external link to blog post "Authenticate Your FastAPI App with Auth0" (#2172)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-06 17:42:14 +02:00
Sebastián Ramírez
6135417789 📝 Update release notes 2021-05-06 17:32:04 +02:00
github-actions
6d138f218b 📝 Update release notes 2021-05-05 18:21:32 +00:00
Austin Orr
e10a4375f9 Add support for adding multiple examples in request bodies and path, query, cookie, and header params (#1267)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-05 20:20:56 +02:00
github-actions
3e32eb55f0 📝 Update release notes 2021-05-04 09:03:02 +00:00
NiJia Lin
b3f139c0d9 🌐 Fix Chinese translation of Tutorial - Query Parameters, remove obsolete content (#3051) 2021-05-04 11:02:19 +02:00
github-actions
3b4c692534 📝 Update release notes 2021-05-04 09:01:17 +00:00
Sam Courtemanche
05c859f324 🌐 Add French translation for Tutorial - Background Tasks (#3098)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 11:00:43 +02:00
github-actions
48a33b0453 📝 Update release notes 2021-05-04 08:49:43 +00:00
SueNaeunYang
70746a7bf0 🌐 Fix Korean translation for docs/ko/docs/index.md (#3159) 2021-05-04 10:49:07 +02:00
github-actions
69e3c6e3d3 📝 Update release notes 2021-05-04 08:38:41 +00:00
Spike
388e5c0c25 🌐 Add Korean translation for Tutorial - Query Parameters (#2390)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 10:38:02 +02:00
github-actions
61db5ebcc2 📝 Update release notes 2021-05-04 08:28:21 +00:00
JulianMaurin
23845979ea 🌐 Add French translation for FastAPI People (#2232)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-05-04 10:27:49 +02:00
github-actions
83f7a36d05 📝 Update release notes 2021-05-04 08:25:39 +00:00
Spike
462014e296 🌐 Add Korean translation for Tutorial - Path Parameters (#2355) 2021-05-04 10:24:58 +02:00
github-actions
5da5ae5554 📝 Update release notes 2021-05-04 08:20:03 +00:00
Jérôme Fink
f3a985cb81 🌐 Add French translation for Features (#2157)
Co-authored-by: Jérôme Fink <jerome.fink@unamur.be>
2021-05-04 10:19:24 +02:00
github-actions
22528373bb 📝 Update release notes 2021-04-07 07:04:13 +00:00
github-actions[bot]
ce0ec06e8a 👥 Update FastAPI People (#3031)
Co-authored-by: github-actions <github-actions@github.com>
2021-04-07 09:03:39 +02:00
github-actions
10397ddc30 📝 Update release notes 2021-03-27 17:52:30 +00:00
Shucai.wang
6f72a27632 🌐 Add Chinese translation for Tutorial - Debugging (#2737)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:51:51 +01:00
Sebastián Ramírez
2783667f80 📝 Update release notes 2021-03-27 18:50:39 +01:00
github-actions
d8c1d040d4 📝 Update release notes 2021-03-27 17:39:13 +00:00
Xie Wei
7f037f1bdc 🌐 Add Chinese translation for Tutorial - Security - OAuth2 with Password (and hashing), Bearer with JWT tokens (#2642)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:38:33 +01:00
github-actions
f31104585f 📝 Update release notes 2021-03-27 17:36:52 +00:00
mode
5934a75ddd 🌐 Add Korean translation for Tutorial - Header Parameters (#2589)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:36:09 +01:00
github-actions
650abf091b 📝 Update release notes 2021-03-27 17:31:54 +00:00
Shucai.wang
66f18e9282 🌐 Add Chinese translation for Tutorial - Metadata and Docs URLs (#2559) 2021-03-27 18:31:11 +01:00
github-actions
f044f13121 📝 Update release notes 2021-03-27 17:30:24 +00:00
Spike
0250cfa398 🌐 Add Korean translation for Tutorial - First Steps (#2323)
Co-authored-by: Dahun Jeong <gnsgnsek@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:29:45 +01:00
github-actions
f4ce2510f3 📝 Update release notes 2021-03-27 17:28:52 +00:00
Shucai.wang
8f0a604a37 🌐 Add Chinese translation for Tutorial - CORS (Cross-Origin Resource Sharing) (#2540)
Co-authored-by: Xie Wei <ampedee@gmail.com>
2021-03-27 18:28:07 +01:00
github-actions
0f4c2b6ee0 📝 Update release notes 2021-03-27 17:26:01 +00:00
lpdswing
368d314e11 🌐 Add Chinese translation for Tutorial - Middleware (#2334)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-03-27 18:25:21 +01:00
github-actions
4e79cb0be4 📝 Update release notes 2021-03-27 17:23:26 +00:00
Spike
973595b3cb 🌐 Add Korean translation for Tutorial - Intro (#2317)
Co-authored-by: Dahun Jeong <gnsgnsek@gmail.com>
2021-03-27 18:22:50 +01:00
github-actions
fa779017d2 📝 Update release notes 2021-03-27 16:55:48 +00:00
Sebastián Ramírez
b2e27de2fc 🔧 Update top banner, point to newsletter (#3003) 2021-03-27 17:55:12 +01:00
github-actions
31a7bfd227 📝 Update release notes 2021-03-27 16:46:10 +00:00
Sebastián Ramírez
47dde41c6c 🔧 Disable sponsor WeTransfer (#3002) 2021-03-27 17:45:32 +01:00
github-actions
413a86998e 📝 Update release notes 2021-03-27 16:36:52 +00:00
Sebastián Ramírez
36721d4362 📌 Pin SQLAlchemy range, as it doesn't use SemVer (#3001) 2021-03-27 17:36:07 +01:00
github-actions
c09e950bd2 📝 Update release notes 2021-03-01 19:02:33 +00:00
Sebastián Ramírez
4d208b2b90 🎨 Add newly required type annotations for mypy (#2882)
* ⬆️ Upgrade mypy

* 🎨 Add extra type annotations, now required by mypy
2021-03-01 20:01:50 +01:00
github-actions
071c6a17dd 📝 Update release notes 2021-03-01 18:33:53 +00:00
github-actions[bot]
4ab79c679b 👥 Update FastAPI People (#2880)
Co-authored-by: github-actions <github-actions@github.com>
2021-03-01 19:33:08 +01:00
github-actions
33be5fc8ba 📝 Update release notes 2021-02-07 18:27:26 +00:00
Davide Fiocco
a7a353e1f5 📝 Fix broken link to article: Machine learning model serving in Python using FastAPI and Streamlit (#2557) 2021-02-07 19:26:44 +01:00
github-actions
c153d9b83e 📝 Update release notes 2021-02-07 18:26:07 +00:00
vjanz
2875d88ccf 📝 Add FastAPI Medium Article: Deploy a dockerized FastAPI application to AWS (#2515)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 19:25:27 +01:00
github-actions
9e0cca828d 📝 Update release notes 2021-02-07 18:19:21 +00:00
johnthagen
5dc3ec4a65 ✏ Fix typo in Tutorial - Handling Errors (#2486) 2021-02-07 19:18:37 +01:00
github-actions
bda392cba6 📝 Update release notes 2021-02-07 18:16:26 +00:00
water_lift
f22137346a 🎨 Remove internal "type: ignore", now unnecessary (#2424) 2021-02-07 19:15:43 +01:00
github-actions
f108741a82 📝 Update release notes 2021-02-07 18:14:23 +00:00
Jürgen Gmach
8433e8efe2 ✏ Fix typo in Security OAuth2 scopes (#2407) 2021-02-07 19:13:41 +01:00
github-actions
e6a1a9e193 📝 Update release notes 2021-02-07 18:06:49 +00:00
kangni
bbb22813e6 ✏ Fix typo/clarify docs for SQL (Relational) Databases (#2393)
By way of code example, I think this is a typo. btw, the tutorial is very well written.
2021-02-07 19:06:08 +01:00
github-actions
f0f8e287ec 📝 Update release notes 2021-02-07 18:02:41 +00:00
Xie Wei
0af6cbe990 🌐 Add Chinese translation for Tutorial - Bigger Applications - Multiple Files (#2453)
Co-authored-by: Shucai.wang <blt23@126.com>
2021-02-07 19:02:00 +01:00
github-actions
9e9e068762 📝 Update release notes 2021-02-07 18:01:12 +00:00
Xie Wei
9fda0149da 🌐 Add Chinese translation for Tutorial - Security - Security Intro (#2443) 2021-02-07 19:00:14 +01:00
github-actions
95a713b3e2 📝 Update release notes 2021-02-07 17:59:55 +00:00
maoyibo
2da3d62d37 🌐 Add Chinese translation for Tutorial - Header Parameters (#2412)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:59:12 +01:00
github-actions
7dd2e92d7e 📝 Update release notes 2021-02-07 17:52:50 +00:00
maoyibo
6d06e13284 🌐 Add Chinese translation for Tutorial - Extra Data Types (#2410)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:52:09 +01:00
github-actions
a2199c545b 📝 Update release notes 2021-02-07 17:47:02 +00:00
T. Tokusumi
08cbc6c8ff 🌐 Add Japanese translation for Deployment - Docker (#2312)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:46:22 +01:00
github-actions
f730160037 📝 Update release notes 2021-02-07 17:45:09 +00:00
T. Tokusumi
20360c207e 🌐 Add Japanese translation for Deployment - Versions (#2310)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:44:28 +01:00
github-actions
568a54dff2 📝 Update release notes 2021-02-07 17:43:14 +00:00
Alicrazy
91cacc9c92 🌐 Add Chinese translation for Tutorial - Cookie Parameters (#2261)
Co-authored-by: lijun <lijun@duozhuayu.net>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:42:34 +01:00
github-actions
b3899333f4 📝 Update release notes 2021-02-07 17:41:26 +00:00
Amit Chaudhary
6b6a310e54 📝 Add external link to "FastAPI for Flask Users" (#2280) 2021-02-07 18:40:42 +01:00
github-actions
cb2dce03c0 📝 Update release notes 2021-02-07 17:38:52 +00:00
T. Tokusumi
7122687f25 🌐 Add Japanese translation for Tutorial - Static files (#2260)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:38:10 +01:00
github-actions
af6fcf1413 📝 Update release notes 2021-02-07 17:32:12 +00:00
T. Tokusumi
cd8b90a5a4 🌐 Add Japanese translation for Tutorial - Testing (#2259)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-02-07 18:31:30 +01:00
github-actions
c88fb2eef0 📝 Update release notes 2021-02-07 17:26:15 +00:00
T. Tokusumi
17781e3596 🌐 Add Japanese translation for Tutorial - Debugging (#2256)
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:25:31 +01:00
github-actions
a381642558 📝 Update release notes 2021-02-07 17:24:39 +00:00
T. Tokusumi
5828043b69 🌐 Add Japanese translation for Tutorial - Middleware (#2255)
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:23:55 +01:00
github-actions
909a81f88a 📝 Update release notes 2021-02-07 17:21:27 +00:00
T. Tokusumi
faec713e0d 🌐 Add Japanese translation for Concurrency and async / await (#2058)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sho Nakamura <sh0nk.developer@gmail.com>
2021-02-07 18:20:43 +01:00
github-actions
60addbcdd5 📝 Update release notes 2021-02-01 14:49:57 +00:00
github-actions[bot]
a27a1bc53c 👥 Update FastAPI People (#2739)
Co-authored-by: github-actions <github-actions@github.com>
2021-02-01 15:49:09 +01:00
github-actions
41f291524d 📝 Update release notes 2021-01-19 20:13:46 +00:00
Sebastián Ramírez
6b3bc7384e 🔧 Add new Gold Sponsor Talk Python 🎉 (#2673) 2021-01-19 21:12:58 +01:00
github-actions
561bbfb5d2 📝 Update release notes 2021-01-18 15:35:35 +00:00
Sebastián Ramírez
8ce1c81398 🔧 Add new Gold Sponsor vim.so 🎉 (#2669) 2021-01-18 16:34:46 +01:00
github-actions
cb40e27db2 📝 Update release notes 2021-01-09 21:24:44 +00:00
Sebastián Ramírez
f031973848 🔧 Add FastAPI user survey banner (#2623)
* 🔧 Add FastAPI user survey banner

* 🔧 Make FastAPI user survey banner open new tab
2021-01-09 22:24:03 +01:00
github-actions
307d37d85c 📝 Update release notes 2021-01-09 21:11:58 +00:00
Sebastián Ramírez
bf290fa5f0 🔧 Add new Bronze Sponsor(s) 🥉🎉 (#2622)
* 🔧 Update FastAPI People sponsors, include new Bronze Sponsor 🎉

* 📝 Update FastAPI People in Japanese
2021-01-09 22:11:15 +01:00
github-actions
26f313d524 📝 Update release notes 2021-01-09 20:55:21 +00:00
Sebastián Ramírez
73021d7261 📝 Update social links: add Discord, fix GitHub (#2621) 2021-01-09 21:54:38 +01:00
github-actions
f54fb88ad5 📝 Update release notes 2021-01-09 19:00:40 +00:00
Xie Wei
b3d2f47bc8 🌐 Add Chinese translation for Tutorial - Security - Simple OAuth2 with Password and Bearer (#2514)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:59:56 +01:00
github-actions
52f170b3fe 📝 Update release notes 2021-01-09 18:59:33 +00:00
T. Tokusumi
9442845ca5 🌐 Add Japanese translation for Deployment - Deta (#2314)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:58:52 +01:00
github-actions
fe31b0caae 📝 Update release notes 2021-01-09 18:53:47 +00:00
Xie Wei
d2ca3df033 🌐 Add Chinese translation for Tutorial - Security - Get Current User (#2474) 2021-01-09 19:53:05 +01:00
github-actions
838ea752b2 📝 Update release notes 2021-01-09 18:52:30 +00:00
T. Tokusumi
2b49b8c70a 🌐 Add Japanese translation for Deployment - Manually (#2313)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:51:42 +01:00
github-actions
05b024d61b 📝 Update release notes 2021-01-09 18:47:49 +00:00
T. Tokusumi
c7742e3c56 🌐 Add Japanese translation for Deployment - Intro (#2309)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:47:08 +01:00
github-actions
4f9104ce97 📝 Update release notes 2021-01-09 18:43:08 +00:00
T. Tokusumi
07a8f7b5b5 🌐 Add Japanese translation for FastAPI People (#2254)
Co-authored-by: Taki Komiyama <39375566+komtaki@users.noreply.github.com>
2021-01-09 19:42:24 +01:00
github-actions
f2a28f4b5b 📝 Update release notes 2021-01-09 18:41:10 +00:00
atsumi
5a4a61ca67 🌐 Add Japanese translation for Advanced - Path Operation Advanced Configuration (#2124)
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
2021-01-09 19:40:27 +01:00
github-actions
71ac76c3cd 📝 Update release notes 2021-01-09 18:39:11 +00:00
T. Tokusumi
68dca8f42d 🌐 Add Japanese translation for External Links (#2070)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:38:20 +01:00
github-actions
a38e6f4e2c 📝 Update release notes 2021-01-09 18:33:53 +00:00
SwftAlpc
ca26f2274c 🌐 Add Japanese translation for Tutorial - Body - Updates (#1956)
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:33:07 +01:00
github-actions
8108cd89bb 📝 Update release notes 2021-01-09 18:28:54 +00:00
SwftAlpc
8560151090 🌐 Add Japanese translation for Tutorial - Form Data (#1943)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:28:15 +01:00
github-actions
91805cdf03 📝 Update release notes 2021-01-09 18:20:10 +00:00
SwftAlpc
48cba16578 🌐 Add Japanese translation for Tutorial - Cookie Parameters (#1933)
Co-authored-by: ryusuke.miyaji <bluce826@gmail.com>
Co-authored-by: ryuckel <36391432+ryuckel@users.noreply.github.com>
Co-authored-by: tokusumi <tksmtoms@gmail.com>
Co-authored-by: T. Tokusumi <41147016+tokusumi@users.noreply.github.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2021-01-09 19:19:26 +01:00
github-actions
7098e3b150 📝 Update release notes 2021-01-09 16:58:08 +00:00
Sebastián Ramírez
a7cc25eb11 🔧 Update FastAPI People GitHub Sponsors order (#2620) 2021-01-09 17:57:27 +01:00
github-actions
d2eb4a71ee 📝 Update release notes 2021-01-05 21:04:05 +00:00
Sebastián Ramírez
54eeb3161f 🔧 Update InvestSuite sponsor data (#2608) 2021-01-05 22:03:24 +01:00
github-actions
4fabcfa3ab 📝 Update release notes 2021-01-01 20:15:01 +00:00
github-actions[bot]
5c29daadcc 👥 Update FastAPI People (#2590)
Co-authored-by: github-actions <github-actions@github.com>
2021-01-01 21:14:17 +01:00
172 changed files with 17073 additions and 815 deletions

View File

@@ -1,10 +1,10 @@
import logging
import subprocess
import sys
from collections import Counter
from collections import Counter, defaultdict
from datetime import datetime, timedelta, timezone
from pathlib import Path
from typing import Container, Dict, List, Optional, Set
from typing import Container, DefaultDict, Dict, List, Optional, Set
import httpx
import yaml
@@ -375,7 +375,7 @@ def get_contributors(settings: Settings):
return contributors, commentors, reviewers, authors
def get_individual_sponsors(settings: Settings, max_individual_sponsor: int = 5):
def get_individual_sponsors(settings: Settings):
nodes: List[SponsorshipAsMaintainerNode] = []
edges = get_graphql_sponsor_edges(settings=settings)
@@ -385,12 +385,12 @@ def get_individual_sponsors(settings: Settings, max_individual_sponsor: int = 5)
last_edge = edges[-1]
edges = get_graphql_sponsor_edges(settings=settings, after=last_edge.cursor)
entities: Dict[str, SponsorEntity] = {}
tiers: DefaultDict[float, Dict[str, SponsorEntity]] = defaultdict(dict)
for node in nodes:
if node.tier.monthlyPriceInDollars > max_individual_sponsor:
continue
entities[node.sponsorEntity.login] = node.sponsorEntity
return entities
tiers[node.tier.monthlyPriceInDollars][
node.sponsorEntity.login
] = node.sponsorEntity
return tiers
def get_top_users(
@@ -475,12 +475,22 @@ if __name__ == "__main__":
skip_users=skip_users,
)
sponsors_by_login = get_individual_sponsors(settings=settings)
sponsors = []
for login, sponsor in sponsors_by_login.items():
sponsors.append(
tiers = get_individual_sponsors(settings=settings)
sponsors_50 = []
for login, sponsor in tiers[50].items():
sponsors_50.append(
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
)
keys = list(tiers.keys())
keys.sort(reverse=True)
sponsors = []
for key in keys:
if key >= 50:
continue
for login, sponsor in tiers[key].items():
sponsors.append(
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
)
people = {
"maintainers": maintainers,
@@ -488,6 +498,7 @@ if __name__ == "__main__":
"last_month_active": last_month_active,
"top_contributors": top_contributors,
"top_reviewers": top_reviewers,
"sponsors_50": sponsors_50,
"sponsors": sponsors,
}
people_path = Path("./docs/en/data/people.yml")

View File

@@ -4,7 +4,7 @@ on:
pull_request:
types: [opened, synchronize]
jobs:
build:
build-docs:
runs-on: ubuntu-18.04
steps:
- name: Dump GitHub context
@@ -13,15 +13,22 @@ jobs:
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.7"
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m pip install flit
- name: Install docs extras
run: python3.7 -m flit install --extras doc
if: steps.cache.outputs.cache-hit != 'true'
run: python3.7 -m flit install --deps production --extras doc
- name: Install Material for MkDocs Insiders
if: github.event.pull_request.head.repo.fork == false
if: github.event.pull_request.head.repo.fork == false && steps.cache.outputs.cache-hit != 'true'
run: pip install git+https://${{ secrets.ACTIONS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
- name: Build Docs
run: python3.7 ./scripts/docs.py build-all

View File

@@ -6,23 +6,25 @@ on:
issue_comment:
types:
- created
- edited
issues:
types:
- labeled
pull_request_target:
types:
- labeled
workflow_dispatch:
jobs:
issue-manager:
runs-on: ubuntu-latest
steps:
- uses: tiangolo/issue-manager@0.2.0
- uses: tiangolo/issue-manager@0.4.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
config: >
{
"answered": {
"users": ["tiangolo", "dmontagu"],
"delay": 864000,
"message": "Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues."
"message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs."
}
}

View File

@@ -11,12 +11,27 @@ on:
number:
description: PR number
required: true
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
latest-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# To allow latest-changes to commit to master
token: ${{ secrets.ACTIONS_TOKEN }}
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
limit-access-to-actor: true
token: ${{ secrets.ACTIONS_TOKEN }}
standard_token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker://tiangolo/latest-changes:0.0.3
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -4,12 +4,25 @@ on:
schedule:
- cron: "0 14 1 * *"
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
fastapi-people:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Allow debugging with tmate
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
limit-access-to-actor: true
token: ${{ secrets.ACTIONS_TOKEN }}
standard_token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/people
with:
token: ${{ secrets.ACTIONS_TOKEN }}

View File

@@ -7,7 +7,7 @@ on:
- completed
jobs:
deploy:
preview-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

View File

@@ -15,12 +15,19 @@ jobs:
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.6"
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Publish
env:

View File

@@ -16,12 +16,19 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test
- name: Install Flit
if: steps.cache.outputs.cache-hit != 'true'
run: pip install flit
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: flit install --symlink
- name: Test
run: bash scripts/test.sh

View File

@@ -40,12 +40,15 @@ The key features are:
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
<a href="https://www.deta.sh/?ref=fastapi" target="_blank" title="The launchpad for all your (team's) ideas"><img src="https://fastapi.tiangolo.com/img/sponsors/deta.svg"></a>
<a href="https://www.investsuite.com/" target="_blank" title="Wealthtech as a service"><img src="https://fastapi.tiangolo.com/img/sponsors/investsuite.svg"></a>
<a href="https://bit.ly/2QSouzH" target="_blank" title="Jina: build neural search-as-a-service for any kind of data in just minutes."><img src="https://fastapi.tiangolo.com/img/sponsors/jina.svg"></a>
<a href="https://www.investsuite.com/jobs" target="_blank" title="Wealthtech jobs with FastAPI"><img src="https://fastapi.tiangolo.com/img/sponsors/investsuite.svg"></a>
<a href="https://www.vim.so/?utm_source=FastAPI" target="_blank" title="We help you master vim with interactive exercises"><img src="https://fastapi.tiangolo.com/img/sponsors/vimso.png"></a>
<a href="https://talkpython.fm/fastapi-sponsor" target="_blank" title="FastAPI video courses on demand from people you trust"><img src="https://fastapi.tiangolo.com/img/sponsors/talkpython.png"></a>
<!-- /sponsors -->

31
SECURITY.md Normal file
View File

@@ -0,0 +1,31 @@
# Security Policy
Security is very important for FastAPI and its community. 🔒
Learn more about it below. 👇
## Versions
The latest versions of FastAPI are supported.
You are encouraged to [write tests](https://fastapi.tiangolo.com/tutorial/testing/) for your application and update your FastAPI version frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**.
You can learn more about [FastAPI versions and how to pin and upgrade them](https://fastapi.tiangolo.com/deployment/versions/) for your project in the docs.
## Reporting a Vulnerability
If you think you found a vulnerability, and even if you are not sure about it, please report it right away by sending an email to: security@tiangolo.com. Please try to be as explicit as possible, describing all the steps and example code to reproduce the security issue.
I (the author, [@tiangolo](https://twitter.com/tiangolo)) will review it thoroughly and get back to you.
## Public Discussions
Please restrain from publicly discussing a potential security vulnerability. 🙊
It's better to discuss privately and try to find a solution first, to limit the potential impact as much as possible.
---
Thanks for your help!
The FastAPI community and I thank you for that. 🙇

467
docs/de/docs/index.md Normal file
View File

@@ -0,0 +1,467 @@
{!../../../docs/missing-translation.md!}
<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 framework, high performance, easy to learn, fast to code, ready for production</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>
---
**Documentation**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a>
**Source Code**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
---
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:
* **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. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> 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: <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (previously known as Swagger) and <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>.
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Sponsors
<!-- 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">Other sponsors</a>
## 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._"
<div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
---
"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
<div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div>
---
"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
<div style="text-align: right; margin-right: 10%;">Kevin Glisson, Marc Vilanova, Forest Monsen - <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072" target="_blank"><small>(ref)</small></a></div>
---
"_Im over the moon excited about **FastAPI**. Its so fun!_"
<div style="text-align: right; margin-right: 10%;">Brian Okken - <strong><a href="https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855" target="_blank">Python Bytes</a> podcast host</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div>
---
"_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._"
<div style="text-align: right; margin-right: 10%;">Timothy Crosley - <strong><a href="https://www.hug.rest/" target="_blank">Hug</a> creator</strong> <a href="https://news.ycombinator.com/item?id=19455465" target="_blank"><small>(ref)</small></a></div>
---
"_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 [...]_"
"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
<div style="text-align: right; margin-right: 10%;">Ines Montani - Matthew Honnibal - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> founders - <a href="https://spacy.io" target="_blank">spaCy</a> creators</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**, the FastAPI of CLIs
<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>
If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
## Requirements
Python 3.6+
FastAPI stands on the shoulders of giants:
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
## Installation
<div class="termy">
```console
$ pip install fastapi
---> 100%
```
</div>
You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
## Example
### Create it
* Create a file `main.py` with:
```Python
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
<details markdown="1">
<summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`:
```Python hl_lines="9 14"
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
**Note**:
If you don't know, check the _"In a hurry?"_ section about <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` and `await` in the docs</a>.
</details>
### Run it
Run the server with:
<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>About the command <code>uvicorn main:app --reload</code>...</summary>
The command `uvicorn main:app` refers to:
* `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.
</details>
### Check it
Open your browser at <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>.
You will see the JSON response as:
```JSON
{"item_id": 5, "q": "somequery"}
```
You already created an API that:
* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
* Both _paths_ take `GET` <em>operations</em> (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`.
### Interactive API docs
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Example upgrade
Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Optional[bool] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = 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}
```
The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
### Interactive API docs upgrade
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
* The interactive API documentation will be automatically updated, including the new body:
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
* 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:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
### Alternative API docs upgrade
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
* The alternative documentation will also reflect the new query parameter and body:
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Recap
In summary, you declare **once** the types of parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
Just standard **Python 3.6+**.
For example, for an `int`:
```Python
item_id: int
```
or for a more complex `Item` model:
```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.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of input data: coming from the network to Python data and types. Reading from:
* JSON.
* Path parameters.
* Query parameters.
* Cookies.
* Headers.
* Forms.
* Files.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> 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:
* 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.
---
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:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
**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 **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** 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`
* **CORS**
* **Cookie Sessions**
* ...and more.
## Performance
Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <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">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
## Optional Dependencies
Used by Pydantic:
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - for faster 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> - for email validation.
Used by Starlette:
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://github.com/Tinche/aiofiles" target="_blank"><code>aiofiles</code></a> - Required if you want to use `FileResponse` or `StaticFiles`.
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
* <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
* <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - Required for `GraphQLApp` support.
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
Used by FastAPI / Starlette:
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
You can install all of these with `pip install fastapi[all]`.
## License
This project is licensed under the terms of the MIT license.

125
docs/de/mkdocs.yml Normal file
View File

@@ -0,0 +1,125 @@
site_name: FastAPI
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
site_url: https://fastapi.tiangolo.com/de/
theme:
name: material
custom_dir: overrides
palette:
- scheme: default
primary: teal
accent: amber
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
- scheme: slate
primary: teal
accent: amber
toggle:
icon: material/lightbulb
name: Switch to dark mode
features:
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github-alt
logo: https://fastapi.tiangolo.com/img/icon-white.svg
favicon: https://fastapi.tiangolo.com/img/favicon.png
language: de
repo_name: tiangolo/fastapi
repo_url: https://github.com/tiangolo/fastapi
edit_uri: ''
google_analytics:
- UA-133183413-1
- auto
plugins:
- search
- markdownextradata:
data: data
nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
markdown_extensions:
- toc:
permalink: true
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- extra
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_div_format ''
- pymdownx.tabbed
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/tiangolo
- icon: fontawesome/brands/dev
link: https://dev.to/tiangolo
- icon: fontawesome/brands/medium
link: https://medium.com/@tiangolo
- icon: fontawesome/solid/globe
link: https://tiangolo.com
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/
name: ru - русский язык
- link: /sq/
name: sq - shqip
- link: /tr/
name: tr - Türkçe
- link: /uk/
name: uk - українська мова
- link: /zh/
name: zh - 汉语
extra_css:
- https://fastapi.tiangolo.com/css/termynal.css
- https://fastapi.tiangolo.com/css/custom.css
extra_javascript:
- https://unpkg.com/mermaid@8.4.6/dist/mermaid.min.js
- https://fastapi.tiangolo.com/js/termynal.js
- https://fastapi.tiangolo.com/js/custom.js

0
docs/de/overrides/.gitignore vendored Normal file
View File

View File

@@ -1,242 +1,278 @@
articles:
english:
- link: https://medium.com/@williamhayes/fastapi-starlette-debug-vs-prod-5f7561db3a59
title: FastAPI/Starlette debug vs prod
author_link: https://medium.com/@williamhayes
author: William Hayes
- link: https://medium.com/data-rebels/fastapi-google-as-an-external-authentication-provider-3a527672cf33
title: FastAPIGoogle as an external authentication provider
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://medium.com/data-rebels/fastapi-how-to-add-basic-and-cookie-authentication-a45c85ef47d3
title: FastAPIHow to add basic and cookie authentication
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://dev.to/errietta/introduction-to-the-fastapi-python-framework-2n10
title: Introduction to the fastapi python framework
author_link: https://dev.to/errietta
author: Errieta Kostala
- link: https://nickc1.github.io/api,/scikit-learn/2019/01/10/scikit-fastapi.html
title: "FastAPI and Scikit-Learn: Easily Deploy Models"
author_link: https://nickc1.github.io/
author: Nick Cortale
- link: https://medium.com/data-rebels/fastapi-authentication-revisited-enabling-api-key-authentication-122dc5975680
title: "FastAPI authentication revisited: Enabling API key authentication"
author_link: https://medium.com/@nilsdebruin
author: Nils de Bruin
- link: https://medium.com/@nico.axtmann95/deploying-a-scikit-learn-model-with-onnx-und-fastapi-1af398268915
title: Deploying a scikit-learn model with ONNX and FastAPI
author_link: https://www.linkedin.com/in/nico-axtmann
author: Nico Axtmann
- link: https://geekflare.com/python-asynchronous-web-frameworks/
title: Top 5 Asynchronous Web Frameworks for Python
author_link: https://geekflare.com/author/ankush/
author: Ankush Thakur
- link: https://medium.com/@gntrm/jwt-authentication-with-fastapi-and-aws-cognito-1333f7f2729e
title: JWT Authentication with FastAPI and AWS Cognito
author_link: https://twitter.com/gntrm
author: Johannes Gontrum
- link: https://towardsdatascience.com/how-to-deploy-a-machine-learning-model-dc51200fe8cf
title: How to Deploy a Machine Learning Model
author_link: https://www.linkedin.com/in/mgrootendorst/
author: Maarten Grootendorst
- link: https://eng.uber.com/ludwig-v0-2/
title: "Uber: Ludwig v0.2 Adds New Features and Other Improvements to its Deep Learning Toolbox [including a FastAPI server]"
author_link: https://eng.uber.com
author: Uber Engineering
- link: https://gitlab.com/euri10/fastapi_cheatsheet
title: A FastAPI and Swagger UI visual cheatsheet
author_link: https://gitlab.com/euri10
author: "@euri10"
- link: https://medium.com/@mike.p.moritz/using-docker-compose-to-deploy-a-lightweight-python-rest-api-with-a-job-queue-37e6072a209b
title: Using Docker Compose to deploy a lightweight Python REST API with a job queue
author_link: https://medium.com/@mike.p.moritz
author: Mike Moritz
- link: https://robwagner.dev/tortoise-fastapi-setup/
title: Setting up Tortoise ORM with FastAPI
author_link: https://robwagner.dev/
author: Rob Wagner
- link: https://dev.to/dbanty/why-i-m-leaving-flask-3ki6
title: Why I'm Leaving Flask
author_link: https://dev.to/dbanty
author: Dylan Anthony
- link: https://medium.com/python-data/how-to-deploy-tensorflow-2-0-models-as-an-api-service-with-fastapi-docker-128b177e81f3
title: How To Deploy Tensorflow 2.0 Models As An API Service With FastAPI & Docker
author_link: https://medium.com/@bbrenyah
author: Bernard Brenyah
- link: https://testdriven.io/blog/fastapi-crud/
title: "TestDriven.io: Developing and Testing an Asynchronous API with FastAPI and Pytest"
author_link: https://testdriven.io/authors/herman
author: Michael Herman
- link: https://towardsdatascience.com/deploying-iris-classifications-with-fastapi-and-docker-7c9b83fdec3a
title: "Towards Data Science: Deploying Iris Classifications with FastAPI and Docker"
author_link: https://towardsdatascience.com/@mandygu
author: Mandy Gu
- link: https://medium.com/analytics-vidhya/deploy-machine-learning-models-with-keras-fastapi-redis-and-docker-4940df614ece
title: Deploy Machine Learning Models with Keras, FastAPI, Redis and Docker
author_link: https://medium.com/@shane.soh
author: Shane Soh
- link: https://medium.com/@arthur393/another-boilerplate-to-fastapi-azure-pipeline-ci-pytest-3c8d9a4be0bb
title: "Another Boilerplate to FastAPI: Azure Pipeline CI + Pytest"
author_link: https://twitter.com/arthurheinrique
author: Arthur Henrique
- link: https://iwpnd.pw/articles/2020-01/deploy-fastapi-to-aws-lambda
title: How to continuously deploy a FastAPI to AWS Lambda with AWS SAM
author_link: https://iwpnd.pw
author: Benjamin Ramser
- link: https://www.tutlinks.com/create-and-deploy-fastapi-app-to-heroku/
title: Create and Deploy FastAPI app to Heroku without using Docker
author_link: https://www.linkedin.com/in/navule/
author: Navule Pavan Kumar Rao
- link: https://iwpnd.pw/articles/2020-03/apache-kafka-fastapi-geostream
title: Apache Kafka producer and consumer with FastAPI and aiokafka
author_link: https://iwpnd.pw
author: Benjamin Ramser
- link: https://wuilly.com/2019/10/real-time-notifications-with-python-and-postgres/
title: Real-time Notifications with Python and Postgres
author_link: https://wuilly.com/
author: Guillermo Cruz
- link: https://dev.to/paurakhsharma/microservice-in-python-using-fastapi-24cc
title: Microservice in Python using FastAPI
author_link: https://twitter.com/PaurakhSharma
author: Paurakh Sharma Humagain
- link: https://dev.to/cuongld2/build-simple-api-service-with-python-fastapi-part-1-581o
title: Build simple API service with Python FastAPI — Part 1
author_link: https://dev.to/cuongld2
author: cuongld2
- link: https://paulsec.github.io/posts/fastapi_plus_zeit_serverless_fu/
title: FastAPI + Zeit.co = 🚀
author_link: https://twitter.com/PaulWebSec
author: Paul Sec
- link: https://dev.to/tiangolo/build-a-web-api-from-scratch-with-fastapi-the-workshop-2ehe
title: Build a web API from scratch with FastAPI - the workshop
author_link: https://twitter.com/tiangolo
author: Sebastián Ramírez (tiangolo)
- link: https://www.twilio.com/blog/build-secure-twilio-webhook-python-fastapi
title: Build a Secure Twilio Webhook with Python and FastAPI
author_link: https://www.twilio.com
author: Twilio
- link: https://www.stavros.io/posts/fastapi-with-django/
title: Using FastAPI with Django
author_link: https://twitter.com/Stavros
author: Stavros Korokithakis
- link: https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072
title: Introducing Dispatch
author_link: https://netflixtechblog.com/
author: Netflix
- link: https://davidefiocco.github.io/2020/06/27/streamlit-fastapi-ml-serving.html
title: Machine learning model serving in Python using FastAPI and streamlit
author_link: https://github.com/davidefiocco
author: Davide Fiocco
- link: https://www.tutlinks.com/deploy-fastapi-on-azure/
title: Deploy FastAPI on Azure App Service
author_link: https://www.linkedin.com/in/navule/
author: Navule Pavan Kumar Rao
- link: https://towardsdatascience.com/build-and-host-fast-data-science-applications-using-fastapi-823be8a1d6a0
title: Build And Host Fast Data Science Applications Using FastAPI
author_link: https://medium.com/@farhadmalik
author: Farhad Malik
- link: https://medium.com/@gabbyprecious2000/creating-a-crud-app-with-fastapi-part-one-7c049292ad37
title: Creating a CRUD App with FastAPI (Part one)
author_link: https://medium.com/@gabbyprecious2000
author: Precious Ndubueze
- link: https://julienharbulot.com/notification-server.html
title: HTTP server to display desktop notifications
author_link: https://julienharbulot.com/
author: Julien Harbulot
- link: https://guitton.co/posts/fastapi-monitoring/
title: How to monitor your FastAPI service
author_link: https://twitter.com/louis_guitton
author: Louis Guitton
japanese:
- link: https://qiita.com/mtitg/items/47770e9a562dd150631d
title: FastAPIDB接続してCRUDするPython製APIサーバーを構築
author_link: https://qiita.com/mtitg
author: "@mtitg"
- link: https://qiita.com/ryoryomaru/items/59958ed385b3571d50de
title: python製の最新APIフレームワーク FastAPI を触ってみた
author_link: https://qiita.com/ryoryomaru
author: "@ryoryomaru"
- link: https://qiita.com/angel_katayoku/items/0e1f5dbbe62efc612a78
title: FastAPIでCORSを回避
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/angel_katayoku/items/4fbc1a4e2b33fa2237d2
title: FastAPIをMySQLと接続してDockerで管理してみる
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/angel_katayoku/items/8a458a8952f50b73f420
title: FastAPIでPOSTされたJSONのレスポンスbodyを受け取る
author_link: https://qiita.com/angel_katayoku
author: "@angel_katayoku"
- link: https://qiita.com/hikarut/items/b178af2e2440c67c6ac4
title: フロントエンド開発者向けのDockerによるPython開発環境構築
author_link: https://qiita.com/hikarut
author: Hikaru Takahashi
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-environment
title: "【第1回】FastAPIチュートリアル: ToDoアプリを作ってみよう【環境構築編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-model-building
title: "【第2回】FastAPIチュートリアル: ToDoアプリを作ってみよう【モデル構築編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-authentication-user-registration
title: "【第3回】FastAPIチュートリアル: toDoアプリを作ってみよう【認証・ユーザ登録編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-admin-page-improvement
title: "【第4回】FastAPIチュートリアル: toDoアプリを作ってみよう【管理者ページ改良編】"
author_link: https://rightcode.co.jp/author/jun
author: ライトコードメディア編集部
- link: https://qiita.com/bee2/items/0ad260ab9835a2087dae
title: PythonのWeb frameworkのパフォーマンス比較 (Django, Flask, responder, FastAPI, japronto)
author_link: https://qiita.com/bee2
author: "@bee2"
- link: https://qiita.com/bee2/items/75d9c0d7ba20e7a4a0e9
title: "[FastAPI] Python製のASGI Web フレームワーク FastAPIに入門する"
author_link: https://qiita.com/bee2
author: "@bee2"
vietnamese:
- link: https://fullstackstation.com/fastapi-trien-khai-bang-docker/
title: "FASTAPI: TRIỂN KHAI BẰNG DOCKER"
author_link: https://fullstackstation.com/author/figonking/
author: Nguyễn Nhân
russian:
- link: https://habr.com/ru/post/454440/
title: "Мелкая питонячая радость #2: Starlette - Солидная примочка FastAPI"
author_link: https://habr.com/ru/users/57uff3r/
author: Andrey Korchak
- link: https://habr.com/ru/post/478620/
title: Почему Вы должны попробовать FastAPI?
author_link: https://github.com/prostomarkeloff
author: prostomarkeloff
- author: "@pystar"
author_link: https://pystar.substack.com/
link: https://pystar.substack.com/p/how-to-create-a-fake-certificate
title: How to Create A Fake Certificate Authority And Generate TLS Certs for FastAPI
- author: Shahriyar(Shako) Rzayev
author_link: https://www.linkedin.com/in/shahriyar-rzayev/
link: https://www.azepug.az/posts/fastapi/#building-simple-e-commerce-with-nuxtjs-and-fastapi-series
title: Building simple E-Commerce with NuxtJS and FastAPI
- author: Rodrigo Arenas
author_link: https://rodrigo-arenas.medium.com/
link: https://medium.com/analytics-vidhya/serve-a-machine-learning-model-using-sklearn-fastapi-and-docker-85aabf96729b
title: "Serve a machine learning model using Sklearn, FastAPI and Docker"
- author: Navule Pavan Kumar Rao
author_link: https://www.linkedin.com/in/navule/
link: https://www.tutlinks.com/deploy-fastapi-on-ubuntu-gunicorn-caddy-2/
title: Deploy FastAPI on Ubuntu and Serve using Caddy 2 Web Server
- author: Patrick Ladon
author_link: https://dev.to/factorlive
link: https://dev.to/factorlive/python-facebook-messenger-webhook-with-fastapi-on-glitch-4n90
title: Python Facebook messenger webhook with FastAPI on Glitch
- author: Dom Patmore
author_link: https://twitter.com/dompatmore
link: https://dompatmore.com/blog/authenticate-your-fastapi-app-with-auth0
title: Authenticate Your FastAPI App with auth0
- author: Valon Januzaj
author_link: https://www.linkedin.com/in/valon-januzaj-b02692187/
link: https://valonjanuzaj.medium.com/deploy-a-dockerized-fastapi-application-to-aws-cc757830ba1b
title: Deploy a dockerized FastAPI application to AWS
- author: Amit Chaudhary
author_link: https://twitter.com/amitness
link: https://amitness.com/2020/06/fastapi-vs-flask/
title: FastAPI for Flask Users
- author: Louis Guitton
author_link: https://twitter.com/louis_guitton
link: https://guitton.co/posts/fastapi-monitoring/
title: How to monitor your FastAPI service
- author: Julien Harbulot
author_link: https://julienharbulot.com/
link: https://julienharbulot.com/notification-server.html
title: HTTP server to display desktop notifications
- author: Precious Ndubueze
author_link: https://medium.com/@gabbyprecious2000
link: https://medium.com/@gabbyprecious2000/creating-a-crud-app-with-fastapi-part-one-7c049292ad37
title: Creating a CRUD App with FastAPI (Part one)
- author: Farhad Malik
author_link: https://medium.com/@farhadmalik
link: https://towardsdatascience.com/build-and-host-fast-data-science-applications-using-fastapi-823be8a1d6a0
title: Build And Host Fast Data Science Applications Using FastAPI
- author: Navule Pavan Kumar Rao
author_link: https://www.linkedin.com/in/navule/
link: https://www.tutlinks.com/deploy-fastapi-on-azure/
title: Deploy FastAPI on Azure App Service
- author: Davide Fiocco
author_link: https://github.com/davidefiocco
link: https://davidefiocco.github.io/streamlit-fastapi-ml-serving/
title: Machine learning model serving in Python using FastAPI and streamlit
- author: Netflix
author_link: https://netflixtechblog.com/
link: https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072
title: Introducing Dispatch
- author: Stavros Korokithakis
author_link: https://twitter.com/Stavros
link: https://www.stavros.io/posts/fastapi-with-django/
title: Using FastAPI with Django
- author: Twilio
author_link: https://www.twilio.com
link: https://www.twilio.com/blog/build-secure-twilio-webhook-python-fastapi
title: Build a Secure Twilio Webhook with Python and FastAPI
- author: Sebastián Ramírez (tiangolo)
author_link: https://twitter.com/tiangolo
link: https://dev.to/tiangolo/build-a-web-api-from-scratch-with-fastapi-the-workshop-2ehe
title: Build a web API from scratch with FastAPI - the workshop
- author: Paul Sec
author_link: https://twitter.com/PaulWebSec
link: https://paulsec.github.io/posts/fastapi_plus_zeit_serverless_fu/
title: FastAPI + Zeit.co = 🚀
- author: cuongld2
author_link: https://dev.to/cuongld2
link: https://dev.to/cuongld2/build-simple-api-service-with-python-fastapi-part-1-581o
title: Build simple API service with Python FastAPI — Part 1
- author: Paurakh Sharma Humagain
author_link: https://twitter.com/PaurakhSharma
link: https://dev.to/paurakhsharma/microservice-in-python-using-fastapi-24cc
title: Microservice in Python using FastAPI
- author: Guillermo Cruz
author_link: https://wuilly.com/
link: https://wuilly.com/2019/10/real-time-notifications-with-python-and-postgres/
title: Real-time Notifications with Python and Postgres
- author: Benjamin Ramser
author_link: https://iwpnd.pw
link: https://iwpnd.pw/articles/2020-03/apache-kafka-fastapi-geostream
title: Apache Kafka producer and consumer with FastAPI and aiokafka
- author: Navule Pavan Kumar Rao
author_link: https://www.linkedin.com/in/navule/
link: https://www.tutlinks.com/create-and-deploy-fastapi-app-to-heroku/
title: Create and Deploy FastAPI app to Heroku without using Docker
- author: Benjamin Ramser
author_link: https://iwpnd.pw
link: https://iwpnd.pw/articles/2020-01/deploy-fastapi-to-aws-lambda
title: How to continuously deploy a FastAPI to AWS Lambda with AWS SAM
- author: Arthur Henrique
author_link: https://twitter.com/arthurheinrique
link: https://medium.com/@arthur393/another-boilerplate-to-fastapi-azure-pipeline-ci-pytest-3c8d9a4be0bb
title: 'Another Boilerplate to FastAPI: Azure Pipeline CI + Pytest'
- author: Shane Soh
author_link: https://medium.com/@shane.soh
link: https://medium.com/analytics-vidhya/deploy-machine-learning-models-with-keras-fastapi-redis-and-docker-4940df614ece
title: Deploy Machine Learning Models with Keras, FastAPI, Redis and Docker
- author: Mandy Gu
author_link: https://towardsdatascience.com/@mandygu
link: https://towardsdatascience.com/deploying-iris-classifications-with-fastapi-and-docker-7c9b83fdec3a
title: 'Towards Data Science: Deploying Iris Classifications with FastAPI and Docker'
- author: Michael Herman
author_link: https://testdriven.io/authors/herman
link: https://testdriven.io/blog/fastapi-crud/
title: 'TestDriven.io: Developing and Testing an Asynchronous API with FastAPI and Pytest'
- author: Bernard Brenyah
author_link: https://medium.com/@bbrenyah
link: https://medium.com/python-data/how-to-deploy-tensorflow-2-0-models-as-an-api-service-with-fastapi-docker-128b177e81f3
title: How To Deploy Tensorflow 2.0 Models As An API Service With FastAPI & Docker
- author: Dylan Anthony
author_link: https://dev.to/dbanty
link: https://dev.to/dbanty/why-i-m-leaving-flask-3ki6
title: Why I'm Leaving Flask
- author: Rob Wagner
author_link: https://robwagner.dev/
link: https://robwagner.dev/tortoise-fastapi-setup/
title: Setting up Tortoise ORM with FastAPI
- author: Mike Moritz
author_link: https://medium.com/@mike.p.moritz
link: https://medium.com/@mike.p.moritz/using-docker-compose-to-deploy-a-lightweight-python-rest-api-with-a-job-queue-37e6072a209b
title: Using Docker Compose to deploy a lightweight Python REST API with a job queue
- author: '@euri10'
author_link: https://gitlab.com/euri10
link: https://gitlab.com/euri10/fastapi_cheatsheet
title: A FastAPI and Swagger UI visual cheatsheet
- author: Uber Engineering
author_link: https://eng.uber.com
link: https://eng.uber.com/ludwig-v0-2/
title: 'Uber: Ludwig v0.2 Adds New Features and Other Improvements to its Deep Learning Toolbox [including a FastAPI server]'
- author: Maarten Grootendorst
author_link: https://www.linkedin.com/in/mgrootendorst/
link: https://towardsdatascience.com/how-to-deploy-a-machine-learning-model-dc51200fe8cf
title: How to Deploy a Machine Learning Model
- author: Johannes Gontrum
author_link: https://twitter.com/gntrm
link: https://medium.com/@gntrm/jwt-authentication-with-fastapi-and-aws-cognito-1333f7f2729e
title: JWT Authentication with FastAPI and AWS Cognito
- author: Ankush Thakur
author_link: https://geekflare.com/author/ankush/
link: https://geekflare.com/python-asynchronous-web-frameworks/
title: Top 5 Asynchronous Web Frameworks for Python
- author: Nico Axtmann
author_link: https://www.linkedin.com/in/nico-axtmann
link: https://medium.com/@nico.axtmann95/deploying-a-scikit-learn-model-with-onnx-und-fastapi-1af398268915
title: Deploying a scikit-learn model with ONNX and FastAPI
- author: Nils de Bruin
author_link: https://medium.com/@nilsdebruin
link: https://medium.com/data-rebels/fastapi-authentication-revisited-enabling-api-key-authentication-122dc5975680
title: 'FastAPI authentication revisited: Enabling API key authentication'
- author: Nick Cortale
author_link: https://nickc1.github.io/
link: https://nickc1.github.io/api,/scikit-learn/2019/01/10/scikit-fastapi.html
title: 'FastAPI and Scikit-Learn: Easily Deploy Models'
- author: Errieta Kostala
author_link: https://dev.to/errietta
link: https://dev.to/errietta/introduction-to-the-fastapi-python-framework-2n10
title: Introduction to the fastapi python framework
- author: Nils de Bruin
author_link: https://medium.com/@nilsdebruin
link: https://medium.com/data-rebels/fastapi-how-to-add-basic-and-cookie-authentication-a45c85ef47d3
title: FastAPIHow to add basic and cookie authentication
- author: Nils de Bruin
author_link: https://medium.com/@nilsdebruin
link: https://medium.com/data-rebels/fastapi-google-as-an-external-authentication-provider-3a527672cf33
title: FastAPIGoogle as an external authentication provider
- author: William Hayes
author_link: https://medium.com/@williamhayes
link: https://medium.com/@williamhayes/fastapi-starlette-debug-vs-prod-5f7561db3a59
title: FastAPI/Starlette debug vs prod
german:
- link: https://blog.codecentric.de/2019/08/inbetriebnahme-eines-scikit-learn-modells-mit-onnx-und-fastapi/
title: Inbetriebnahme eines scikit-learn-Modells mit ONNX und FastAPI
author_link: https://twitter.com/_nicoax
author: Nico Axtmann
- author: Nico Axtmann
author_link: https://twitter.com/_nicoax
link: https://blog.codecentric.de/2019/08/inbetriebnahme-eines-scikit-learn-modells-mit-onnx-und-fastapi/
title: Inbetriebnahme eines scikit-learn-Modells mit ONNX und FastAPI
japanese:
- author: '@bee2'
author_link: https://qiita.com/bee2
link: https://qiita.com/bee2/items/75d9c0d7ba20e7a4a0e9
title: '[FastAPI] Python製のASGI Web フレームワーク FastAPIに入門する'
- author: '@bee2'
author_link: https://qiita.com/bee2
link: https://qiita.com/bee2/items/0ad260ab9835a2087dae
title: PythonのWeb frameworkのパフォーマンス比較 (Django, Flask, responder, FastAPI, japronto)
- author: ライトコードメディア編集部
author_link: https://rightcode.co.jp/author/jun
link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-admin-page-improvement
title: '【第4回】FastAPIチュートリアル: toDoアプリを作ってみよう【管理者ページ改良編】'
- author: ライトコードメディア編集部
author_link: https://rightcode.co.jp/author/jun
link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-authentication-user-registration
title: '【第3回】FastAPIチュートリアル: toDoアプリを作ってみよう【認証・ユーザ登録編】'
- author: ライトコードメディア編集部
author_link: https://rightcode.co.jp/author/jun
link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-model-building
title: '【第2回】FastAPIチュートリアル: ToDoアプリを作ってみよう【モデル構築編】'
- author: ライトコードメディア編集部
author_link: https://rightcode.co.jp/author/jun
link: https://rightcode.co.jp/blog/information-technology/fastapi-tutorial-todo-apps-environment
title: '【第1回】FastAPIチュートリアル: ToDoアプリを作ってみよう【環境構築編】'
- author: Hikaru Takahashi
author_link: https://qiita.com/hikarut
link: https://qiita.com/hikarut/items/b178af2e2440c67c6ac4
title: フロントエンド開発者向けのDockerによるPython開発環境構築
- author: '@angel_katayoku'
author_link: https://qiita.com/angel_katayoku
link: https://qiita.com/angel_katayoku/items/8a458a8952f50b73f420
title: FastAPIでPOSTされたJSONのレスポンスbodyを受け取る
- author: '@angel_katayoku'
author_link: https://qiita.com/angel_katayoku
link: https://qiita.com/angel_katayoku/items/4fbc1a4e2b33fa2237d2
title: FastAPIをMySQLと接続してDockerで管理してみる
- author: '@angel_katayoku'
author_link: https://qiita.com/angel_katayoku
link: https://qiita.com/angel_katayoku/items/0e1f5dbbe62efc612a78
title: FastAPIでCORSを回避
- author: '@ryoryomaru'
author_link: https://qiita.com/ryoryomaru
link: https://qiita.com/ryoryomaru/items/59958ed385b3571d50de
title: python製の最新APIフレームワーク FastAPI を触ってみた
- author: '@mtitg'
author_link: https://qiita.com/mtitg
link: https://qiita.com/mtitg/items/47770e9a562dd150631d
title: FastAPIDB接続してCRUDするPython製APIサーバーを構築
russian:
- author: Troy Köhler
author_link: https://www.linkedin.com/in/trkohler/
link: https://trkohler.com/fast-api-introduction-to-framework
title: 'FastAPI: знакомимся с фреймворком'
- author: prostomarkeloff
author_link: https://github.com/prostomarkeloff
link: https://habr.com/ru/post/478620/
title: Почему Вы должны попробовать FastAPI?
- author: Andrey Korchak
author_link: https://habr.com/ru/users/57uff3r/
link: https://habr.com/ru/post/454440/
title: 'Мелкая питонячая радость #2: Starlette - Солидная примочка FastAPI'
vietnamese:
- author: Nguyễn Nhân
author_link: https://fullstackstation.com/author/figonking/
link: https://fullstackstation.com/fastapi-trien-khai-bang-docker/
title: 'FASTAPI: TRIỂN KHAI BẰNG DOCKER'
podcasts:
english:
- link: https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855
title: FastAPI on PythonBytes
author_link: https://pythonbytes.fm/
author: Python Bytes FM
- link: https://www.pythonpodcast.com/fastapi-web-application-framework-episode-259/
title: "Build The Next Generation Of Python Web Applications With FastAPI - Episode 259 - interview to Sebastían Ramírez (tiangolo)"
author_link: https://www.pythonpodcast.com/
author: Podcast.`__init__`
- author: Podcast.`__init__`
author_link: https://www.pythonpodcast.com/
link: https://www.pythonpodcast.com/fastapi-web-application-framework-episode-259/
title: Build The Next Generation Of Python Web Applications With FastAPI - Episode 259 - interview to Sebastían Ramírez (tiangolo)
- author: Python Bytes FM
author_link: https://pythonbytes.fm/
link: https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855
title: FastAPI on PythonBytes
talks:
english:
- link: https://www.youtube.com/watch?v=3DLwPcrE5mA
title: "PyCon UK 2019: FastAPI from the ground up"
author_link: https://twitter.com/chriswithers13
author: Chris Withers
- link: https://www.youtube.com/watch?v=z9K5pwb0rt8
title: "PyConBY 2020: Serve ML models easily with FastAPI"
author_link: https://twitter.com/tiangolo
author: "Sebastián Ramírez (tiangolo)"
- link: https://www.youtube.com/watch?v=PnpTY1f4k2U
title: "[VIRTUAL] Py.Amsterdam's flying Software Circus: Intro to FastAPI"
author_link: https://twitter.com/tiangolo
author: "Sebastián Ramírez (tiangolo)"
- author: Sebastián Ramírez (tiangolo)
author_link: https://twitter.com/tiangolo
link: https://www.youtube.com/watch?v=PnpTY1f4k2U
title: '[VIRTUAL] Py.Amsterdam''s flying Software Circus: Intro to FastAPI'
- author: Sebastián Ramírez (tiangolo)
author_link: https://twitter.com/tiangolo
link: https://www.youtube.com/watch?v=z9K5pwb0rt8
title: 'PyConBY 2020: Serve ML models easily with FastAPI'
- author: Chris Withers
author_link: https://twitter.com/chriswithers13
link: https://www.youtube.com/watch?v=3DLwPcrE5mA
title: 'PyCon UK 2019: FastAPI from the ground up'

View File

@@ -1,379 +1,752 @@
maintainers:
- login: tiangolo
answers: 998
prs: 200
avatarUrl: https://avatars1.githubusercontent.com/u/1326112?u=05f95ca7fdead36edd9c86be46b4ef6c3c71f876&v=4
answers: 1225
prs: 232
avatarUrl: https://avatars.githubusercontent.com/u/1326112?u=05f95ca7fdead36edd9c86be46b4ef6c3c71f876&v=4
url: https://github.com/tiangolo
experts:
- login: Kludex
count: 267
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: dmontagu
count: 262
avatarUrl: https://avatars2.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: ycd
count: 216
avatarUrl: https://avatars.githubusercontent.com/u/62724709?u=826f228edf0bab0d19ad1d5c4ba4df1047ccffef&v=4
url: https://github.com/ycd
- login: Mause
count: 182
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: euri10
count: 166
avatarUrl: https://avatars3.githubusercontent.com/u/1104190?u=ffd411da5d3b7ad3aa18261317f7ddc76f763c33&v=4
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: phy25
count: 129
avatarUrl: https://avatars0.githubusercontent.com/u/331403?v=4
count: 130
avatarUrl: https://avatars.githubusercontent.com/u/331403?v=4
url: https://github.com/phy25
- login: Kludex
count: 123
avatarUrl: https://avatars1.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: Mause
count: 99
avatarUrl: https://avatars2.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: ycd
count: 92
avatarUrl: https://avatars2.githubusercontent.com/u/62724709?u=496a800351ea1009678e40b26288a2a6c0dfa8bd&v=4
url: https://github.com/ycd
- login: ArcLightSlavik
count: 44
avatarUrl: https://avatars3.githubusercontent.com/u/31127044?u=b81d0c33b056152513fb14749a9fe00f39887a8e&v=4
count: 64
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: falkben
count: 56
avatarUrl: https://avatars.githubusercontent.com/u/653031?u=0c8d8f33d87f1aa1a6488d3f02105e9abc838105&v=4
url: https://github.com/falkben
- login: raphaelauv
count: 47
avatarUrl: https://avatars.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
- login: sm-Fifteen
count: 39
avatarUrl: https://avatars0.githubusercontent.com/u/516999?u=437c0c5038558c67e887ccd863c1ba0f846c03da&v=4
count: 46
avatarUrl: https://avatars.githubusercontent.com/u/516999?u=437c0c5038558c67e887ccd863c1ba0f846c03da&v=4
url: https://github.com/sm-Fifteen
- login: includeamin
count: 38
avatarUrl: https://avatars.githubusercontent.com/u/11836741?u=8bd5ef7e62fe6a82055e33c4c0e0a7879ff8cfb6&v=4
url: https://github.com/includeamin
- login: prostomarkeloff
count: 33
avatarUrl: https://avatars3.githubusercontent.com/u/28061158?u=72309cc1f2e04e40fa38b29969cb4e9d3f722e7b&v=4
avatarUrl: https://avatars.githubusercontent.com/u/28061158?u=72309cc1f2e04e40fa38b29969cb4e9d3f722e7b&v=4
url: https://github.com/prostomarkeloff
- login: Dustyposa
count: 32
avatarUrl: https://avatars.githubusercontent.com/u/27180793?u=5cf2877f50b3eb2bc55086089a78a36f07042889&v=4
url: https://github.com/Dustyposa
- login: krishnardt
count: 30
avatarUrl: https://avatars.githubusercontent.com/u/31960541?u=47f4829c77f4962ab437ffb7995951e41eeebe9b&v=4
url: https://github.com/krishnardt
- login: insomnes
count: 30
avatarUrl: https://avatars.githubusercontent.com/u/16958893?u=f8be7088d5076d963984a21f95f44e559192d912&v=4
url: https://github.com/insomnes
- login: wshayes
count: 29
avatarUrl: https://avatars2.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: includeamin
count: 29
avatarUrl: https://avatars1.githubusercontent.com/u/11836741?u=8bd5ef7e62fe6a82055e33c4c0e0a7879ff8cfb6&v=4
url: https://github.com/includeamin
- login: dbanty
count: 25
avatarUrl: https://avatars2.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
avatarUrl: https://avatars.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
url: https://github.com/dbanty
- login: raphaelauv
count: 24
avatarUrl: https://avatars3.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
- login: SirTelemak
count: 23
avatarUrl: https://avatars1.githubusercontent.com/u/9435877?u=719327b7d2c4c62212456d771bfa7c6b8dbb9eac&v=4
count: 24
avatarUrl: https://avatars.githubusercontent.com/u/9435877?u=719327b7d2c4c62212456d771bfa7c6b8dbb9eac&v=4
url: https://github.com/SirTelemak
- login: chbndrhnns
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/7534547?v=4
url: https://github.com/chbndrhnns
- login: acnebs
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/9054108?u=bfd127b3e6200f4d00afd714f0fc95c2512df19b&v=4
url: https://github.com/acnebs
- login: nsidnev
count: 22
avatarUrl: https://avatars0.githubusercontent.com/u/22559461?u=a9cc3238217e21dc8796a1a500f01b722adb082c&v=4
avatarUrl: https://avatars.githubusercontent.com/u/22559461?u=a9cc3238217e21dc8796a1a500f01b722adb082c&v=4
url: https://github.com/nsidnev
- login: frankie567
count: 21
avatarUrl: https://avatars.githubusercontent.com/u/1144727?u=72adf1cb1d29787305c99700d669561952cea0af&v=4
url: https://github.com/frankie567
- login: chris-allnutt
count: 21
avatarUrl: https://avatars0.githubusercontent.com/u/565544?v=4
avatarUrl: https://avatars.githubusercontent.com/u/565544?v=4
url: https://github.com/chris-allnutt
- login: Dustyposa
count: 21
avatarUrl: https://avatars0.githubusercontent.com/u/27180793?u=5cf2877f50b3eb2bc55086089a78a36f07042889&v=4
url: https://github.com/Dustyposa
- login: acnebs
count: 19
avatarUrl: https://avatars2.githubusercontent.com/u/9054108?u=bfd127b3e6200f4d00afd714f0fc95c2512df19b&v=4
url: https://github.com/acnebs
- login: retnikt
count: 19
avatarUrl: https://avatars1.githubusercontent.com/u/24581770?v=4
avatarUrl: https://avatars.githubusercontent.com/u/24581770?v=4
url: https://github.com/retnikt
- login: Hultner
count: 18
avatarUrl: https://avatars.githubusercontent.com/u/2669034?u=115e53df959309898ad8dc9443fbb35fee71df07&v=4
url: https://github.com/Hultner
- login: jorgerpo
count: 17
avatarUrl: https://avatars1.githubusercontent.com/u/12537771?u=7444d20019198e34911082780cc7ad73f2b97cb3&v=4
avatarUrl: https://avatars.githubusercontent.com/u/12537771?u=7444d20019198e34911082780cc7ad73f2b97cb3&v=4
url: https://github.com/jorgerpo
- login: Slyfoxy
- login: nkhitrov
count: 17
avatarUrl: https://avatars1.githubusercontent.com/u/28262306?u=66ee21316275ef356081c2efc4ed7a4572e690dc&v=4
url: https://github.com/Slyfoxy
avatarUrl: https://avatars.githubusercontent.com/u/28262306?u=66ee21316275ef356081c2efc4ed7a4572e690dc&v=4
url: https://github.com/nkhitrov
- login: waynerv
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: haizaar
count: 13
avatarUrl: https://avatars3.githubusercontent.com/u/58201?u=4f1f9843d69433ca0d380d95146cfe119e5fdac4&v=4
avatarUrl: https://avatars.githubusercontent.com/u/58201?u=4f1f9843d69433ca0d380d95146cfe119e5fdac4&v=4
url: https://github.com/haizaar
- login: acidjunk
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/685002?u=b5094ab4527fc84b006c0ac9ff54367bdebb2267&v=4
url: https://github.com/acidjunk
- login: zamiramir
count: 11
avatarUrl: https://avatars1.githubusercontent.com/u/40475662?u=e58ef61034e8d0d6a312cc956fb09b9c3332b449&v=4
avatarUrl: https://avatars.githubusercontent.com/u/40475662?u=e58ef61034e8d0d6a312cc956fb09b9c3332b449&v=4
url: https://github.com/zamiramir
- login: juntatalor
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/8134632?v=4
url: https://github.com/juntatalor
- login: valentin994
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/42819267?u=fdeeaa9242a59b243f8603496b00994f6951d5a2&v=4
url: https://github.com/valentin994
- login: aalifadv
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/78442260?v=4
url: https://github.com/aalifadv
- login: stefanondisponibile
count: 10
avatarUrl: https://avatars1.githubusercontent.com/u/20441825?u=ee1e59446b98f8ec2363caeda4c17164d0d9cc7d&v=4
avatarUrl: https://avatars.githubusercontent.com/u/20441825?u=ee1e59446b98f8ec2363caeda4c17164d0d9cc7d&v=4
url: https://github.com/stefanondisponibile
last_month_active:
- login: Mause
count: 51
avatarUrl: https://avatars2.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: ycd
count: 22
avatarUrl: https://avatars2.githubusercontent.com/u/62724709?u=496a800351ea1009678e40b26288a2a6c0dfa8bd&v=4
url: https://github.com/ycd
- login: Kludex
count: 14
avatarUrl: https://avatars1.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: includeamin
count: 12
avatarUrl: https://avatars1.githubusercontent.com/u/11836741?u=8bd5ef7e62fe6a82055e33c4c0e0a7879ff8cfb6&v=4
url: https://github.com/includeamin
- login: ArcLightSlavik
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: frankie567
count: 9
avatarUrl: https://avatars3.githubusercontent.com/u/31127044?u=b81d0c33b056152513fb14749a9fe00f39887a8e&v=4
url: https://github.com/ArcLightSlavik
- login: raphaelauv
avatarUrl: https://avatars.githubusercontent.com/u/1144727?u=72adf1cb1d29787305c99700d669561952cea0af&v=4
url: https://github.com/frankie567
- login: Mause
count: 6
avatarUrl: https://avatars3.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: ArcLightSlavik
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: gyKa
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/1000842?v=4
url: https://github.com/gyKa
- login: ricky-sb
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/10700079?v=4
url: https://github.com/ricky-sb
- login: captainCapitalism
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/32553875?v=4
url: https://github.com/captainCapitalism
- login: acidjunk
count: 3
avatarUrl: https://avatars.githubusercontent.com/u/685002?u=b5094ab4527fc84b006c0ac9ff54367bdebb2267&v=4
url: https://github.com/acidjunk
top_contributors:
- login: waynerv
count: 17
avatarUrl: https://avatars3.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
count: 25
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: tokusumi
count: 22
avatarUrl: https://avatars.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
url: https://github.com/tokusumi
- login: dmontagu
count: 16
avatarUrl: https://avatars2.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: euri10
count: 13
avatarUrl: https://avatars3.githubusercontent.com/u/1104190?u=ffd411da5d3b7ad3aa18261317f7ddc76f763c33&v=4
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: tokusumi
count: 10
avatarUrl: https://avatars0.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
url: https://github.com/tokusumi
- login: mariacamilagl
count: 9
avatarUrl: https://avatars2.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
avatarUrl: https://avatars.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
url: https://github.com/mariacamilagl
- login: RunningIkkyu
count: 7
avatarUrl: https://avatars0.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
avatarUrl: https://avatars.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
url: https://github.com/RunningIkkyu
- login: Serrones
count: 6
avatarUrl: https://avatars3.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
url: https://github.com/Serrones
- login: hard-coders
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: wshayes
count: 5
avatarUrl: https://avatars2.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: SwftAlpc
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/52768429?u=6a3aa15277406520ad37f6236e89466ed44bc5b8&v=4
url: https://github.com/SwftAlpc
- login: Attsun1031
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/1175560?v=4
url: https://github.com/Attsun1031
- login: jekirl
count: 4
avatarUrl: https://avatars3.githubusercontent.com/u/2546697?v=4
avatarUrl: https://avatars.githubusercontent.com/u/2546697?v=4
url: https://github.com/jekirl
- login: komtaki
count: 4
avatarUrl: https://avatars1.githubusercontent.com/u/39375566?v=4
avatarUrl: https://avatars.githubusercontent.com/u/39375566?u=5a44657c0544111ee3c132d9bb9951c2804f7969&v=4
url: https://github.com/komtaki
- login: Smlep
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/16785985?v=4
url: https://github.com/Smlep
top_reviewers:
- login: Kludex
count: 62
avatarUrl: https://avatars1.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
count: 80
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: tokusumi
count: 41
avatarUrl: https://avatars0.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
count: 44
avatarUrl: https://avatars.githubusercontent.com/u/41147016?u=55010621aece725aa702270b54fed829b6a1fe60&v=4
url: https://github.com/tokusumi
- login: Laineyzhang55
count: 42
avatarUrl: https://avatars.githubusercontent.com/u/59285379?v=4
url: https://github.com/Laineyzhang55
- login: ycd
count: 24
avatarUrl: https://avatars2.githubusercontent.com/u/62724709?u=496a800351ea1009678e40b26288a2a6c0dfa8bd&v=4
count: 41
avatarUrl: https://avatars.githubusercontent.com/u/62724709?u=826f228edf0bab0d19ad1d5c4ba4df1047ccffef&v=4
url: https://github.com/ycd
- login: waynerv
count: 38
avatarUrl: https://avatars.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: AdrianDeAnda
count: 28
avatarUrl: https://avatars.githubusercontent.com/u/1024932?u=bb7f8a0d6c9de4e9d0320a9f271210206e202250&v=4
url: https://github.com/AdrianDeAnda
- login: dmontagu
count: 23
avatarUrl: https://avatars2.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
avatarUrl: https://avatars.githubusercontent.com/u/35119617?u=58ed2a45798a4339700e2f62b2e12e6e54bf0396&v=4
url: https://github.com/dmontagu
- login: Laineyzhang55
count: 21
avatarUrl: https://avatars0.githubusercontent.com/u/59285379?v=4
url: https://github.com/Laineyzhang55
- login: AdrianDeAnda
count: 20
avatarUrl: https://avatars0.githubusercontent.com/u/1024932?u=bb7f8a0d6c9de4e9d0320a9f271210206e202250&v=4
url: https://github.com/AdrianDeAnda
- login: komtaki
count: 19
avatarUrl: https://avatars1.githubusercontent.com/u/39375566?v=4
count: 21
avatarUrl: https://avatars.githubusercontent.com/u/39375566?u=5a44657c0544111ee3c132d9bb9951c2804f7969&v=4
url: https://github.com/komtaki
- login: waynerv
count: 18
avatarUrl: https://avatars3.githubusercontent.com/u/39515546?u=ec35139777597cdbbbddda29bf8b9d4396b429a9&v=4
url: https://github.com/waynerv
- login: SwftAlpc
count: 16
avatarUrl: https://avatars1.githubusercontent.com/u/52768429?u=6a3aa15277406520ad37f6236e89466ed44bc5b8&v=4
url: https://github.com/SwftAlpc
- login: ArcLightSlavik
count: 20
avatarUrl: https://avatars.githubusercontent.com/u/31127044?u=81a84af39c89b898b0fbc5a04e8834f60f23e55a&v=4
url: https://github.com/ArcLightSlavik
- login: cassiobotaro
count: 14
avatarUrl: https://avatars2.githubusercontent.com/u/3127847?u=b0a652331da17efeb85cd6e3a4969182e5004804&v=4
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/3127847?u=b0a652331da17efeb85cd6e3a4969182e5004804&v=4
url: https://github.com/cassiobotaro
- login: yanever
count: 14
avatarUrl: https://avatars2.githubusercontent.com/u/21978760?v=4
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/21978760?v=4
url: https://github.com/yanever
- login: SwftAlpc
count: 16
avatarUrl: https://avatars.githubusercontent.com/u/52768429?u=6a3aa15277406520ad37f6236e89466ed44bc5b8&v=4
url: https://github.com/SwftAlpc
- login: pedabraham
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/16860088?u=abf922a7b920bf8fdb7867d8b43e091f1e796178&v=4
url: https://github.com/pedabraham
- login: delhi09
count: 15
avatarUrl: https://avatars.githubusercontent.com/u/63476957?u=6c86e59b48e0394d4db230f37fc9ad4d7e2c27c7&v=4
url: https://github.com/delhi09
- login: RunningIkkyu
count: 11
avatarUrl: https://avatars0.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
count: 12
avatarUrl: https://avatars.githubusercontent.com/u/31848542?u=706e1ee3f248245f2d68b976d149d06fd5a2010d&v=4
url: https://github.com/RunningIkkyu
- login: hard-coders
count: 12
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: sh0nk
count: 11
avatarUrl: https://avatars.githubusercontent.com/u/6478810?u=af15d724875cec682ed8088a86d36b2798f981c0&v=4
url: https://github.com/sh0nk
- login: mariacamilagl
count: 10
avatarUrl: https://avatars2.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
avatarUrl: https://avatars.githubusercontent.com/u/11489395?u=4adb6986bf3debfc2b8216ae701f2bd47d73da7d&v=4
url: https://github.com/mariacamilagl
- login: Attsun1031
count: 10
avatarUrl: https://avatars2.githubusercontent.com/u/1175560?v=4
avatarUrl: https://avatars.githubusercontent.com/u/1175560?v=4
url: https://github.com/Attsun1031
- login: maoyibo
count: 10
avatarUrl: https://avatars3.githubusercontent.com/u/7887703?v=4
avatarUrl: https://avatars.githubusercontent.com/u/7887703?v=4
url: https://github.com/maoyibo
- login: PandaHun
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/13096845?u=646eba44db720e37d0dbe8e98e77ab534ea78a20&v=4
url: https://github.com/PandaHun
- login: bezaca
count: 9
avatarUrl: https://avatars.githubusercontent.com/u/69092910?u=4ac58eab99bd37d663f3d23551df96d4fbdbf760&v=4
url: https://github.com/bezaca
- login: lsglucas
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/61513630?u=320e43fe4dc7bc6efc64e9b8f325f8075634fd20&v=4
url: https://github.com/lsglucas
- login: rjNemo
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/56785022?u=d5c3a02567c8649e146fcfc51b6060ccaf8adef8&v=4
url: https://github.com/rjNemo
- login: blt232018
count: 8
avatarUrl: https://avatars.githubusercontent.com/u/43393471?u=172b0e0391db1aa6c1706498d6dfcb003c8a4857&v=4
url: https://github.com/blt232018
- login: Serrones
count: 7
avatarUrl: https://avatars3.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
avatarUrl: https://avatars.githubusercontent.com/u/22691749?u=4795b880e13ca33a73e52fc0ef7dc9c60c8fce47&v=4
url: https://github.com/Serrones
- login: ryuckel
count: 7
avatarUrl: https://avatars1.githubusercontent.com/u/36391432?u=094eec0cfddd5013f76f31e55e56147d78b19553&v=4
avatarUrl: https://avatars.githubusercontent.com/u/36391432?u=094eec0cfddd5013f76f31e55e56147d78b19553&v=4
url: https://github.com/ryuckel
- login: ArcLightSlavik
count: 6
avatarUrl: https://avatars3.githubusercontent.com/u/31127044?u=b81d0c33b056152513fb14749a9fe00f39887a8e&v=4
url: https://github.com/ArcLightSlavik
- login: MashhadiNima
count: 5
avatarUrl: https://avatars0.githubusercontent.com/u/49960770?u=e39b11d47188744ee07b2a1c7ce1a1bdf3c80760&v=4
url: https://github.com/MashhadiNima
- login: raphaelauv
count: 5
avatarUrl: https://avatars3.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/10202690?u=e6f86f5c0c3026a15d6b51792fa3e532b12f1371&v=4
url: https://github.com/raphaelauv
- login: NastasiaSaby
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/8245071?u=b3afd005f9e4bf080c219ef61a592b3a8004b764&v=4
url: https://github.com/NastasiaSaby
- login: Smlep
count: 7
avatarUrl: https://avatars.githubusercontent.com/u/16785985?v=4
url: https://github.com/Smlep
- login: jovicon
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/21287303?u=b049eac3e51a4c0473c2efe66b4d28a7d8f2b572&v=4
url: https://github.com/jovicon
- login: Mause
count: 6
avatarUrl: https://avatars.githubusercontent.com/u/1405026?v=4
url: https://github.com/Mause
- login: nimctl
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/49960770?u=e39b11d47188744ee07b2a1c7ce1a1bdf3c80760&v=4
url: https://github.com/nimctl
- login: juntatalor
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/8134632?v=4
url: https://github.com/juntatalor
- login: SnkSynthesis
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/63564282?u=0078826509dbecb2fdb543f4e881c9cd06157893&v=4
url: https://github.com/SnkSynthesis
- login: anthonycepeda
count: 5
avatarUrl: https://avatars.githubusercontent.com/u/72019805?u=892f700c79f9732211bd5221bf16eec32356a732&v=4
url: https://github.com/anthonycepeda
- login: euri10
count: 4
avatarUrl: https://avatars3.githubusercontent.com/u/1104190?u=ffd411da5d3b7ad3aa18261317f7ddc76f763c33&v=4
avatarUrl: https://avatars.githubusercontent.com/u/1104190?u=321a2e953e6645a7d09b732786c7a8061e0f8a8b&v=4
url: https://github.com/euri10
- login: rkbeatss
count: 4
avatarUrl: https://avatars0.githubusercontent.com/u/23391143?u=56ab6bff50be950fa8cae5cf736f2ae66e319ff3&v=4
avatarUrl: https://avatars.githubusercontent.com/u/23391143?u=56ab6bff50be950fa8cae5cf736f2ae66e319ff3&v=4
url: https://github.com/rkbeatss
- login: aviramha
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/41201924?u=6883cc4fc13a7b2e60d4deddd4be06f9c5287880&v=4
url: https://github.com/aviramha
- login: Zxilly
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/31370133?v=4
url: https://github.com/Zxilly
- login: Bluenix2
count: 4
avatarUrl: https://avatars.githubusercontent.com/u/38372706?u=c9d28aff15958d6ebf1971148bfb3154ff943c4f&v=4
url: https://github.com/Bluenix2
sponsors_50:
- login: johnadjei
avatarUrl: https://avatars.githubusercontent.com/u/767860?v=4
url: https://github.com/johnadjei
- login: wdwinslow
avatarUrl: https://avatars.githubusercontent.com/u/11562137?u=dc01daafb354135603a263729e3d26d939c0c452&v=4
url: https://github.com/wdwinslow
- login: bingwu-chime
avatarUrl: https://avatars.githubusercontent.com/u/67026650?u=603a6b345f25c20c6706a8a6c7f71ae688d649a5&v=4
url: https://github.com/bingwu-chime
sponsors:
- login: kamalgill
avatarUrl: https://avatars.githubusercontent.com/u/133923?u=0df9181d97436ce330e9acf90ab8a54b7022efe7&v=4
url: https://github.com/kamalgill
- login: grillazz
avatarUrl: https://avatars.githubusercontent.com/u/3415861?u=16d7d0ffa5dfb99f8834f8f76d90e138ba09b94a&v=4
url: https://github.com/grillazz
- login: tizz98
avatarUrl: https://avatars.githubusercontent.com/u/5739698?u=f095a3659e3a8e7c69ccd822696990b521ea25f9&v=4
url: https://github.com/tizz98
- login: jmaralc
avatarUrl: https://avatars.githubusercontent.com/u/21101214?u=b15a9f07b7cbf6c9dcdbcb6550bbd2c52f55aa50&v=4
url: https://github.com/jmaralc
- login: psgandalf
avatarUrl: https://avatars.githubusercontent.com/u/8134158?v=4
url: https://github.com/psgandalf
- login: samuelcolvin
avatarUrl: https://avatars3.githubusercontent.com/u/4039449?u=807390ba9cfe23906c3bf8a0d56aaca3cf2bfa0d&v=4
avatarUrl: https://avatars.githubusercontent.com/u/4039449?u=807390ba9cfe23906c3bf8a0d56aaca3cf2bfa0d&v=4
url: https://github.com/samuelcolvin
- login: mkeen
avatarUrl: https://avatars3.githubusercontent.com/u/38221?u=03e076e08a10a4de0d48a348f1aab0223c5cf24a&v=4
url: https://github.com/mkeen
- login: jokull
avatarUrl: https://avatars.githubusercontent.com/u/701?u=0532b62166893d5160ef795c4c8b7512d971af05&v=4
url: https://github.com/jokull
- login: wshayes
avatarUrl: https://avatars2.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
avatarUrl: https://avatars.githubusercontent.com/u/365303?u=07ca03c5ee811eb0920e633cc3c3db73dbec1aa5&v=4
url: https://github.com/wshayes
- login: lukin0110
avatarUrl: https://avatars1.githubusercontent.com/u/992275?u=d20b7e18b213ae7004585b382eccb542db5ffe48&v=4
url: https://github.com/lukin0110
- login: koxudaxi
avatarUrl: https://avatars.githubusercontent.com/u/630670?u=507d8577b4b3670546b449c4c2ccbc5af40d72f7&v=4
url: https://github.com/koxudaxi
- login: falkben
avatarUrl: https://avatars.githubusercontent.com/u/653031?u=0c8d8f33d87f1aa1a6488d3f02105e9abc838105&v=4
url: https://github.com/falkben
- login: jqueguiner
avatarUrl: https://avatars.githubusercontent.com/u/690878?u=e4835b2a985a0f2d52018e4926cb5a58c26a62e8&v=4
url: https://github.com/jqueguiner
- login: Mazyod
avatarUrl: https://avatars.githubusercontent.com/u/860511?v=4
url: https://github.com/Mazyod
- login: ltieman
avatarUrl: https://avatars1.githubusercontent.com/u/1084689?u=c9bf77f5e57f98b49694870219b9bd9d1cc862e7&v=4
avatarUrl: https://avatars.githubusercontent.com/u/1084689?u=e69b17de17cb3ca141a17daa7ccbe173ceb1eb17&v=4
url: https://github.com/ltieman
- login: mrmattwright
avatarUrl: https://avatars3.githubusercontent.com/u/1277725?v=4
avatarUrl: https://avatars.githubusercontent.com/u/1277725?v=4
url: https://github.com/mrmattwright
- login: westonsteimel
avatarUrl: https://avatars.githubusercontent.com/u/1593939?u=0f2c0e3647f916fe295d62fa70da7a4c177115e3&v=4
url: https://github.com/westonsteimel
- login: timdrijvers
avatarUrl: https://avatars1.githubusercontent.com/u/1694939?v=4
avatarUrl: https://avatars.githubusercontent.com/u/1694939?v=4
url: https://github.com/timdrijvers
- login: ddahan
avatarUrl: https://avatars0.githubusercontent.com/u/1933516?u=4068dc3c5db5d3605116c4f5df6deb9fee324c33&v=4
url: https://github.com/ddahan
- login: cbonoz
avatarUrl: https://avatars0.githubusercontent.com/u/2351087?u=fd3e8030b2cc9fbfbb54a65e9890c548a016f58b&v=4
url: https://github.com/cbonoz
- login: mrgnw
avatarUrl: https://avatars3.githubusercontent.com/u/2504532?u=7ec43837a6d0afa80f96f0788744ea6341b89f97&v=4
avatarUrl: https://avatars.githubusercontent.com/u/2504532?u=7ec43837a6d0afa80f96f0788744ea6341b89f97&v=4
url: https://github.com/mrgnw
- login: paul121
avatarUrl: https://avatars2.githubusercontent.com/u/3116995?u=6e2d8691cc345e63ee02e4eb4d7cef82b1fcbedc&v=4
url: https://github.com/paul121
- login: madisonmay
avatarUrl: https://avatars.githubusercontent.com/u/2645393?u=f22b93c6ea345a4d26a90a3834dfc7f0789fcb63&v=4
url: https://github.com/madisonmay
- login: saivarunk
avatarUrl: https://avatars.githubusercontent.com/u/2976867?u=71f4385e781e9a9e871a52f2d4686f9a8d69ba2f&v=4
url: https://github.com/saivarunk
- login: andre1sk
avatarUrl: https://avatars1.githubusercontent.com/u/3148093?v=4
avatarUrl: https://avatars.githubusercontent.com/u/3148093?v=4
url: https://github.com/andre1sk
- login: igorcorrea
avatarUrl: https://avatars0.githubusercontent.com/u/3438238?u=c57605077c31a8f7b2341fc4912507f91b4a5621&v=4
url: https://github.com/igorcorrea
- login: pawamoy
avatarUrl: https://avatars2.githubusercontent.com/u/3999221?u=b030e4c89df2f3a36bc4710b925bdeb6745c9856&v=4
url: https://github.com/pawamoy
- login: p141592
avatarUrl: https://avatars2.githubusercontent.com/u/5256328?u=07bc6374282ab3d08511afebaa5d511987d034f1&v=4
url: https://github.com/p141592
- login: Shark009
avatarUrl: https://avatars.githubusercontent.com/u/3163309?v=4
url: https://github.com/Shark009
- login: peterHoburg
avatarUrl: https://avatars.githubusercontent.com/u/3860655?u=f55f47eb2d6a9b495e806ac5a044e3ae01ccc1fa&v=4
url: https://github.com/peterHoburg
- login: dudil
avatarUrl: https://avatars.githubusercontent.com/u/4785835?u=58b7ea39123e0507f3b2996448a27256b16fd697&v=4
url: https://github.com/dudil
- login: ennui93
avatarUrl: https://avatars.githubusercontent.com/u/5300907?u=5b5452725ddb391b2caaebf34e05aba873591c3a&v=4
url: https://github.com/ennui93
- login: sco1
avatarUrl: https://avatars.githubusercontent.com/u/5323929?u=2b8434060d0c9d93de80a2a945baed94a412c31e&v=4
url: https://github.com/sco1
- login: MacroPower
avatarUrl: https://avatars.githubusercontent.com/u/5648814?u=b2730000c9f9a471282b9849d2cc85711d7973d4&v=4
url: https://github.com/MacroPower
- login: ginomempin
avatarUrl: https://avatars3.githubusercontent.com/u/6091865?v=4
avatarUrl: https://avatars.githubusercontent.com/u/6091865?v=4
url: https://github.com/ginomempin
- login: fabboe
avatarUrl: https://avatars2.githubusercontent.com/u/7251331?u=43098dddeee6514a552ee5e98bc198ecfd18fdb7&v=4
url: https://github.com/fabboe
- login: iwpnd
avatarUrl: https://avatars.githubusercontent.com/u/6152183?u=b2286006daafff5f991557344fee20b5da59639a&v=4
url: https://github.com/iwpnd
- login: s3ich4n
avatarUrl: https://avatars.githubusercontent.com/u/6926298?u=ba3025d698e1c986655e776ae383a3d60d9d578e&v=4
url: https://github.com/s3ich4n
- login: Rehket
avatarUrl: https://avatars.githubusercontent.com/u/7015688?u=3afb0ba200feebbc7f958950e92db34df2a3c172&v=4
url: https://github.com/Rehket
- login: christippett
avatarUrl: https://avatars.githubusercontent.com/u/7218120?u=434b9d29287d7de25772d94ddc74a9bd6d969284&v=4
url: https://github.com/christippett
- login: Kludex
avatarUrl: https://avatars.githubusercontent.com/u/7353520?u=cf8455cb899806b774a3a71073f88583adec99f6&v=4
url: https://github.com/Kludex
- login: Shackelford-Arden
avatarUrl: https://avatars0.githubusercontent.com/u/7362263?v=4
avatarUrl: https://avatars.githubusercontent.com/u/7362263?v=4
url: https://github.com/Shackelford-Arden
- login: macleodmac
avatarUrl: https://avatars2.githubusercontent.com/u/8996312?u=e39c68c3e0b1d264dcba4850134a291680f46355&v=4
avatarUrl: https://avatars.githubusercontent.com/u/8996312?u=e39c68c3e0b1d264dcba4850134a291680f46355&v=4
url: https://github.com/macleodmac
- login: hard-coders
avatarUrl: https://avatars3.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: cristeaadrian
avatarUrl: https://avatars.githubusercontent.com/u/9112724?v=4
url: https://github.com/cristeaadrian
- login: otivvormes
avatarUrl: https://avatars2.githubusercontent.com/u/11317418?u=6de1edefb6afd0108c0ad2816bd6efc4464a9c44&v=4
avatarUrl: https://avatars.githubusercontent.com/u/11317418?u=6de1edefb6afd0108c0ad2816bd6efc4464a9c44&v=4
url: https://github.com/otivvormes
- login: iambobmae
avatarUrl: https://avatars2.githubusercontent.com/u/12390270?u=c9a35c2ee5092a9b4135ebb1f91b7f521c467031&v=4
avatarUrl: https://avatars.githubusercontent.com/u/12390270?u=c9a35c2ee5092a9b4135ebb1f91b7f521c467031&v=4
url: https://github.com/iambobmae
- login: Cozmo25
avatarUrl: https://avatars1.githubusercontent.com/u/12619962?u=679dcd6785121e14f6254e9dd0961baf3b1fef5d&v=4
url: https://github.com/Cozmo25
- login: ronaldnwilliams
avatarUrl: https://avatars.githubusercontent.com/u/13632749?u=ac41a086d0728bf66a9d2bee9e5e377041ff44a4&v=4
url: https://github.com/ronaldnwilliams
- login: uselessscat
avatarUrl: https://avatars.githubusercontent.com/u/15332878?u=8485a1b7383c274b28f383370ee2d5f9a6cd423b&v=4
url: https://github.com/uselessscat
- login: natenka
avatarUrl: https://avatars.githubusercontent.com/u/15850513?u=00d1083c980d0b4ce32835dc07eee7f43f34fd2f&v=4
url: https://github.com/natenka
- login: la-mar
avatarUrl: https://avatars1.githubusercontent.com/u/16618300?u=7755c0521d2bb0d704f35a51464b15c1e2e6c4da&v=4
avatarUrl: https://avatars.githubusercontent.com/u/16618300?u=7755c0521d2bb0d704f35a51464b15c1e2e6c4da&v=4
url: https://github.com/la-mar
- login: robintully
avatarUrl: https://avatars2.githubusercontent.com/u/17059673?u=862b9bb01513f5acd30df97433cb97a24dbfb772&v=4
avatarUrl: https://avatars.githubusercontent.com/u/17059673?u=862b9bb01513f5acd30df97433cb97a24dbfb772&v=4
url: https://github.com/robintully
- login: ShaulAb
avatarUrl: https://avatars.githubusercontent.com/u/18129076?u=2c8d48e47f2dbee15c3f89c3d17d4c356504386c&v=4
url: https://github.com/ShaulAb
- login: wedwardbeck
avatarUrl: https://avatars3.githubusercontent.com/u/19333237?u=1de4ae2bf8d59eb4c013f21d863cbe0f2010575f&v=4
avatarUrl: https://avatars.githubusercontent.com/u/19333237?u=1de4ae2bf8d59eb4c013f21d863cbe0f2010575f&v=4
url: https://github.com/wedwardbeck
- login: linusg
avatarUrl: https://avatars3.githubusercontent.com/u/19366641?u=125e390abef8fff3b3b0d370c369cba5d7fd4c67&v=4
avatarUrl: https://avatars.githubusercontent.com/u/19366641?u=125e390abef8fff3b3b0d370c369cba5d7fd4c67&v=4
url: https://github.com/linusg
- login: SebastianLuebke
avatarUrl: https://avatars3.githubusercontent.com/u/21161532?u=ba033c1bf6851b874cfa05a8a824b9f1ff434c37&v=4
url: https://github.com/SebastianLuebke
- login: RedCarpetUp
avatarUrl: https://avatars.githubusercontent.com/u/20360440?v=4
url: https://github.com/RedCarpetUp
- login: daddycocoaman
avatarUrl: https://avatars.githubusercontent.com/u/21189155?u=756f6a17c71c538b11470f70839baacab43807ef&v=4
url: https://github.com/daddycocoaman
- login: Filimoa
avatarUrl: https://avatars.githubusercontent.com/u/21352040?u=75e02d102d2ee3e3d793e555fa5c63045913ccb0&v=4
url: https://github.com/Filimoa
- login: raminsj13
avatarUrl: https://avatars2.githubusercontent.com/u/24259406?u=d51f2a526312ebba150a06936ed187ca0727d329&v=4
avatarUrl: https://avatars.githubusercontent.com/u/24259406?u=d51f2a526312ebba150a06936ed187ca0727d329&v=4
url: https://github.com/raminsj13
- login: mertguvencli
avatarUrl: https://avatars3.githubusercontent.com/u/29762151?u=16a906d90df96c8cff9ea131a575c4bc171b1523&v=4
url: https://github.com/mertguvencli
- login: comoelcometa
avatarUrl: https://avatars.githubusercontent.com/u/25950317?u=c6751efa038561b9bc5fa56d1033d5174e10cd65&v=4
url: https://github.com/comoelcometa
- login: veprimk
avatarUrl: https://avatars.githubusercontent.com/u/29689749?u=f8cb5a15a286e522e5b189bc572d5a1a90217fb2&v=4
url: https://github.com/veprimk
- login: orihomie
avatarUrl: https://avatars3.githubusercontent.com/u/29889683?u=6bc2135a52fcb3a49e69e7d50190796618185fda&v=4
avatarUrl: https://avatars.githubusercontent.com/u/29889683?u=6bc2135a52fcb3a49e69e7d50190796618185fda&v=4
url: https://github.com/orihomie
- login: dcooper01
avatarUrl: https://avatars2.githubusercontent.com/u/32238294?u=2a83c78b7f2a5f97beeede0b604bbe44cd21b46b&v=4
url: https://github.com/dcooper01
- login: d3vzer0
avatarUrl: https://avatars3.githubusercontent.com/u/34250156?u=c50c9df0e34f411f7e5f050a72e8d89696284eba&v=4
url: https://github.com/d3vzer0
- login: AjitZK
avatarUrl: https://avatars3.githubusercontent.com/u/40203625?u=9638bfeacfa5940358188f8205ce662bba022b53&v=4
url: https://github.com/AjitZK
- login: ilias-ant
avatarUrl: https://avatars1.githubusercontent.com/u/42189572?u=064bf3a60fcb3c445ab038386321098920b3f4e4&v=4
url: https://github.com/ilias-ant
- login: SaltyCoco
avatarUrl: https://avatars.githubusercontent.com/u/31451104?u=6ee4e17c07d21b7054f54a12fa9cc377a1b24ff9&v=4
url: https://github.com/SaltyCoco
- login: mauroalejandrojm
avatarUrl: https://avatars.githubusercontent.com/u/31569442?u=cdada990a1527926a36e95f62c30a8b48bbc49a1&v=4
url: https://github.com/mauroalejandrojm
- login: public-daniel
avatarUrl: https://avatars.githubusercontent.com/u/32238294?u=0377e38dd023395c9643d5388b4e9489a24b4d34&v=4
url: https://github.com/public-daniel
- login: ybressler
avatarUrl: https://avatars.githubusercontent.com/u/40807730?u=6621dc9ab53b697912ab2a32211bb29ae90a9112&v=4
url: https://github.com/ybressler
- login: dbanty
avatarUrl: https://avatars2.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
avatarUrl: https://avatars.githubusercontent.com/u/43723790?u=0cf33e4f40efc2ea206a1189fd63a11344eb88ed&v=4
url: https://github.com/dbanty
- login: Brontomerus
avatarUrl: https://avatars0.githubusercontent.com/u/61284158?u=c00d807195815014d0b6597b3801ee9c494802dd&v=4
url: https://github.com/Brontomerus
- login: primer-api
avatarUrl: https://avatars2.githubusercontent.com/u/62152773?u=4549d79b0ad1d30ecfbef6c6933593e90e819c75&v=4
url: https://github.com/primer-api
- login: dudikbender
avatarUrl: https://avatars.githubusercontent.com/u/53487583?u=494f85229115076121b3639a3806bbac1c6ae7f6&v=4
url: https://github.com/dudikbender
- login: primer-io
avatarUrl: https://avatars.githubusercontent.com/u/62146168?v=4
url: https://github.com/primer-io
- login: tkrestiankova
avatarUrl: https://avatars2.githubusercontent.com/u/67013045?u=6f06d28dba7e46aa363af2840d7b028e4d7bcbd9&v=4
avatarUrl: https://avatars.githubusercontent.com/u/67013045?v=4
url: https://github.com/tkrestiankova
- login: daverin
avatarUrl: https://avatars1.githubusercontent.com/u/70378377?u=6d1814195c0de7162820eaad95a25b423a3869c0&v=4
avatarUrl: https://avatars.githubusercontent.com/u/70378377?u=6d1814195c0de7162820eaad95a25b423a3869c0&v=4
url: https://github.com/daverin
- login: anthonycepeda
avatarUrl: https://avatars.githubusercontent.com/u/72019805?u=892f700c79f9732211bd5221bf16eec32356a732&v=4
url: https://github.com/anthonycepeda
- login: linux-china
avatarUrl: https://avatars.githubusercontent.com/u/46711?v=4
url: https://github.com/linux-china
- login: jhb
avatarUrl: https://avatars.githubusercontent.com/u/142217?v=4
url: https://github.com/jhb
- login: yourkin
avatarUrl: https://avatars.githubusercontent.com/u/178984?v=4
url: https://github.com/yourkin
- login: jmagnusson
avatarUrl: https://avatars.githubusercontent.com/u/190835?v=4
url: https://github.com/jmagnusson
- login: slafs
avatarUrl: https://avatars.githubusercontent.com/u/210173?v=4
url: https://github.com/slafs
- login: adamghill
avatarUrl: https://avatars.githubusercontent.com/u/317045?u=f1349d5ffe84a19f324e204777859fbf69ddf633&v=4
url: https://github.com/adamghill
- login: eteq
avatarUrl: https://avatars.githubusercontent.com/u/346587?v=4
url: https://github.com/eteq
- login: dmig
avatarUrl: https://avatars.githubusercontent.com/u/388564?v=4
url: https://github.com/dmig
- login: hongqn
avatarUrl: https://avatars.githubusercontent.com/u/405587?u=470b4c04832e45141fd5264d3354845cc9fc6466&v=4
url: https://github.com/hongqn
- login: rinckd
avatarUrl: https://avatars.githubusercontent.com/u/546002?u=1fcc7e664dc86524a0af6837a0c222829c3fd4e5&v=4
url: https://github.com/rinckd
- login: Pytlicek
avatarUrl: https://avatars.githubusercontent.com/u/1430522?u=169dba3bfbc04ed214a914640ff435969f19ddb3&v=4
url: https://github.com/Pytlicek
- login: okken
avatarUrl: https://avatars.githubusercontent.com/u/1568356?u=0a991a21bdc62e2bea9ad311652f2c45f453dc84&v=4
url: https://github.com/okken
- login: leogregianin
avatarUrl: https://avatars.githubusercontent.com/u/1684053?u=94ddd387601bd1805034dbe83e6eba0491c15323&v=4
url: https://github.com/leogregianin
- login: cbonoz
avatarUrl: https://avatars.githubusercontent.com/u/2351087?u=fd3e8030b2cc9fbfbb54a65e9890c548a016f58b&v=4
url: https://github.com/cbonoz
- login: rglsk
avatarUrl: https://avatars.githubusercontent.com/u/2768101?u=e349c88673f2155fe021331377c656a9d74bcc25&v=4
url: https://github.com/rglsk
- login: Atem18
avatarUrl: https://avatars.githubusercontent.com/u/2875254?v=4
url: https://github.com/Atem18
- login: paul121
avatarUrl: https://avatars.githubusercontent.com/u/3116995?u=6e2d8691cc345e63ee02e4eb4d7cef82b1fcbedc&v=4
url: https://github.com/paul121
- login: igorcorrea
avatarUrl: https://avatars.githubusercontent.com/u/3438238?u=c57605077c31a8f7b2341fc4912507f91b4a5621&v=4
url: https://github.com/igorcorrea
- login: zsinx6
avatarUrl: https://avatars.githubusercontent.com/u/3532625?u=ba75a5dc744d1116ccfeaaf30d41cb2fe81fe8dd&v=4
url: https://github.com/zsinx6
- login: pawamoy
avatarUrl: https://avatars.githubusercontent.com/u/3999221?u=b030e4c89df2f3a36bc4710b925bdeb6745c9856&v=4
url: https://github.com/pawamoy
- login: spyker77
avatarUrl: https://avatars.githubusercontent.com/u/4953435?u=568baae6469628e020fe0bab16e395b7ae10c7d3&v=4
url: https://github.com/spyker77
- login: serfer2
avatarUrl: https://avatars.githubusercontent.com/u/5196592?u=e8798d87120952ed41876778f0cc8a1ddb47f901&v=4
url: https://github.com/serfer2
- login: JonasKs
avatarUrl: https://avatars.githubusercontent.com/u/5310116?u=98a049f3e1491bffb91e1feb7e93def6881a9389&v=4
url: https://github.com/JonasKs
- login: holec
avatarUrl: https://avatars.githubusercontent.com/u/6438041?u=f5af71ec85b3a9d7b8139cb5af0512b02fa9ab1e&v=4
url: https://github.com/holec
- login: BartlomiejRasztabiga
avatarUrl: https://avatars.githubusercontent.com/u/8852711?u=ed213d60f7a423df31ceb1004aa3ec60e612cb98&v=4
url: https://github.com/BartlomiejRasztabiga
- login: davanstrien
avatarUrl: https://avatars.githubusercontent.com/u/8995957?u=fb2aad2b52bb4e7b56db6d7c8ecc9ae1eac1b984&v=4
url: https://github.com/davanstrien
- login: and-semakin
avatarUrl: https://avatars.githubusercontent.com/u/9129071?u=ea77ddf7de4bc375d546bf2825ed420eaddb7666&v=4
url: https://github.com/and-semakin
- login: VivianSolide
avatarUrl: https://avatars.githubusercontent.com/u/9358572?u=ffb2e2ec522a15dcd3f0af1f9fd1df4afe418afa&v=4
url: https://github.com/VivianSolide
- login: hard-coders
avatarUrl: https://avatars.githubusercontent.com/u/9651103?u=f2d3d2038c55d86d7f9348f4e6c5e30191e4ee8b&v=4
url: https://github.com/hard-coders
- login: satwikkansal
avatarUrl: https://avatars.githubusercontent.com/u/10217535?u=b12d6ef74ea297de9e46da6933b1a5b7ba9e6a61&v=4
url: https://github.com/satwikkansal
- login: pheanex
avatarUrl: https://avatars.githubusercontent.com/u/10408624?u=5b6bab6ee174aa6e991333e06eb29f628741013d&v=4
url: https://github.com/pheanex
- login: wotori
avatarUrl: https://avatars.githubusercontent.com/u/10486621?u=0044c295b91694b8c9bccc0a805681f794250f7b&v=4
url: https://github.com/wotori
- login: JimFawkes
avatarUrl: https://avatars.githubusercontent.com/u/12075115?u=dc58ecfd064d72887c34bf500ddfd52592509acd&v=4
url: https://github.com/JimFawkes
- login: logan-connolly
avatarUrl: https://avatars.githubusercontent.com/u/16244943?u=8ae66dfbba936463cc8aa0dd7a6d2b4c0cc757eb&v=4
url: https://github.com/logan-connolly
- login: iPr0ger
avatarUrl: https://avatars.githubusercontent.com/u/19322290?v=4
url: https://github.com/iPr0ger
- login: sadikkuzu
avatarUrl: https://avatars.githubusercontent.com/u/23168063?u=765ed469c44c004560079210ccdad5b29938eaa9&v=4
url: https://github.com/sadikkuzu
- login: ghandic
avatarUrl: https://avatars.githubusercontent.com/u/23500353?u=e2e1d736f924d9be81e8bfc565b6d8836ba99773&v=4
url: https://github.com/ghandic
- login: MoronVV
avatarUrl: https://avatars.githubusercontent.com/u/24293616?v=4
url: https://github.com/MoronVV
- login: AngusWG
avatarUrl: https://avatars.githubusercontent.com/u/26385612?u=f4d4c8bd2097cdd58eb9e385932b83c78777f3c0&v=4
url: https://github.com/AngusWG
- login: mertguvencli
avatarUrl: https://avatars.githubusercontent.com/u/29762151?u=16a906d90df96c8cff9ea131a575c4bc171b1523&v=4
url: https://github.com/mertguvencli
- login: rgreen32
avatarUrl: https://avatars.githubusercontent.com/u/35779241?u=c9d64ad1ab364b6a1ec8e3d859da9ca802d681d8&v=4
url: https://github.com/rgreen32
- login: askurihin
avatarUrl: https://avatars.githubusercontent.com/u/37978981?v=4
url: https://github.com/askurihin
- login: berrysauce
avatarUrl: https://avatars.githubusercontent.com/u/38889179?u=758ed15a5be8bbd03855f5a74f42c19f7946ee32&v=4
url: https://github.com/berrysauce
- login: JitPackJoyride
avatarUrl: https://avatars.githubusercontent.com/u/40203625?u=9638bfeacfa5940358188f8205ce662bba022b53&v=4
url: https://github.com/JitPackJoyride
- login: es3n1n
avatarUrl: https://avatars.githubusercontent.com/u/40367813?u=e881a3880f1e342d19a1ea7c8e1b6d76c52dc294&v=4
url: https://github.com/es3n1n
- login: ilias-ant
avatarUrl: https://avatars.githubusercontent.com/u/42189572?u=a2d6121bac4d125d92ec207460fa3f1842d37e66&v=4
url: https://github.com/ilias-ant
- login: kbhatiya999
avatarUrl: https://avatars.githubusercontent.com/u/47816034?v=4
url: https://github.com/kbhatiya999
- login: akanz1
avatarUrl: https://avatars.githubusercontent.com/u/51492342?u=2280f57134118714645e16b535c1a37adf6b369b&v=4
url: https://github.com/akanz1
- login: rychardvale
avatarUrl: https://avatars.githubusercontent.com/u/54805553?u=3d20ab05301d05f9ac3500fb79a2bfee3842b753&v=4
url: https://github.com/rychardvale
- login: athemeart
avatarUrl: https://avatars.githubusercontent.com/u/61623624?v=4
url: https://github.com/athemeart
- login: Rhythmicc
avatarUrl: https://avatars.githubusercontent.com/u/29839231?u=2100781089a259707c475c4547bd7995b0fc18ee&v=4
url: https://github.com/Rhythmicc

View File

@@ -2,13 +2,20 @@ gold:
- url: https://www.deta.sh/?ref=fastapi
title: The launchpad for all your (team's) ideas
img: https://fastapi.tiangolo.com/img/sponsors/deta.svg
- url: https://www.investsuite.com/
title: Wealthtech as a service
img: https://fastapi.tiangolo.com/img/sponsors/investsuite.svg
- url: https://bit.ly/2QSouzH
title: "Jina: build neural search-as-a-service for any kind of data in just minutes."
img: https://fastapi.tiangolo.com/img/sponsors/jina.svg
silver:
- url: https://www.investsuite.com/jobs
title: Wealthtech jobs with FastAPI
img: https://fastapi.tiangolo.com/img/sponsors/investsuite.svg
- url: https://www.vim.so/?utm_source=FastAPI
title: We help you master vim with interactive exercises
img: https://fastapi.tiangolo.com/img/sponsors/vimso.png
- url: https://talkpython.fm/fastapi-sponsor
title: FastAPI video courses on demand from people you trust
img: https://fastapi.tiangolo.com/img/sponsors/talkpython.png
bronze:
- url: https://testdriven.io/courses/tdd-fastapi/
title: Learn to build high-quality web apps with best practices
img: https://fastapi.tiangolo.com/img/sponsors/testdriven.svg
- url: https://jobs.bywetransfer.com/
title: WeTransfer - We deal in big ideas. You in?
img: https://fastapi.tiangolo.com/img/sponsors/wetransfer.svg

View File

@@ -161,10 +161,33 @@ An alternative JSON response using <a href="https://github.com/ultrajson/ultrajs
Returns an HTTP redirect. Uses a 307 status code (Temporary Redirect) by default.
You can return a `RedirectResponse` directly:
```Python hl_lines="2 9"
{!../../../docs_src/custom_response/tutorial006.py!}
```
---
Or you can use it in the `response_class` parameter:
```Python hl_lines="2 7 9"
{!../../../docs_src/custom_response/tutorial006b.py!}
```
If you do that, then you can return the URL directly from your *path operation* function.
In this case, the `status_code` used will be the default one for the `RedirectResponse`, which is `307`.
---
You can also use the `status_code` parameter combined with the `response_class` parameter:
```Python hl_lines="2 7 9"
{!../../../docs_src/custom_response/tutorial006c.py!}
```
### `StreamingResponse`
Takes an async generator or a normal generator/iterator and streams the response body.
@@ -175,14 +198,24 @@ Takes an async generator or a normal generator/iterator and streams the response
#### Using `StreamingResponse` with file-like objects
If you have a file-like object (e.g. the object returned by `open()`), you can return it in a `StreamingResponse`.
If you have a file-like object (e.g. the object returned by `open()`), you can create a generator function to iterate over that file-like object.
That way, you don't have to read it all first in memory, and you can pass that generator function to the `StreamingResponse`, and return it.
This includes many libraries to interact with cloud storage, video processing, and others.
```Python hl_lines="2 10-11"
```{ .python .annotate hl_lines="2 10-12 14" }
{!../../../docs_src/custom_response/tutorial008.py!}
```
1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
2. By using a `with` block, we make sure that the file-like object is closed after the generator function is done. So, after it finishes sending the response.
3. This `yield from` tells the function to iterate over that thing named `file_like`. And then, for each part iterated, yield that part as coming from this generator function.
So, it is a generator function that transfers the "generating" work to something else internally.
By doing it this way, we can put it in a `with` block, and that way, ensure that it is closed after finishing.
!!! tip
Notice that here as we are using standard `open()` that doesn't support `async` and `await`, we declare the path operation with normal `def`.
@@ -203,6 +236,14 @@ File responses will include appropriate `Content-Length`, `Last-Modified` and `E
{!../../../docs_src/custom_response/tutorial009.py!}
```
You can also use the `response_class` parameter:
```Python hl_lines="2 8 10"
{!../../../docs_src/custom_response/tutorial009b.py!}
```
In this case, you can return the file path directly from your *path operation* function.
## Default response class
When creating a **FastAPI** class instance or an `APIRouter` you can specify which response class to use by default.

View File

@@ -0,0 +1,98 @@
# Using Dataclasses
FastAPI is built on top of **Pydantic**, and I have been showing you how to use Pydantic models to declare requests and responses.
But FastAPI also supports using <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> the same way:
```Python hl_lines="1 7-12 19-20"
{!../../../docs_src/dataclasses/tutorial001.py!}
```
This is still thanks to **Pydantic**, as it has <a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>.
So, even with the code above that doesn't use Pydantic explicitly, FastAPI is using Pydantic to convert those standard dataclasses to Pydantic's own flavor of dataclasses.
And of course, it supports the same:
* data validation
* data serialization
* data documentation, etc.
This works the same way as with Pydantic models. And it is actually achieved in the same way underneath, using Pydantic.
!!! info
Have in mind that dataclasses can't do everything Pydantic models can do.
So, you might still need to use Pydantic models.
But if you have a bunch of dataclasses laying around, this is a nice trick to use them to power a web API using FastAPI. 🤓
## Dataclasses in `response_model`
You can also use `dataclasses` in the `response_model` parameter:
```Python hl_lines="1 7-13 19"
{!../../../docs_src/dataclasses/tutorial002.py!}
```
The dataclass will be automatically converted to a Pydantic dataclass.
This way, its schema will show up in the API docs user interface:
<img src="/img/tutorial/dataclasses/image01.png">
## Dataclasses in Nested Data Structures
You can also combine `dataclasses` with other type annotations to make nested data structures.
In some cases, you might still have to use Pydantic's version of `dataclasses`. For example, if you have errors with the automatically generated API documentation.
In that case, you can simply swap the standard `dataclasses` with `pydantic.dataclasses`, which is a drop-in replacement:
```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" }
{!../../../docs_src/dataclasses/tutorial003.py!}
```
1. We still import `field` from standard `dataclasses`.
2. `pydantic.dataclasses` is a drop-in replacement for `dataclasses`.
3. The `Author` dataclass includes a list of `Item` dataclasses.
4. The `Author` dataclass is used as the `response_model` parameter.
5. You can use other standard type annotations with dataclasses as the request body.
In this case, it's a list of `Item` dataclasses.
6. Here we are returning a dictionary that contains `items` which is a list of dataclasses.
FastAPI is still capable of <abbr title="converting the data to a format that can be transmitted">serializing</abbr> the data to JSON.
7. Here the `response_model` is using a type annotation of a list of `Author` dataclasses.
Again, you can combine `dataclasses` with standard type annotations.
8. Notice that this *path operation function* uses regular `def` instead of `async def`.
As always, in FastAPI you can combine `def` and `async def` as needed.
If you need a refresher about when to use which, check out the section _"In a hurry?"_ in the docs about <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank" class="internal-link">`async` and `await`</a>.
9. This *path operation function* is not returning dataclasses (although it could), but a list of dictionaries with internal data.
FastAPI will use the `response_model` parameter (that includes dataclasses) to convert the response.
You can combine `dataclasses` with other type annotations in many different combinations to form complex data structures.
Check the in-code annotation tips above to see more specific details.
## Learn More
You can also combine `dataclasses` with other Pydantic models, inherit from them, include them in your own models, etc.
To learn more, check the <a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/" class="external-link" target="_blank">Pydantic docs about dataclasses</a>.
## Version
This is available since FastAPI version `0.67.0`. 🔖

View File

@@ -157,7 +157,7 @@ The `security_scopes` object (of class `SecurityScopes`) also provides a `scope_
We create an `HTTPException` that we can re-use (`raise`) later at several points.
In this exception, we include the scopes required (if any) as a string separated by spaces (using `scope_str`). We put that string containing the scopes in in the `WWW-Authenticate` header (this is part of the spec).
In this exception, we include the scopes required (if any) as a string separated by spaces (using `scope_str`). We put that string containing the scopes in the `WWW-Authenticate` header (this is part of the spec).
```Python hl_lines="105 107-115"
{!../../../docs_src/security/tutorial005.py!}

View File

@@ -56,10 +56,46 @@ a.internal-link::after {
text-align: center;
}
a.announce:link, a.announce:visited {
a.announce-link:link,
a.announce-link:visited {
color: #fff;
}
a.announce:hover {
a.announce-link:hover {
color: var(--md-accent-fg-color);
}
.announce-wrapper {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
}
.announce-wrapper div.item {
display: none;
}
.announce-wrapper .sponsor-badge {
display: block;
position: absolute;
top: -5px;
right: 0;
font-size: 0.5rem;
color: #999;
background-color: #666;
border-radius: 10px;
padding: 0 10px;
z-index: 10;
}
.announce-wrapper .sponsor-image {
display: block;
border-radius: 20px;
}
.announce-wrapper>div {
min-height: 40px;
display: flex;
align-items: center;
}

View File

@@ -118,7 +118,7 @@ They are supporting my work with **FastAPI** (and others), mainly through <a hre
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}
@@ -126,12 +126,34 @@ They are supporting my work with **FastAPI** (and others), mainly through <a hre
{% if sponsors %}
{% for sponsor in sponsors.silver -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}
### Bronze Sponsors
{% if sponsors %}
{% for sponsor in sponsors.bronze -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}
### Individual Sponsors
{% if people %}
{% if people.sponsors_50 %}
<div class="user-list user-list-center">
{% for user in people.sponsors_50 %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% if people %}
<div class="user-list user-list-center">
{% for user in people.sponsors %}

View File

@@ -92,7 +92,7 @@ You can [contribute](contributing.md){.internal-link target=_blank} to the sourc
* To fix a typo you found on the documentation.
* To share an article, video, or podcast you created or found about FastAPI by <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">editing this file</a>.
* Make sure you add your link to the end of the corresponding section.
* Make sure you add your link to the start of the corresponding section.
* To help [translate the documentation](contributing.md#translations){.internal-link target=_blank} to your language.
* You can also help reviewing the translations created by others.
* To propose new documentation sections.

View File

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 37 KiB

View File

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="429.96896"
height="40"
viewBox="0 0 113.76262 10.583333"
version="1.1"
id="svg853"
inkscape:version="1.0.2 (1.0.2+r75+1)"
sodipodi:docname="fastapi-course-bundle-banner.svg">
<defs
id="defs847" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="222.91167"
inkscape:cy="33.521565"
inkscape:document-units="mm"
inkscape:current-layer="g3355"
inkscape:document-rotation="0"
showgrid="false"
inkscape:snap-object-midpoints="true"
inkscape:snap-center="true"
inkscape:snap-page="true"
inkscape:window-width="1920"
inkscape:window-height="1025"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
units="px" />
<metadata
id="metadata850">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-80.634914,-82.650791)">
<g
id="g3355"
transform="matrix(1.4999999,0,0,1.4999999,-40.317455,-41.325393)">
<rect
style="fill:#ffffff;stroke-width:0.197707;stop-color:#000000"
id="rect1784"
width="75.841751"
height="7.0555558"
x="80.634918"
y="82.650795" />
<g
aria-label="FastAPI Course Bundle. Get 3 in-depth courses. Save 10%!"
transform="scale(1.0561291,0.94685395)"
id="text871"
style="font-size:2.43444px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;stroke-width:0.0608608">
<path
d="m 84.413426,90.970748 h -0.72629 v 0.764329 h -0.228229 v -1.730735 h 1.0722 v 0.187814 h -0.843971 v 0.591968 h 0.72629 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3922" />
<path
d="m 85.526042,91.735077 q -0.01902,-0.03804 -0.03091,-0.135511 -0.153342,0.159285 -0.366117,0.159285 -0.190191,0 -0.312626,-0.106982 -0.121247,-0.108171 -0.121247,-0.2734 0,-0.200888 0.152153,-0.311437 0.153341,-0.111737 0.430306,-0.111737 h 0.213965 v -0.101038 q 0,-0.115303 -0.06894,-0.183059 -0.06894,-0.06894 -0.203266,-0.06894 -0.11768,0 -0.197323,0.05943 -0.07964,0.05943 -0.07964,0.143831 h -0.221096 q 0,-0.09628 0.06775,-0.185436 0.06894,-0.09034 0.185436,-0.142643 0.11768,-0.0523 0.257946,-0.0523 0.222285,0 0.348286,0.111737 0.126002,0.110548 0.130756,0.305494 v 0.591968 q 0,0.177115 0.04517,0.28172 v 0.01902 z m -0.364929,-0.167606 q 0.103416,0 0.196134,-0.05349 0.09272,-0.05349 0.134323,-0.139077 v -0.263889 h -0.172361 q -0.404155,0 -0.404155,0.23655 0,0.103416 0.06894,0.161662 0.06894,0.05824 0.177115,0.05824 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3924" />
<path
d="m 86.807451,91.393922 q 0,-0.08915 -0.06776,-0.137888 -0.06657,-0.04993 -0.234172,-0.08558 -0.166417,-0.03566 -0.265078,-0.08559 -0.09747,-0.04993 -0.14502,-0.118869 -0.04636,-0.06894 -0.04636,-0.16404 0,-0.158096 0.133133,-0.267455 0.134322,-0.10936 0.342343,-0.10936 0.21872,0 0.35423,0.112926 0.1367,0.112925 0.1367,0.288852 h -0.221097 q 0,-0.09034 -0.07726,-0.155719 -0.07608,-0.06538 -0.192568,-0.06538 -0.120058,0 -0.187813,0.0523 -0.06776,0.0523 -0.06776,0.136699 0,0.07964 0.063,0.120058 0.063,0.04042 0.22704,0.07726 0.165228,0.03685 0.267456,0.08796 0.102227,0.05111 0.150964,0.123624 0.04993,0.07132 0.04993,0.174737 0,0.172361 -0.137888,0.276966 -0.137889,0.103416 -0.357797,0.103416 -0.154529,0 -0.273399,-0.05468 -0.118869,-0.05468 -0.186624,-0.152153 -0.06657,-0.09866 -0.06657,-0.212775 h 0.219908 q 0.0059,0.110548 0.08796,0.175926 0.08321,0.06419 0.218719,0.06419 0.124813,0 0.199701,-0.04993 0.07608,-0.05111 0.07608,-0.135511 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3926" />
<path
d="m 87.612195,90.137476 v 0.311437 h 0.240116 v 0.169983 h -0.240116 v 0.797612 q 0,0.07727 0.03209,0.116491 0.03209,0.03804 0.109359,0.03804 0.03804,0 0.104605,-0.01426 v 0.178304 q -0.08677,0.02377 -0.168794,0.02377 -0.147398,0 -0.222285,-0.08915 -0.07489,-0.08915 -0.07489,-0.253191 v -0.797612 h -0.234172 v -0.169983 h 0.234172 v -0.311437 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3928" />
<path
d="m 89.098059,91.283374 h -0.725102 l -0.16285,0.451703 h -0.235361 l 0.660912,-1.730735 h 0.1997 l 0.662102,1.730735 h -0.234173 z m -0.656157,-0.187813 h 0.588402 l -0.294796,-0.809499 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3930" />
<path
d="m 89.958671,91.057523 v 0.677554 h -0.228228 v -1.730735 h 0.638327 q 0.284097,0 0.444571,0.145021 0.161662,0.14502 0.161662,0.383947 0,0.252003 -0.158096,0.388702 -0.156908,0.135511 -0.450514,0.135511 z m 0,-0.186625 h 0.410099 q 0.183058,0 0.280531,-0.08558 0.09747,-0.08678 0.09747,-0.249626 0,-0.15453 -0.09747,-0.247247 -0.09747,-0.09272 -0.267455,-0.09628 h -0.423175 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3932" />
<path
d="m 91.511103,91.735077 h -0.228229 v -1.730735 h 0.228229 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3934" />
<path
d="m 93.843315,91.158562 q -0.02021,0.279342 -0.206833,0.439815 -0.185436,0.160474 -0.48974,0.160474 -0.332834,0 -0.524213,-0.223474 -0.190191,-0.224663 -0.190191,-0.615742 v -0.105794 q 0,-0.249625 0.08796,-0.439816 0.08796,-0.19019 0.250814,-0.291229 0.164039,-0.102228 0.380381,-0.102228 0.29955,0 0.482609,0.160474 0.183058,0.160473 0.211587,0.450514 h -0.356607 q -0.01308,-0.167606 -0.09391,-0.242493 -0.07964,-0.07608 -0.243682,-0.07608 -0.178303,0 -0.267455,0.128378 -0.08796,0.12719 -0.09034,0.395834 v 0.130756 q 0,0.280532 0.0844,0.410099 0.08559,0.129567 0.268645,0.129567 0.165228,0 0.246059,-0.07489 0.08202,-0.07608 0.09391,-0.234172 z"
style="font-weight:bold"
id="path3936" />
<path
d="m 94.001411,91.080108 q 0,-0.191379 0.0737,-0.341154 0.0737,-0.149776 0.211587,-0.231795 0.139077,-0.08202 0.322135,-0.08202 0.260324,0 0.424363,0.159285 0.165228,0.159284 0.184247,0.432683 l 0.0024,0.08796 q 0,0.295985 -0.165228,0.475477 -0.165229,0.178304 -0.443382,0.178304 -0.278154,0 -0.444571,-0.178304 -0.165228,-0.178304 -0.165228,-0.484986 z m 0.343532,0.02496 q 0,0.183059 0.06894,0.280532 0.06894,0.09628 0.197323,0.09628 0.124812,0 0.194945,-0.0951 0.07013,-0.09628 0.07013,-0.306682 0,-0.179492 -0.07013,-0.278154 -0.07013,-0.09866 -0.197323,-0.09866 -0.126001,0 -0.194945,0.09866 -0.06894,0.09747 -0.06894,0.303116 z"
style="font-weight:bold"
id="path3938" />
<path
d="m 96.204056,91.604321 q -0.12719,0.15453 -0.351853,0.15453 -0.206832,0 -0.316192,-0.118869 -0.108171,-0.11887 -0.110548,-0.348287 v -0.842782 h 0.343532 v 0.830895 q 0,0.200889 0.183058,0.200889 0.174738,0 0.240116,-0.121247 v -0.910537 h 0.34472 v 1.286164 h -0.323324 z"
style="font-weight:bold"
id="path3940" />
<path
d="m 97.521126,90.771048 q -0.07013,-0.0095 -0.123624,-0.0095 -0.194945,0 -0.255568,0.131944 v 0.841594 h -0.343532 v -1.286164 h 0.324513 l 0.0095,0.153341 q 0.103416,-0.177115 0.286475,-0.177115 0.05706,0 0.106982,0.01545 z"
style="font-weight:bold"
id="path3942" />
<path
d="m 98.384116,91.379658 q 0,-0.063 -0.063,-0.09866 -0.06181,-0.03685 -0.1997,-0.06538 -0.458835,-0.09628 -0.458835,-0.389891 0,-0.171172 0.141455,-0.285286 0.142643,-0.115303 0.37206,-0.115303 0.244871,0 0.39108,0.115303 0.147397,0.115303 0.147397,0.29955 h -0.343531 q 0,-0.0737 -0.04755,-0.121246 -0.04755,-0.04874 -0.148587,-0.04874 -0.08677,0 -0.134322,0.03923 -0.04755,0.03923 -0.04755,0.09985 0,0.05706 0.05349,0.09272 0.05468,0.03447 0.183058,0.06062 0.128379,0.02496 0.216342,0.05706 0.27221,0.09985 0.27221,0.345909 0,0.175926 -0.150963,0.285286 -0.150964,0.108171 -0.389891,0.108171 -0.161662,0 -0.287663,-0.05706 -0.124813,-0.05825 -0.196135,-0.158096 -0.07132,-0.101039 -0.07132,-0.217531 h 0.325701 q 0.0048,0.09153 0.06776,0.140266 0.063,0.04874 0.168794,0.04874 0.09866,0 0.148586,-0.03685 0.05111,-0.03804 0.05111,-0.09866 z"
style="font-weight:bold"
id="path3944" />
<path
d="m 99.530014,91.758851 q -0.282909,0 -0.461212,-0.173549 -0.177115,-0.173549 -0.177115,-0.462401 v -0.03328 q 0,-0.193756 0.07489,-0.345909 0.07489,-0.153341 0.211587,-0.235361 0.137888,-0.08321 0.313815,-0.08321 0.263889,0 0.414853,0.166417 0.152151,0.166417 0.152151,0.47191 v 0.140266 h -0.819007 q 0.01664,0.126001 0.09985,0.202077 0.0844,0.07608 0.212776,0.07608 0.198511,0 0.310248,-0.143832 l 0.168793,0.189002 q -0.07726,0.10936 -0.209208,0.171171 -0.131945,0.06062 -0.292418,0.06062 z m -0.03923,-1.055558 q -0.102227,0 -0.166417,0.06894 -0.063,0.06894 -0.08083,0.197323 h 0.477854 v -0.02734 q -0.0024,-0.114115 -0.06181,-0.175927 -0.05943,-0.063 -0.168794,-0.063 z"
style="font-weight:bold"
id="path3946" />
<path
d="m 100.88631,91.735077 v -1.730735 h 0.60623 q 0.31501,0 0.47786,0.121247 0.16285,0.120058 0.16285,0.353041 0,0.12719 -0.0654,0.224663 -0.0654,0.09628 -0.18187,0.141454 0.13313,0.03328 0.20921,0.134322 0.0773,0.101039 0.0773,0.247248 0,0.249625 -0.15928,0.378004 -0.15928,0.128379 -0.45408,0.130756 z m 0.35661,-0.75363 v 0.467155 h 0.30549 q 0.126,0 0.19614,-0.05943 0.0713,-0.06062 0.0713,-0.166417 0,-0.237738 -0.24606,-0.241304 z m 0,-0.252003 h 0.26389 q 0.26983,-0.0048 0.26983,-0.215153 0,-0.117681 -0.0689,-0.168794 -0.0678,-0.0523 -0.21516,-0.0523 h -0.24962 z"
style="font-weight:bold"
id="path3948" />
<path
d="m 103.18881,91.604321 q -0.12719,0.15453 -0.35186,0.15453 -0.20683,0 -0.31619,-0.118869 -0.10817,-0.11887 -0.11055,-0.348287 v -0.842782 h 0.34353 v 0.830895 q 0,0.200889 0.18306,0.200889 0.17474,0 0.24012,-0.121247 v -0.910537 h 0.34472 v 1.286164 h -0.32333 z"
style="font-weight:bold"
id="path3950" />
<path
d="m 104.09934,90.448913 0.0107,0.148586 q 0.13789,-0.17236 0.36968,-0.17236 0.20446,0 0.30431,0.120058 0.0999,0.120058 0.10223,0.358985 v 0.830895 h -0.34353 v -0.822575 q 0,-0.109359 -0.0476,-0.158095 -0.0476,-0.04993 -0.1581,-0.04993 -0.14502,0 -0.21753,0.123624 v 0.906972 h -0.34353 v -1.286164 z"
style="font-weight:bold"
id="path3952" />
<path
d="m 105.09428,91.082485 q 0,-0.300739 0.13432,-0.479042 0.13551,-0.178304 0.36968,-0.178304 0.18782,0 0.31025,0.140266 v -0.656158 h 0.34472 v 1.82583 H 105.943 l -0.0166,-0.1367 q -0.12838,0.160474 -0.33045,0.160474 -0.22704,0 -0.36493,-0.178304 -0.1367,-0.179492 -0.1367,-0.498062 z m 0.34353,0.02496 q 0,0.180681 0.063,0.276965 0.063,0.09628 0.18306,0.09628 0.15928,0 0.22466,-0.134322 v -0.507571 q -0.0642,-0.134323 -0.22228,-0.134323 -0.24844,0 -0.24844,0.402967 z"
style="font-weight:bold"
id="path3954" />
<path
d="m 106.88445,91.735077 h -0.34472 v -1.82583 h 0.34472 z"
style="font-weight:bold"
id="path3956" />
<path
d="m 107.76051,91.758851 q -0.28291,0 -0.46121,-0.173549 -0.17711,-0.173549 -0.17711,-0.462401 v -0.03328 q 0,-0.193756 0.0749,-0.345909 0.0749,-0.153341 0.21159,-0.235361 0.13789,-0.08321 0.31382,-0.08321 0.26388,0 0.41485,0.166417 0.15215,0.166417 0.15215,0.47191 v 0.140266 h -0.81901 q 0.0166,0.126001 0.0998,0.202077 0.0844,0.07608 0.21278,0.07608 0.19851,0 0.31025,-0.143832 l 0.16879,0.189002 q -0.0773,0.10936 -0.20921,0.171171 -0.13194,0.06062 -0.29242,0.06062 z m -0.0392,-1.055558 q -0.10223,0 -0.16642,0.06894 -0.063,0.06894 -0.0808,0.197323 h 0.47785 v -0.02734 q -0.002,-0.114115 -0.0618,-0.175927 -0.0594,-0.063 -0.16879,-0.063 z"
style="font-weight:bold"
id="path3958" />
<path
d="m 108.52484,91.619774 q 0,-0.05706 0.0333,-0.0951 0.0345,-0.03804 0.10222,-0.03804 0.0678,0 0.10223,0.03804 0.0357,0.03804 0.0357,0.0951 0,0.05468 -0.0357,0.09153 -0.0345,0.03685 -0.10223,0.03685 -0.0677,0 -0.10222,-0.03685 -0.0333,-0.03685 -0.0333,-0.09153 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3960" />
<path
d="m 111.07815,91.508037 q -0.088,0.126001 -0.24606,0.189002 -0.15691,0.06181 -0.36612,0.06181 -0.21158,0 -0.37562,-0.09866 -0.16404,-0.09985 -0.25438,-0.282908 -0.0892,-0.183059 -0.0915,-0.424363 v -0.150964 q 0,-0.391079 0.18187,-0.606232 0.18306,-0.215154 0.51351,-0.215154 0.27103,0 0.43625,0.139077 0.16523,0.137889 0.20208,0.392268 h -0.22823 q -0.0642,-0.343531 -0.40891,-0.343531 -0.22942,0 -0.34828,0.161662 -0.11768,0.160473 -0.11887,0.465967 v 0.141454 q 0,0.291229 0.13313,0.46359 0.13313,0.171171 0.36017,0.171171 0.12838,0 0.22467,-0.02853 0.0963,-0.02853 0.15928,-0.09628 v -0.388702 h -0.40059 v -0.185436 h 0.62763 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3962" />
<path
d="m 111.95897,91.758851 q -0.26151,0 -0.42555,-0.171172 -0.16404,-0.17236 -0.16404,-0.460023 v -0.04042 q 0,-0.191379 0.0725,-0.341154 0.0737,-0.150964 0.20445,-0.235361 0.13195,-0.08559 0.28529,-0.08559 0.25081,0 0.38989,0.165228 0.13908,0.165228 0.13908,0.473099 v 0.09153 h -0.87131 q 0.005,0.19019 0.11055,0.307871 0.10698,0.116491 0.27102,0.116491 0.11649,0 0.19732,-0.04755 0.0808,-0.04755 0.14145,-0.126002 l 0.13433,0.104605 q -0.16167,0.248437 -0.48499,0.248437 z m -0.0273,-1.153031 q -0.13313,0 -0.22347,0.09747 -0.0903,0.09628 -0.11174,0.271021 h 0.64427 v -0.01664 q -0.01,-0.167606 -0.0903,-0.259135 -0.0808,-0.09272 -0.21872,-0.09272 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3964" />
<path
d="m 113.01215,90.137476 v 0.311437 h 0.24012 v 0.169983 h -0.24012 v 0.797612 q 0,0.07727 0.0321,0.116491 0.0321,0.03804 0.10936,0.03804 0.038,0 0.1046,-0.01426 v 0.178304 q -0.0868,0.02377 -0.16879,0.02377 -0.1474,0 -0.22229,-0.08915 -0.0749,-0.08915 -0.0749,-0.253191 v -0.797612 h -0.23417 v -0.169983 h 0.23417 v -0.311437 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3966" />
<path
d="m 114.40886,90.762727 h 0.16523 q 0.15572,-0.0024 0.24487,-0.08202 0.0891,-0.07964 0.0891,-0.215153 0,-0.304305 -0.30311,-0.304305 -0.14264,0 -0.22823,0.08202 -0.0844,0.08083 -0.0844,0.215153 h -0.21991 q 0,-0.205643 0.14978,-0.341154 0.15096,-0.1367 0.38276,-0.1367 0.24487,0 0.38395,0.129568 0.13907,0.129567 0.13907,0.360173 0,0.112926 -0.0737,0.21872 -0.0725,0.105793 -0.19851,0.158095 0.14264,0.04517 0.21991,0.149776 0.0784,0.104604 0.0784,0.255568 0,0.232984 -0.15215,0.369683 -0.15215,0.1367 -0.39583,0.1367 -0.24368,0 -0.39703,-0.131945 -0.15215,-0.131945 -0.15215,-0.348287 h 0.2211 q 0,0.1367 0.0892,0.21872 0.0892,0.08202 0.23893,0.08202 0.15928,0 0.24368,-0.08321 0.0844,-0.08321 0.0844,-0.238927 0,-0.150964 -0.0927,-0.231795 -0.0927,-0.08083 -0.26746,-0.08321 h -0.16523 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3968" />
<path
d="m 116.32385,91.735077 h -0.21991 v -1.286164 h 0.21991 z m -0.23774,-1.627319 q 0,-0.05349 0.0321,-0.09034 0.0333,-0.03685 0.0975,-0.03685 0.0642,0 0.0975,0.03685 0.0333,0.03685 0.0333,0.09034 0,0.05349 -0.0333,0.08915 -0.0333,0.03566 -0.0975,0.03566 -0.0642,0 -0.0975,-0.03566 -0.0321,-0.03566 -0.0321,-0.08915 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3970" />
<path
d="m 116.88253,90.448913 0.007,0.161662 q 0.1474,-0.185436 0.38514,-0.185436 0.40772,0 0.41129,0.460024 v 0.849914 h -0.21991 v -0.851103 q -0.001,-0.139077 -0.0642,-0.205644 -0.0618,-0.06657 -0.19376,-0.06657 -0.10698,0 -0.18781,0.05706 -0.0808,0.05706 -0.126,0.149775 v 0.916481 h -0.21991 v -1.286164 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3972" />
<path
d="m 118.47775,91.089617 h -0.58008 v -0.179492 h 0.58008 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3974" />
<path
d="m 118.63704,91.081297 q 0,-0.295984 0.14026,-0.475477 0.14027,-0.180681 0.36731,-0.180681 0.22585,0 0.3578,0.15453 v -0.670422 h 0.2199 v 1.82583 h -0.20207 l -0.0107,-0.137888 q -0.13195,0.161662 -0.36731,0.161662 -0.22347,0 -0.36493,-0.183059 -0.14026,-0.183058 -0.14026,-0.477854 z m 0.21991,0.02496 q 0,0.218719 0.0903,0.342343 0.0903,0.123624 0.24962,0.123624 0.20921,0 0.3055,-0.187813 v -0.59078 q -0.0987,-0.181869 -0.30312,-0.181869 -0.16166,0 -0.252,0.124812 -0.0903,0.124813 -0.0903,0.369683 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3976" />
<path
d="m 120.59838,91.758851 q -0.26151,0 -0.42555,-0.171172 -0.16404,-0.17236 -0.16404,-0.460023 v -0.04042 q 0,-0.191379 0.0725,-0.341154 0.0737,-0.150964 0.20445,-0.235361 0.13195,-0.08559 0.28529,-0.08559 0.25081,0 0.38989,0.165228 0.13908,0.165228 0.13908,0.473099 v 0.09153 h -0.87131 q 0.005,0.19019 0.11054,0.307871 0.10699,0.116491 0.27103,0.116491 0.11649,0 0.19732,-0.04755 0.0808,-0.04755 0.14145,-0.126002 l 0.13432,0.104605 q -0.16166,0.248437 -0.48498,0.248437 z m -0.0273,-1.153031 q -0.13313,0 -0.22348,0.09747 -0.0903,0.09628 -0.11173,0.271021 h 0.64427 v -0.01664 q -0.01,-0.167606 -0.0903,-0.259135 -0.0808,-0.09272 -0.21872,-0.09272 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3978" />
<path
d="m 122.43966,91.106259 q 0,0.293607 -0.13432,0.473099 -0.13432,0.179493 -0.36374,0.179493 -0.23417,0 -0.36849,-0.148587 v 0.619309 h -0.21991 v -1.78066 h 0.20089 l 0.0107,0.142643 q 0.13432,-0.166417 0.37325,-0.166417 0.23179,0 0.36611,0.174738 0.13551,0.174737 0.13551,0.486174 z m -0.2199,-0.02496 q 0,-0.217531 -0.0927,-0.343532 -0.0927,-0.126001 -0.25438,-0.126001 -0.1997,0 -0.29955,0.177115 v 0.614553 q 0.0987,0.175926 0.30193,0.175926 0.15809,0 0.25081,-0.124812 0.0939,-0.126002 0.0939,-0.373249 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3980" />
<path
d="m 123.01618,90.137476 v 0.311437 h 0.24011 v 0.169983 h -0.24011 v 0.797612 q 0,0.07727 0.0321,0.116491 0.0321,0.03804 0.10936,0.03804 0.038,0 0.10461,-0.01426 v 0.178304 q -0.0868,0.02377 -0.1688,0.02377 -0.1474,0 -0.22228,-0.08915 -0.0749,-0.08915 -0.0749,-0.253191 v -0.797612 h -0.23417 v -0.169983 h 0.23417 v -0.311437 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3982" />
<path
d="m 123.73177,90.604631 q 0.14621,-0.179492 0.38038,-0.179492 0.40772,0 0.41129,0.460024 v 0.849914 h -0.21991 v -0.851103 q -0.001,-0.139077 -0.0642,-0.205644 -0.0618,-0.06657 -0.19376,-0.06657 -0.10698,0 -0.18781,0.05706 -0.0808,0.05706 -0.126,0.149775 v 0.916481 h -0.21991 v -1.82583 h 0.21991 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3984" />
<path
d="m 125.97245,91.579358 q 0.11769,0 0.20565,-0.07132 0.088,-0.07132 0.0975,-0.178304 h 0.20802 q -0.006,0.110548 -0.0761,0.210399 -0.0701,0.09985 -0.18782,0.159284 -0.11649,0.05944 -0.24725,0.05944 -0.2627,0 -0.41841,-0.174738 -0.15453,-0.175926 -0.15453,-0.480231 v -0.03685 q 0,-0.187813 0.0689,-0.334022 0.0689,-0.146209 0.19732,-0.22704 0.12957,-0.08083 0.3055,-0.08083 0.21634,0 0.35898,0.129567 0.14383,0.129568 0.15334,0.3364 h -0.20802 q -0.01,-0.124813 -0.0951,-0.204455 -0.0844,-0.08083 -0.20921,-0.08083 -0.16761,0 -0.26033,0.121247 -0.0915,0.120057 -0.0915,0.348286 v 0.0416 q 0,0.222286 0.0915,0.342344 0.0915,0.120057 0.26151,0.120057 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3986" />
<path
d="m 126.67259,91.080108 q 0,-0.189002 0.0737,-0.339966 0.0749,-0.150964 0.20683,-0.232983 0.13314,-0.08202 0.30312,-0.08202 0.2627,0 0.42436,0.18187 0.16285,0.18187 0.16285,0.483797 v 0.01545 q 0,0.187813 -0.0725,0.337589 -0.0713,0.148586 -0.20564,0.231794 -0.13313,0.08321 -0.30668,0.08321 -0.26151,0 -0.42436,-0.18187 -0.16167,-0.18187 -0.16167,-0.48142 z m 0.2211,0.02615 q 0,0.213965 0.0987,0.343532 0.0999,0.129567 0.26627,0.129567 0.1676,0 0.26627,-0.130756 0.0987,-0.131944 0.0987,-0.368494 0,-0.211587 -0.10104,-0.342343 -0.0999,-0.131945 -0.26627,-0.131945 -0.16285,0 -0.2627,0.129567 -0.0998,0.129568 -0.0998,0.370872 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3988" />
<path
d="m 128.91327,91.607887 q -0.12837,0.150964 -0.37681,0.150964 -0.20564,0 -0.31381,-0.118869 -0.10699,-0.120058 -0.10818,-0.35423 v -0.836839 h 0.21991 v 0.830895 q 0,0.292418 0.23774,0.292418 0.252,0 0.33521,-0.187813 v -0.9355 h 0.21991 v 1.286164 h -0.20921 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3990" />
<path
d="m 130.08176,90.646236 q -0.0499,-0.0083 -0.10817,-0.0083 -0.21634,0 -0.29361,0.184247 v 0.912915 h -0.21991 v -1.286164 h 0.21397 l 0.004,0.148586 q 0.10817,-0.17236 0.30669,-0.17236 0.0642,0 0.0975,0.01664 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3992" />
<path
d="m 131.03152,91.393922 q 0,-0.08915 -0.0677,-0.137888 -0.0666,-0.04993 -0.23418,-0.08558 -0.16641,-0.03566 -0.26507,-0.08559 -0.0975,-0.04993 -0.14502,-0.118869 -0.0464,-0.06894 -0.0464,-0.16404 0,-0.158096 0.13313,-0.267455 0.13432,-0.10936 0.34234,-0.10936 0.21872,0 0.35423,0.112926 0.1367,0.112925 0.1367,0.288852 h -0.22109 q 0,-0.09034 -0.0773,-0.155719 -0.0761,-0.06538 -0.19257,-0.06538 -0.12005,0 -0.18781,0.0523 -0.0677,0.0523 -0.0677,0.136699 0,0.07964 0.063,0.120058 0.063,0.04042 0.22704,0.07726 0.16522,0.03685 0.26745,0.08796 0.10223,0.05111 0.15097,0.123624 0.0499,0.07132 0.0499,0.174737 0,0.172361 -0.13789,0.276966 -0.13789,0.103416 -0.35779,0.103416 -0.15453,0 -0.2734,-0.05468 -0.11887,-0.05468 -0.18663,-0.152153 -0.0666,-0.09866 -0.0666,-0.212775 h 0.2199 q 0.006,0.110548 0.088,0.175926 0.0832,0.06419 0.21872,0.06419 0.12481,0 0.1997,-0.04993 0.0761,-0.05111 0.0761,-0.135511 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3994" />
<path
d="m 132.07163,91.758851 q -0.26151,0 -0.42555,-0.171172 -0.16404,-0.17236 -0.16404,-0.460023 v -0.04042 q 0,-0.191379 0.0725,-0.341154 0.0737,-0.150964 0.20445,-0.235361 0.13195,-0.08559 0.28529,-0.08559 0.25081,0 0.38989,0.165228 0.13908,0.165228 0.13908,0.473099 v 0.09153 h -0.87131 q 0.005,0.19019 0.11054,0.307871 0.10699,0.116491 0.27103,0.116491 0.11649,0 0.19732,-0.04755 0.0808,-0.04755 0.14145,-0.126002 l 0.13433,0.104605 q -0.16167,0.248437 -0.48499,0.248437 z m -0.0273,-1.153031 q -0.13313,0 -0.22347,0.09747 -0.0903,0.09628 -0.11174,0.271021 h 0.64427 v -0.01664 q -0.01,-0.167606 -0.0903,-0.259135 -0.0808,-0.09272 -0.21872,-0.09272 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3996" />
<path
d="m 133.57532,91.393922 q 0,-0.08915 -0.0678,-0.137888 -0.0666,-0.04993 -0.23417,-0.08558 -0.16642,-0.03566 -0.26508,-0.08559 -0.0975,-0.04993 -0.14502,-0.118869 -0.0464,-0.06894 -0.0464,-0.16404 0,-0.158096 0.13313,-0.267455 0.13432,-0.10936 0.34234,-0.10936 0.21872,0 0.35423,0.112926 0.1367,0.112925 0.1367,0.288852 h -0.22109 q 0,-0.09034 -0.0773,-0.155719 -0.0761,-0.06538 -0.19257,-0.06538 -0.12005,0 -0.18781,0.0523 -0.0678,0.0523 -0.0678,0.136699 0,0.07964 0.063,0.120058 0.063,0.04042 0.22704,0.07726 0.16522,0.03685 0.26745,0.08796 0.10223,0.05111 0.15097,0.123624 0.0499,0.07132 0.0499,0.174737 0,0.172361 -0.13789,0.276966 -0.13789,0.103416 -0.35779,0.103416 -0.15453,0 -0.2734,-0.05468 -0.11887,-0.05468 -0.18663,-0.152153 -0.0666,-0.09866 -0.0666,-0.212775 h 0.2199 q 0.006,0.110548 0.088,0.175926 0.0832,0.06419 0.21872,0.06419 0.12481,0 0.1997,-0.04993 0.0761,-0.05111 0.0761,-0.135511 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path3998" />
<path
d="m 134.08646,91.619774 q 0,-0.05706 0.0333,-0.0951 0.0345,-0.03804 0.10223,-0.03804 0.0677,0 0.10223,0.03804 0.0357,0.03804 0.0357,0.0951 0,0.05468 -0.0357,0.09153 -0.0345,0.03685 -0.10223,0.03685 -0.0678,0 -0.10223,-0.03685 -0.0333,-0.03685 -0.0333,-0.09153 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto;-inkscape-font-specification:Roboto;stroke-width:0.0608608"
id="path4000" />
<path
d="m 136.21303,91.280997 q 0,-0.101039 -0.0713,-0.15453 -0.0713,-0.05468 -0.25676,-0.114114 -0.18544,-0.06062 -0.29361,-0.11887 -0.29479,-0.159284 -0.29479,-0.429117 0,-0.140266 0.0785,-0.249625 0.0796,-0.110549 0.22704,-0.172361 0.14859,-0.06181 0.33284,-0.06181 0.18543,0 0.33045,0.06776 0.14502,0.06657 0.22466,0.189002 0.0808,0.122435 0.0808,0.278154 h -0.35661 q 0,-0.11887 -0.0749,-0.184248 -0.0749,-0.06657 -0.2104,-0.06657 -0.13075,0 -0.20326,0.05587 -0.0725,0.05468 -0.0725,0.145021 0,0.0844 0.0844,0.141454 0.0856,0.05706 0.25082,0.106982 0.3043,0.09153 0.44338,0.22704 0.13908,0.135511 0.13908,0.337588 0,0.224663 -0.16999,0.353042 -0.16998,0.12719 -0.45764,0.12719 -0.1997,0 -0.36374,-0.07251 -0.16404,-0.0737 -0.25082,-0.200889 -0.0856,-0.12719 -0.0856,-0.294796 h 0.35779 q 0,0.286475 0.34235,0.286475 0.12719,0 0.19851,-0.05111 0.0713,-0.0523 0.0713,-0.14502 z"
style="font-weight:bold"
id="path4002" />
<path
d="m 137.53604,91.735077 q -0.0238,-0.04636 -0.0345,-0.115303 -0.12481,0.139077 -0.32451,0.139077 -0.18901,0 -0.31382,-0.10936 -0.12362,-0.109359 -0.12362,-0.275776 0,-0.204455 0.15096,-0.313815 0.15215,-0.109359 0.43863,-0.110548 h 0.15809 v -0.0737 q 0,-0.08915 -0.0464,-0.142643 -0.0452,-0.05349 -0.14384,-0.05349 -0.0868,0 -0.1367,0.0416 -0.0487,0.0416 -0.0487,0.114115 h -0.34353 q 0,-0.111737 0.0689,-0.206833 0.0689,-0.0951 0.19495,-0.148586 0.126,-0.05468 0.2829,-0.05468 0.23774,0 0.37682,0.120058 0.14027,0.118869 0.14027,0.335211 v 0.557496 q 0.001,0.183059 0.0511,0.276965 v 0.02021 z m -0.2841,-0.238927 q 0.0761,0 0.14027,-0.03328 0.0642,-0.03447 0.0951,-0.09153 v -0.221096 h -0.12837 q -0.25795,0 -0.27459,0.178303 l -0.001,0.02021 q 0,0.06419 0.0452,0.105794 0.0452,0.0416 0.12362,0.0416 z"
style="font-weight:bold"
id="path4004" />
<path
d="m 138.5607,91.315469 0.23892,-0.866556 h 0.35899 l -0.43388,1.286164 h -0.32807 l -0.43388,-1.286164 h 0.35899 z"
style="font-weight:bold"
id="path4006" />
<path
d="m 139.88846,91.758851 q -0.2829,0 -0.46121,-0.173549 -0.17711,-0.173549 -0.17711,-0.462401 v -0.03328 q 0,-0.193756 0.0749,-0.345909 0.0749,-0.153341 0.21159,-0.235361 0.13789,-0.08321 0.31382,-0.08321 0.26389,0 0.41485,0.166417 0.15215,0.166417 0.15215,0.47191 v 0.140266 h -0.81901 q 0.0166,0.126001 0.0999,0.202077 0.0844,0.07608 0.21278,0.07608 0.19851,0 0.31025,-0.143832 l 0.16879,0.189002 q -0.0773,0.10936 -0.20921,0.171171 -0.13194,0.06062 -0.29242,0.06062 z m -0.0392,-1.055558 q -0.10223,0 -0.16642,0.06894 -0.063,0.06894 -0.0808,0.197323 h 0.47785 v -0.02734 q -0.002,-0.114115 -0.0618,-0.175927 -0.0594,-0.063 -0.16879,-0.063 z"
style="font-weight:bold"
id="path4008" />
<path
d="m 142.04237,91.735077 h -0.34353 v -1.324202 l -0.4101,0.12719 v -0.279343 l 0.71678,-0.256757 h 0.0369 z"
style="font-weight:bold"
id="path4010" />
<path
d="m 143.77073,91.019485 q 0,0.358984 -0.14859,0.549175 -0.14858,0.190191 -0.43506,0.190191 -0.28291,0 -0.43268,-0.186625 -0.14978,-0.186624 -0.15334,-0.534911 v -0.318569 q 0,-0.362551 0.14977,-0.550364 0.15097,-0.187814 0.43388,-0.187814 0.2829,0 0.43268,0.186625 0.14977,0.185436 0.15334,0.533722 z m -0.34353,-0.349476 q 0,-0.215153 -0.0594,-0.312625 -0.0582,-0.09866 -0.18305,-0.09866 -0.12125,0 -0.1795,0.09391 -0.0571,0.09272 -0.0606,0.291229 v 0.420797 q 0,0.211587 0.0571,0.315003 0.0582,0.102228 0.18543,0.102228 0.126,0 0.18187,-0.09866 0.0559,-0.09866 0.0582,-0.301927 z"
style="font-weight:bold"
id="path4012" />
<path
d="m 143.99896,90.337176 q 0,-0.159285 0.10341,-0.257946 0.10342,-0.09985 0.27103,-0.09985 0.16998,0 0.27339,0.09866 0.10342,0.09747 0.10342,0.265078 v 0.08559 q 0,0.160473 -0.10342,0.257946 -0.10341,0.09747 -0.27102,0.09747 -0.16879,0 -0.2734,-0.09747 -0.10341,-0.09866 -0.10341,-0.265078 z m 0.22823,0.09153 q 0,0.07132 0.0404,0.115303 0.0416,0.04279 0.10817,0.04279 0.0666,0 0.1058,-0.04398 0.0392,-0.04398 0.0392,-0.11768 v -0.08796 q 0,-0.07132 -0.0392,-0.115303 -0.0392,-0.04398 -0.10817,-0.04398 -0.0654,0 -0.1058,0.04398 -0.0404,0.04279 -0.0404,0.120058 z m 0.5991,0.882009 q 0,-0.160473 0.1046,-0.257946 0.10461,-0.09866 0.27102,-0.09866 0.1688,0 0.27221,0.09747 0.10461,0.09628 0.10461,0.266267 v 0.08559 q 0,0.159285 -0.10223,0.257946 -0.10223,0.09747 -0.27221,0.09747 -0.17117,0 -0.27459,-0.09866 -0.10341,-0.09866 -0.10341,-0.261512 z m 0.22823,0.09272 q 0,0.06538 0.0428,0.111737 0.0428,0.04636 0.10698,0.04636 0.14502,0 0.14502,-0.160473 v -0.09034 q 0,-0.07132 -0.0404,-0.114114 -0.0404,-0.04398 -0.10699,-0.04398 -0.0666,0 -0.10698,0.04398 -0.0404,0.04279 -0.0404,0.11768 z m -0.61099,0.202078 -0.16761,-0.09034 0.84516,-1.352731 0.16761,0.09034 z"
style="font-weight:bold"
id="path4014" />
<path
d="m 146.16475,91.203732 h -0.28528 l -0.0404,-1.19939 h 0.36612 z m -0.14264,0.187813 q 0.0868,0 0.13908,0.05111 0.0535,0.05111 0.0535,0.130756 0,0.07845 -0.0535,0.129567 -0.0523,0.05111 -0.13908,0.05111 -0.0856,0 -0.13908,-0.05111 -0.0523,-0.05111 -0.0523,-0.129567 0,-0.07845 0.0523,-0.129567 0.0535,-0.0523 0.13908,-0.0523 z"
style="font-weight:bold"
id="path4016" />
</g>
<g
id="g896"
transform="matrix(0.11457918,0,0,0.11457918,82.917314,84.127369)">
<path
fill="#fdd888"
d="m 33,31 c 0,2.2 -1.8,4 -4,4 H 7 C 4.8,35 3,33.2 3,31 V 14 c 0,-2.2 1.8,-4 4,-4 h 22 c 2.2,0 4,1.8 4,4 z"
id="path873" />
<path
fill="#fdd888"
d="m 36,11 c 0,2.2 -1.8,4 -4,4 H 4 C 1.8,15 0,13.2 0,11 0,8.8 1.8,7 4,7 h 28 c 2.2,0 4,1.8 4,4 z"
id="path875" />
<path
fill="#fcab40"
d="m 3,15 h 30 v 2 H 3 Z"
id="path877" />
<path
fill="#da2f47"
d="m 19,3 h -2 c -1.657,0 -3,1.343 -3,3 v 29 h 8 V 6 C 22,4.344 20.657,3 19,3 Z"
id="path879" />
<path
fill="#da2f47"
d="m 16,7 c 1.1,0 1.263,-0.516 0.361,-1.147 L 9.639,1.147 C 8.737,0.516 7.554,0.781 7.008,1.736 L 4.992,5.264 C 4.446,6.219 4.9,7 6,7 Z m 4,0 C 18.9,7 18.737,6.484 19.639,5.853 l 6.723,-4.706 c 0.901,-0.631 2.085,-0.366 2.631,0.589 l 2.016,3.527 C 31.554,6.219 31.1,7 30,7 Z"
id="path881" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -42,6 +42,16 @@
x="0"
y="0" />
</clipPath>
<clipPath
id="clip0-3">
<rect
width="770"
height="222.03999"
fill="#ffffff"
id="rect14-6"
x="0"
y="0" />
</clipPath>
</defs>
<metadata
id="metadata972">
@@ -103,12 +113,12 @@
</g>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.65251px;line-height:1.25;font-family:Roboto, sans-serif;-inkscape-font-specification:'Roboto, sans-serif';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;stroke-width:0.116313"
x="31.727283"
y="21.847746"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;line-height:1.25;font-family:Roboto, sans-serif;-inkscape-font-specification:'Roboto, sans-serif';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;stroke-width:0.116313"
x="31.874025"
y="21.589594"
id="text959"><tspan
id="tspan957"
x="31.727282"
y="21.847746"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Roboto, sans-serif;-inkscape-font-specification:'Roboto, sans-serif';text-align:center;text-anchor:middle;stroke-width:0.116313">Wealthtech as a service</tspan></text>
x="31.874023"
y="21.589594"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Roboto, sans-serif;-inkscape-font-specification:'Roboto, sans-serif';text-align:center;text-anchor:middle;stroke-width:0.116313">Wealthtech jobs with FastAPI</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 41 KiB

View File

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 215 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -40,13 +40,16 @@ The key features are:
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -128,6 +128,35 @@ function setupTermynal() {
loadVisibleTermynals();
}
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
async function showRandomAnnouncement(groupId, timeInterval) {
const announceFastAPI = document.getElementById(groupId);
if (announceFastAPI) {
let children = [].slice.call(announceFastAPI.children);
children = shuffle(children)
let index = 0
const announceRandom = () => {
children.forEach((el, i) => {el.style.display = "none"});
children[index].style.display = "block"
index = (index + 1) % children.length
}
announceRandom()
setInterval(announceRandom, timeInterval
)
}
}
async function main() {
if (div) {
data = await getData()
@@ -144,6 +173,8 @@ async function main() {
}
setupTermynal();
showRandomAnnouncement('announce-left', 5000)
showRandomAnnouncement('announce-right', 10000)
}
main()

View File

@@ -2,6 +2,227 @@
## Latest Changes
## 0.67.0
### Features
* ✨ Add support for `dataclasses` in request bodies and `response_model`. New documentation: [Advanced User Guide - Using Dataclasses](https://fastapi.tiangolo.com/advanced/dataclasses/). PR [#3577](https://github.com/tiangolo/fastapi/pull/3577) by [@tiangolo](https://github.com/tiangolo).
* ✨ Support `dataclasses` in responses. PR [#3576](https://github.com/tiangolo/fastapi/pull/3576) by [@tiangolo](https://github.com/tiangolo), continuation from initial PR [#2722](https://github.com/tiangolo/fastapi/pull/2722) by [@amitlissack](https://github.com/amitlissack).
### Docs
* 📝 Add external link: How to Create A Fake Certificate Authority And Generate TLS Certs for FastAPI. PR [#2839](https://github.com/tiangolo/fastapi/pull/2839) by [@aitoehigie](https://github.com/aitoehigie).
* ✏ Fix code highlighted line in: `body-nested-models.md`. PR [#3463](https://github.com/tiangolo/fastapi/pull/3463) by [@jaystone776](https://github.com/jaystone776).
* ✏ Fix typo in `body-nested-models.md`. PR [#3462](https://github.com/tiangolo/fastapi/pull/3462) by [@jaystone776](https://github.com/jaystone776).
* ✏ Fix typo "might me" -> "might be" in `docs/en/docs/tutorial/schema-extra-example.md`. PR [#3362](https://github.com/tiangolo/fastapi/pull/3362) by [@dbrakman](https://github.com/dbrakman).
* 📝 Add external link: Building simple E-Commerce with NuxtJS and FastAPI. PR [#3271](https://github.com/tiangolo/fastapi/pull/3271) by [@ShahriyarR](https://github.com/ShahriyarR).
* 📝 Add external link: Serve a machine learning model using Sklearn, FastAPI and Docker. PR [#2974](https://github.com/tiangolo/fastapi/pull/2974) by [@rodrigo-arenas](https://github.com/rodrigo-arenas).
* ✏️ Fix typo on docstring in datastructures file. PR [#2887](https://github.com/tiangolo/fastapi/pull/2887) by [@Kludex](https://github.com/Kludex).
* 📝 Add External Link: Deploy FastAPI on Ubuntu and Serve using Caddy 2 Web Server. PR [#3572](https://github.com/tiangolo/fastapi/pull/3572) by [@tiangolo](https://github.com/tiangolo).
* 📝 Add External Link, replaces #1898. PR [#3571](https://github.com/tiangolo/fastapi/pull/3571) by [@tiangolo](https://github.com/tiangolo).
### Internal
* 🎨 Improve style for sponsors, add radius border. PR [#2388](https://github.com/tiangolo/fastapi/pull/2388) by [@Kludex](https://github.com/Kludex).
* 👷 Update GitHub Action latest-changes. PR [#3574](https://github.com/tiangolo/fastapi/pull/3574) by [@tiangolo](https://github.com/tiangolo).
* 👷 Update GitHub Action latest-changes. PR [#3573](https://github.com/tiangolo/fastapi/pull/3573) by [@tiangolo](https://github.com/tiangolo).
* 👷 Rename and clarify CI workflow job names. PR [#3570](https://github.com/tiangolo/fastapi/pull/3570) by [@tiangolo](https://github.com/tiangolo).
* 👷 Update GitHub Action latest-changes, strike 2 ⚾. PR [#3575](https://github.com/tiangolo/fastapi/pull/3575) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Sort external links in docs to have the most recent at the top. PR [#3568](https://github.com/tiangolo/fastapi/pull/3568) by [@tiangolo](https://github.com/tiangolo).
## 0.66.1
### Translations
* 🌐 Add basic setup for German translations. PR [#3522](https://github.com/tiangolo/fastapi/pull/3522) by [@0x4Dark](https://github.com/0x4Dark).
* 🌐 Add Portuguese translation for `docs/tutorial/security/index.md`. PR [#3507](https://github.com/tiangolo/fastapi/pull/3507) by [@oandersonmagalhaes](https://github.com/oandersonmagalhaes).
* 🌐 Add Portuguese translation for `docs/deployment/index.md`. PR [#3337](https://github.com/tiangolo/fastapi/pull/3337) by [@lsglucas](https://github.com/lsglucas).
### Internal
* 🔧 Configure strict pytest options and update/refactor tests. Upgrade pytest to `>=6.2.4,<7.0.0` and pytest-cov to `>=2.12.0,<3.0.0`. Initial PR [#2790](https://github.com/tiangolo/fastapi/pull/2790) by [@graingert](https://github.com/graingert).
* ⬆️ Upgrade python-jose dependency to `>=3.3.0,<4.0.0` for tests. PR [#3468](https://github.com/tiangolo/fastapi/pull/3468) by [@tiangolo](https://github.com/tiangolo).
## 0.66.0
### Features
* ✨ Allow setting the `response_class` to `RedirectResponse` or `FileResponse` and returning the URL from the function. New and updated docs are in the tutorial section **Custom Response - HTML, Stream, File, others**, in [RedirectResponse](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse) and in [FileResponse](https://fastapi.tiangolo.com/advanced/custom-response/#fileresponse). PR [#3457](https://github.com/tiangolo/fastapi/pull/3457) by [@tiangolo](https://github.com/tiangolo).
### Fixes
* 🐛 Fix include/exclude for dicts in `jsonable_encoder`. PR [#2016](https://github.com/tiangolo/fastapi/pull/2016) by [@Rubikoid](https://github.com/Rubikoid).
* 🐛 Support custom OpenAPI / JSON Schema fields in the generated output OpenAPI. PR [#1429](https://github.com/tiangolo/fastapi/pull/1429) by [@jmagnusson](https://github.com/jmagnusson).
### Translations
* 🌐 Add Spanish translation for `tutorial/query-params.md`. PR [#2243](https://github.com/tiangolo/fastapi/pull/2243) by [@mariacamilagl](https://github.com/mariacamilagl).
* 🌐 Add Spanish translation for `advanced/response-directly.md`. PR [#1253](https://github.com/tiangolo/fastapi/pull/1253) by [@jfunez](https://github.com/jfunez).
* 🌐 Add Spanish translation for `advanced/additional-status-codes.md`. PR [#1252](https://github.com/tiangolo/fastapi/pull/1252) by [@jfunez](https://github.com/jfunez).
* 🌐 Add Spanish translation for `advanced/path-operation-advanced-configuration.md`. PR [#1251](https://github.com/tiangolo/fastapi/pull/1251) by [@jfunez](https://github.com/jfunez).
## 0.65.3
### Fixes
* ♻ Assume request bodies contain JSON when no Content-Type header is provided. This fixes a breaking change introduced by [0.65.2 with PR #2118](https://github.com/tiangolo/fastapi/pull/2118). It should allow upgrading FastAPI applications with clients that send JSON data without a `Content-Type` header. And there's still protection against CSRFs. PR [#3456](https://github.com/tiangolo/fastapi/pull/3456) by [@tiangolo](https://github.com/tiangolo).
### Translations
* 🌐 Initialize Indonesian translations. PR [#3014](https://github.com/tiangolo/fastapi/pull/3014) by [@pace-noge](https://github.com/pace-noge).
* 🌐 Add Spanish translation of Tutorial - Path Parameters. PR [#2219](https://github.com/tiangolo/fastapi/pull/2219) by [@mariacamilagl](https://github.com/mariacamilagl).
* 🌐 Add Spanish translation of Tutorial - First Steps. PR [#2208](https://github.com/tiangolo/fastapi/pull/2208) by [@mariacamilagl](https://github.com/mariacamilagl).
* 🌐 Portuguese translation of Tutorial - Body - Fields. PR [#3420](https://github.com/tiangolo/fastapi/pull/3420) by [@ComicShrimp](https://github.com/ComicShrimp).
* 🌐 Add Chinese translation for Tutorial - Request - Forms - and - Files. PR [#3249](https://github.com/tiangolo/fastapi/pull/3249) by [@jaystone776](https://github.com/jaystone776).
* 🌐 Add Chinese translation for Tutorial - Handling - Errors. PR [#3299](https://github.com/tiangolo/fastapi/pull/3299) by [@jaystone776](https://github.com/jaystone776).
* 🌐 Add Chinese translation for Tutorial - Form - Data. PR [#3248](https://github.com/tiangolo/fastapi/pull/3248) by [@jaystone776](https://github.com/jaystone776).
* 🌐 Add Chinese translation for Tutorial - Body - Updates. PR [#3237](https://github.com/tiangolo/fastapi/pull/3237) by [@jaystone776](https://github.com/jaystone776).
* 🌐 Add Chinese translation for FastAPI People. PR [#3112](https://github.com/tiangolo/fastapi/pull/3112) by [@hareru](https://github.com/hareru).
* 🌐 Add French translation for Project Generation. PR [#3197](https://github.com/tiangolo/fastapi/pull/3197) by [@Smlep](https://github.com/Smlep).
* 🌐 Add French translation for Python Types Intro. PR [#3185](https://github.com/tiangolo/fastapi/pull/3185) by [@Smlep](https://github.com/Smlep).
* 🌐 Add French translation for External Links. PR [#3103](https://github.com/tiangolo/fastapi/pull/3103) by [@Smlep](https://github.com/Smlep).
* 🌐 Add French translation for Alternatives, Inspiration and Comparisons. PR [#3020](https://github.com/tiangolo/fastapi/pull/3020) by [@rjNemo](https://github.com/rjNemo).
* 🌐 Fix Chinese translation code snippet mismatch in Tutorial - Python Types Intro. PR [#2573](https://github.com/tiangolo/fastapi/pull/2573) by [@BoYanZh](https://github.com/BoYanZh).
* 🌐 Add Portuguese translation for Development Contributing. PR [#1364](https://github.com/tiangolo/fastapi/pull/1364) by [@Serrones](https://github.com/Serrones).
* 🌐 Add Chinese translation for Tutorial - Request - Files. PR [#3244](https://github.com/tiangolo/fastapi/pull/3244) by [@jaystone776](https://github.com/jaystone776).
### Internal
* 👥 Update FastAPI People. PR [#3450](https://github.com/tiangolo/fastapi/pull/3450) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 👥 Update FastAPI People. PR [#3319](https://github.com/tiangolo/fastapi/pull/3319) by [@github-actions[bot]](https://github.com/apps/github-actions).
* ⬆ Upgrade docs development dependency on `typer-cli` to >=0.0.12 to fix conflicts. PR [#3429](https://github.com/tiangolo/fastapi/pull/3429) by [@tiangolo](https://github.com/tiangolo).
## 0.65.2
### Security fixes
* 🔒 Check Content-Type request header before assuming JSON. Initial PR [#2118](https://github.com/tiangolo/fastapi/pull/2118) by [@patrickkwang](https://github.com/patrickkwang).
This change fixes a [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) security vulnerability when using cookies for authentication in path operations with JSON payloads sent by browsers.
In versions lower than `0.65.2`, FastAPI would try to read the request payload as JSON even if the `content-type` header sent was not set to `application/json` or a compatible JSON media type (e.g. `application/geo+json`).
So, a request with a content type of `text/plain` containing JSON data would be accepted and the JSON data would be extracted.
But requests with content type `text/plain` are exempt from [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) preflights, for being considered [Simple requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests). So, the browser would execute them right away including cookies, and the text content could be a JSON string that would be parsed and accepted by the FastAPI application.
See [CVE-2021-32677](https://github.com/tiangolo/fastapi/security/advisories/GHSA-8h2j-cgx8-6xv7) for more details.
Thanks to [Dima Boger](https://twitter.com/b0g3r) for the security report! 🙇🔒
### Internal
* 🔧 Update sponsors badge, course bundle. PR [#3340](https://github.com/tiangolo/fastapi/pull/3340) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add new gold sponsor Jina 🎉. PR [#3291](https://github.com/tiangolo/fastapi/pull/3291) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add new banner sponsor badge for FastAPI courses bundle. PR [#3288](https://github.com/tiangolo/fastapi/pull/3288) by [@tiangolo](https://github.com/tiangolo).
* 👷 Upgrade Issue Manager GitHub Action. PR [#3236](https://github.com/tiangolo/fastapi/pull/3236) by [@tiangolo](https://github.com/tiangolo).
## 0.65.1
### Security fixes
* 📌 Upgrade pydantic pin, to handle security vulnerability [CVE-2021-29510](https://github.com/samuelcolvin/pydantic/security/advisories/GHSA-5jqp-qgf6-3pvh). PR [#3213](https://github.com/tiangolo/fastapi/pull/3213) by [@tiangolo](https://github.com/tiangolo).
## 0.65.0
### Breaking Changes - Upgrade
* ⬆️ Upgrade Starlette to `0.14.2`, including internal `UJSONResponse` migrated from Starlette. This includes several bug fixes and features from Starlette. PR [#2335](https://github.com/tiangolo/fastapi/pull/2335) by [@hanneskuettner](https://github.com/hanneskuettner).
### Translations
* 🌐 Initialize new language Polish for translations. PR [#3170](https://github.com/tiangolo/fastapi/pull/3170) by [@neternefer](https://github.com/neternefer).
### Internal
* 👷 Add GitHub Action cache to speed up CI installs. PR [#3204](https://github.com/tiangolo/fastapi/pull/3204) by [@tiangolo](https://github.com/tiangolo).
* ⬆️ Upgrade setup-python GitHub Action to v2. PR [#3203](https://github.com/tiangolo/fastapi/pull/3203) by [@tiangolo](https://github.com/tiangolo).
* 🐛 Fix docs script to generate a new translation language with `overrides` boilerplate. PR [#3202](https://github.com/tiangolo/fastapi/pull/3202) by [@tiangolo](https://github.com/tiangolo).
* ✨ Add new Deta banner badge with new sponsorship tier 🙇. PR [#3194](https://github.com/tiangolo/fastapi/pull/3194) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#3189](https://github.com/tiangolo/fastapi/pull/3189) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 🔊 Update FastAPI People to allow better debugging. PR [#3188](https://github.com/tiangolo/fastapi/pull/3188) by [@tiangolo](https://github.com/tiangolo).
## 0.64.0
### Features
* ✨ Add support for adding multiple `examples` in request bodies and path, query, cookie, and header params. New docs: [Declare Request Example Data](https://fastapi.tiangolo.com/tutorial/schema-extra-example/#body-with-multiple-examples). Initial PR [#1267](https://github.com/tiangolo/fastapi/pull/1267) by [@austinorr](https://github.com/austinorr).
### Fixes
* 📌 Pin SQLAlchemy range for tests, as it doesn't use SemVer. PR [#3001](https://github.com/tiangolo/fastapi/pull/3001) by [@tiangolo](https://github.com/tiangolo).
* 🎨 Add newly required type annotations for mypy. PR [#2882](https://github.com/tiangolo/fastapi/pull/2882) by [@tiangolo](https://github.com/tiangolo).
* 🎨 Remove internal "type: ignore", now unnecessary. PR [#2424](https://github.com/tiangolo/fastapi/pull/2424) by [@AsakuraMizu](https://github.com/AsakuraMizu).
### Docs
* 📝 Add link to article in Russian "FastAPI: знакомимся с фреймворком". PR [#2564](https://github.com/tiangolo/fastapi/pull/2564) by [@trkohler](https://github.com/trkohler).
* 📝 Add external link to blog post "Authenticate Your FastAPI App with Auth0". PR [#2172](https://github.com/tiangolo/fastapi/pull/2172) by [@dompatmore](https://github.com/dompatmore).
* 📝 Fix broken link to article: Machine learning model serving in Python using FastAPI and Streamlit. PR [#2557](https://github.com/tiangolo/fastapi/pull/2557) by [@davidefiocco](https://github.com/davidefiocco).
* 📝 Add FastAPI Medium Article: Deploy a dockerized FastAPI application to AWS. PR [#2515](https://github.com/tiangolo/fastapi/pull/2515) by [@vjanz](https://github.com/vjanz).
* ✏ Fix typo in Tutorial - Handling Errors. PR [#2486](https://github.com/tiangolo/fastapi/pull/2486) by [@johnthagen](https://github.com/johnthagen).
* ✏ Fix typo in Security OAuth2 scopes. PR [#2407](https://github.com/tiangolo/fastapi/pull/2407) by [@jugmac00](https://github.com/jugmac00).
* ✏ Fix typo/clarify docs for SQL (Relational) Databases. PR [#2393](https://github.com/tiangolo/fastapi/pull/2393) by [@kangni](https://github.com/kangni).
* 📝 Add external link to "FastAPI for Flask Users". PR [#2280](https://github.com/tiangolo/fastapi/pull/2280) by [@amitness](https://github.com/amitness).
### Translations
* 🌐 Fix Chinese translation of Tutorial - Query Parameters, remove obsolete content. PR [#3051](https://github.com/tiangolo/fastapi/pull/3051) by [@louis70109](https://github.com/louis70109).
* 🌐 Add French translation for Tutorial - Background Tasks. PR [#3098](https://github.com/tiangolo/fastapi/pull/3098) by [@Smlep](https://github.com/Smlep).
* 🌐 Fix Korean translation for docs/ko/docs/index.md. PR [#3159](https://github.com/tiangolo/fastapi/pull/3159) by [@SueNaEunYang](https://github.com/SueNaEunYang).
* 🌐 Add Korean translation for Tutorial - Query Parameters. PR [#2390](https://github.com/tiangolo/fastapi/pull/2390) by [@hard-coders](https://github.com/hard-coders).
* 🌐 Add French translation for FastAPI People. PR [#2232](https://github.com/tiangolo/fastapi/pull/2232) by [@JulianMaurin](https://github.com/JulianMaurin).
* 🌐 Add Korean translation for Tutorial - Path Parameters. PR [#2355](https://github.com/tiangolo/fastapi/pull/2355) by [@hard-coders](https://github.com/hard-coders).
* 🌐 Add French translation for Features. PR [#2157](https://github.com/tiangolo/fastapi/pull/2157) by [@Jefidev](https://github.com/Jefidev).
* 👥 Update FastAPI People. PR [#3031](https://github.com/tiangolo/fastapi/pull/3031) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 🌐 Add Chinese translation for Tutorial - Debugging. PR [#2737](https://github.com/tiangolo/fastapi/pull/2737) by [@blt232018](https://github.com/blt232018).
* 🌐 Add Chinese translation for Tutorial - Security - OAuth2 with Password (and hashing), Bearer with JWT tokens. PR [#2642](https://github.com/tiangolo/fastapi/pull/2642) by [@waynerv](https://github.com/waynerv).
* 🌐 Add Korean translation for Tutorial - Header Parameters. PR [#2589](https://github.com/tiangolo/fastapi/pull/2589) by [@mode9](https://github.com/mode9).
* 🌐 Add Chinese translation for Tutorial - Metadata and Docs URLs. PR [#2559](https://github.com/tiangolo/fastapi/pull/2559) by [@blt232018](https://github.com/blt232018).
* 🌐 Add Korean translation for Tutorial - First Steps. PR [#2323](https://github.com/tiangolo/fastapi/pull/2323) by [@hard-coders](https://github.com/hard-coders).
* 🌐 Add Chinese translation for Tutorial - CORS (Cross-Origin Resource Sharing). PR [#2540](https://github.com/tiangolo/fastapi/pull/2540) by [@blt232018](https://github.com/blt232018).
* 🌐 Add Chinese translation for Tutorial - Middleware. PR [#2334](https://github.com/tiangolo/fastapi/pull/2334) by [@lpdswing](https://github.com/lpdswing).
* 🌐 Add Korean translation for Tutorial - Intro. PR [#2317](https://github.com/tiangolo/fastapi/pull/2317) by [@hard-coders](https://github.com/hard-coders).
* 🌐 Add Chinese translation for Tutorial - Bigger Applications - Multiple Files. PR [#2453](https://github.com/tiangolo/fastapi/pull/2453) by [@waynerv](https://github.com/waynerv).
* 🌐 Add Chinese translation for Tutorial - Security - Security Intro. PR [#2443](https://github.com/tiangolo/fastapi/pull/2443) by [@waynerv](https://github.com/waynerv).
* 🌐 Add Chinese translation for Tutorial - Header Parameters. PR [#2412](https://github.com/tiangolo/fastapi/pull/2412) by [@maoyibo](https://github.com/maoyibo).
* 🌐 Add Chinese translation for Tutorial - Extra Data Types. PR [#2410](https://github.com/tiangolo/fastapi/pull/2410) by [@maoyibo](https://github.com/maoyibo).
* 🌐 Add Japanese translation for Deployment - Docker. PR [#2312](https://github.com/tiangolo/fastapi/pull/2312) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Deployment - Versions. PR [#2310](https://github.com/tiangolo/fastapi/pull/2310) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Chinese translation for Tutorial - Cookie Parameters. PR [#2261](https://github.com/tiangolo/fastapi/pull/2261) by [@alicrazy1947](https://github.com/alicrazy1947).
* 🌐 Add Japanese translation for Tutorial - Static files. PR [#2260](https://github.com/tiangolo/fastapi/pull/2260) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Tutorial - Testing. PR [#2259](https://github.com/tiangolo/fastapi/pull/2259) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Tutorial - Debugging. PR [#2256](https://github.com/tiangolo/fastapi/pull/2256) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Tutorial - Middleware. PR [#2255](https://github.com/tiangolo/fastapi/pull/2255) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Concurrency and async / await. PR [#2058](https://github.com/tiangolo/fastapi/pull/2058) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Chinese translation for Tutorial - Security - Simple OAuth2 with Password and Bearer. PR [#2514](https://github.com/tiangolo/fastapi/pull/2514) by [@waynerv](https://github.com/waynerv).
* 🌐 Add Japanese translation for Deployment - Deta. PR [#2314](https://github.com/tiangolo/fastapi/pull/2314) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Chinese translation for Tutorial - Security - Get Current User. PR [#2474](https://github.com/tiangolo/fastapi/pull/2474) by [@waynerv](https://github.com/waynerv).
* 🌐 Add Japanese translation for Deployment - Manually. PR [#2313](https://github.com/tiangolo/fastapi/pull/2313) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Deployment - Intro. PR [#2309](https://github.com/tiangolo/fastapi/pull/2309) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for FastAPI People. PR [#2254](https://github.com/tiangolo/fastapi/pull/2254) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Advanced - Path Operation Advanced Configuration. PR [#2124](https://github.com/tiangolo/fastapi/pull/2124) by [@Attsun1031](https://github.com/Attsun1031).
* 🌐 Add Japanese translation for External Links. PR [#2070](https://github.com/tiangolo/fastapi/pull/2070) by [@tokusumi](https://github.com/tokusumi).
* 🌐 Add Japanese translation for Tutorial - Body - Updates. PR [#1956](https://github.com/tiangolo/fastapi/pull/1956) by [@SwftAlpc](https://github.com/SwftAlpc).
* 🌐 Add Japanese translation for Tutorial - Form Data. PR [#1943](https://github.com/tiangolo/fastapi/pull/1943) by [@SwftAlpc](https://github.com/SwftAlpc).
* 🌐 Add Japanese translation for Tutorial - Cookie Parameters. PR [#1933](https://github.com/tiangolo/fastapi/pull/1933) by [@SwftAlpc](https://github.com/SwftAlpc).
### Internal
* 🔧 Update top banner, point to newsletter. PR [#3003](https://github.com/tiangolo/fastapi/pull/3003) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Disable sponsor WeTransfer. PR [#3002](https://github.com/tiangolo/fastapi/pull/3002) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#2880](https://github.com/tiangolo/fastapi/pull/2880) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 👥 Update FastAPI People. PR [#2739](https://github.com/tiangolo/fastapi/pull/2739) by [@github-actions[bot]](https://github.com/apps/github-actions).
* 🔧 Add new Gold Sponsor Talk Python 🎉. PR [#2673](https://github.com/tiangolo/fastapi/pull/2673) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add new Gold Sponsor vim.so 🎉. PR [#2669](https://github.com/tiangolo/fastapi/pull/2669) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add FastAPI user survey banner. PR [#2623](https://github.com/tiangolo/fastapi/pull/2623) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Add new Bronze Sponsor(s) 🥉🎉. PR [#2622](https://github.com/tiangolo/fastapi/pull/2622) by [@tiangolo](https://github.com/tiangolo).
* 📝 Update social links: add Discord, fix GitHub. PR [#2621](https://github.com/tiangolo/fastapi/pull/2621) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update FastAPI People GitHub Sponsors order. PR [#2620](https://github.com/tiangolo/fastapi/pull/2620) by [@tiangolo](https://github.com/tiangolo).
* 🔧 Update InvestSuite sponsor data. PR [#2608](https://github.com/tiangolo/fastapi/pull/2608) by [@tiangolo](https://github.com/tiangolo).
* 👥 Update FastAPI People. PR [#2590](https://github.com/tiangolo/fastapi/pull/2590) by [@github-actions[bot]](https://github.com/apps/github-actions).
## 0.63.0
### Features

View File

@@ -198,7 +198,7 @@ Even for items inside of lists:
<img src="/img/tutorial/body-nested-models/image01.png">
You couldn't get this kind of editor support if you where working directly with `dict` instead of Pydantic models.
You couldn't get this kind of editor support if you were working directly with `dict` instead of Pydantic models.
But you don't have to worry about them either, incoming dicts are converted automatically and your output is converted automatically to JSON too.
@@ -218,7 +218,7 @@ That's what we are going to see here.
In this case, you would accept any `dict` as long as it has `int` keys with `float` values:
```Python hl_lines="15"
```Python hl_lines="9"
{!../../../docs_src/body_nested_models/tutorial009.py!}
```

View File

@@ -39,7 +39,7 @@ This also means that if you are inside a utility function that you are calling i
The benefit of raising an exception over `return`ing a value will be more evident in the section about Dependencies and Security.
In this example, when the client request an item by an ID that doesn't exist, raise an exception with a status code of `404`:
In this example, when the client requests an item by an ID that doesn't exist, raise an exception with a status code of `404`:
```Python hl_lines="11"
{!../../../docs_src/handling_errors/tutorial001.py!}

View File

@@ -1,58 +1,109 @@
# Schema Extra - Example
# Declare Request Example Data
You can define extra information to go in JSON Schema.
You can declare examples of the data your app can receive.
A common use case is to add an `example` that will be shown in the docs.
There are several ways you can declare extra JSON Schema information.
Here are several ways to do it.
## Pydantic `schema_extra`
You can declare an example for a Pydantic model using `Config` and `schema_extra`, as described in <a href="https://pydantic-docs.helpmanual.io/usage/schema/#schema-customization" class="external-link" target="_blank">Pydantic's docs: Schema customization</a>:
You can declare an `example` for a Pydantic model using `Config` and `schema_extra`, as described in <a href="https://pydantic-docs.helpmanual.io/usage/schema/#schema-customization" class="external-link" target="_blank">Pydantic's docs: Schema customization</a>:
```Python hl_lines="15-23"
{!../../../docs_src/schema_extra_example/tutorial001.py!}
```
That extra info will be added as-is to the output JSON Schema.
That extra info will be added as-is to the output **JSON Schema** for that model, and it will be used in the API docs.
!!! tip
You could use the same technique to extend the JSON Schema and add your own custom extra info.
For example you could use it to add metadata for a frontend user interface, etc.
## `Field` additional arguments
In `Field`, `Path`, `Query`, `Body` and others you'll see later, you can also declare extra info for the JSON Schema by passing any other arbitrary arguments to the function, for example, to add an `example`:
When using `Field()` with Pydantic models, you can also declare extra info for the **JSON Schema** by passing any other arbitrary arguments to the function.
You can use this to add `example` for each field:
```Python hl_lines="4 10-13"
{!../../../docs_src/schema_extra_example/tutorial002.py!}
```
!!! warning
Keep in mind that those extra arguments passed won't add any validation, only annotation, for documentation purposes.
Keep in mind that those extra arguments passed won't add any validation, only extra information, for documentation purposes.
## `Body` additional arguments
## `example` and `examples` in OpenAPI
The same way you can pass extra info to `Field`, you can do the same with `Path`, `Query`, `Body`, etc.
When using any of:
For example, you can pass an `example` for a body request to `Body`:
* `Path()`
* `Query()`
* `Header()`
* `Cookie()`
* `Body()`
* `Form()`
* `File()`
you can also declare a data `example` or a group of `examples` with additional information that will be added to **OpenAPI**.
### `Body` with `example`
Here we pass an `example` of the data expected in `Body()`:
```Python hl_lines="21-26"
{!../../../docs_src/schema_extra_example/tutorial003.py!}
```
## Example in the docs UI
### Example in the docs UI
With any of the methods above it would look like this in the `/docs`:
<img src="/img/tutorial/body-fields/image01.png">
### `Body` with multiple `examples`
Alternatively to the single `example`, you can pass `examples` using a `dict` with **multiple examples**, each with extra information that will be added to **OpenAPI** too.
The keys of the `dict` identify each example, and each value is another `dict`.
Each specific example `dict` in the `examples` can contain:
* `summary`: Short description for the example.
* `description`: A long description that can contain Markdown text.
* `value`: This is the actual example shown, e.g. a `dict`.
* `externalValue`: alternative to `value`, a URL pointing to the example. Although this might not be supported by as many tools as `value`.
```Python hl_lines="22-48"
{!../../../docs_src/schema_extra_example/tutorial004.py!}
```
### Examples in the docs UI
With `examples` added to `Body()` the `/docs` would look like:
<img src="/img/tutorial/body-fields/image02.png">
## Technical Details
About `example` vs `examples`...
!!! warning
These are very technical details about the standards **JSON Schema** and **OpenAPI**.
JSON Schema defines a field <a href="https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.5" class="external-link" target="_blank">`examples`</a> in the most recent versions, but OpenAPI is based on an older version of JSON Schema that didn't have `examples`.
If the ideas above already work for you, that might be enough, and you probably don't need these details, feel free to skip them.
So, OpenAPI defined its own <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-20" class="external-link" target="_blank">`example`</a> for the same purpose (as `example`, not `examples`), and that's what is used by the docs UI (using Swagger UI).
When you add an example inside of a Pydantic model, using `schema_extra` or `Field(example="something")` that example is added to the **JSON Schema** for that Pydantic model.
So, although `example` is not part of JSON Schema, it is part of OpenAPI, and that's what will be used by the docs UI.
And that **JSON Schema** of the Pydantic model is included in the **OpenAPI** of your API, and then it's used in the docs UI.
## Other info
**JSON Schema** doesn't really have a field `example` in the standards. Recent versions of JSON Schema define a field <a href="https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.5" class="external-link" target="_blank">`examples`</a>, but OpenAPI 3.0.3 is based on an older version of JSON Schema that didn't have `examples`.
The same way, you could add your own custom extra info that would be added to the JSON Schema for each model, for example to customize a frontend user interface, etc.
So, OpenAPI 3.0.3 defined its own <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-20" class="external-link" target="_blank">`example`</a> for the modified version of **JSON Schema** it uses, for the same purpose (but it's a single `example`, not `examples`), and that's what is used by the API docs UI (using Swagger UI).
So, although `example` is not part of JSON Schema, it is part of OpenAPI's custom version of JSON Schema, and that's what will be used by the docs UI.
But when you use `example` or `examples` with any of the other utilities (`Query()`, `Body()`, etc.) those examples are not added to the JSON Schema that describes that data (not even to OpenAPI's own version of JSON Schema), they are added directly to the *path operation* declaration in OpenAPI (outside the parts of OpenAPI that use JSON Schema).
For `Path()`, `Query()`, `Header()`, and `Cookie()`, the `example` or `examples` are added to the <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object" class="external-link" target="_blank">OpenAPI definition, to the `Parameter Object` (in the specification)</a>.
And for `Body()`, `File()`, and `Form()`, the `example` or `examples` are equivalently added to the <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject" class="external-link" target="_blank">OpenAPI definition, to the `Request Body Object`, in the field `content`, on the `Media Type Object` (in the specification)</a>.
On the other hand, there's a newer version of OpenAPI: **3.1.0**, recently released. It is based on the latest JSON Schema and most of the modifications from OpenAPI's custom version of JSON Schema are removed, in exchange of the features from the recent versions of JSON Schema, so all these small differences are reduced. Nevertheless, Swagger UI currently doesn't support OpenAPI 3.1.0, so, for now, it's better to continue using the ideas above.

View File

@@ -364,7 +364,7 @@ Create utility functions to:
* Read a single user by ID and by email.
* Read multiple users.
* Read a single item.
* Read multiple items.
```Python hl_lines="1 3 6-7 10-11 14-15 27-28"
{!../../../docs_src/sql_databases/sql_app/crud.py!}

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -116,6 +119,7 @@ nav:
- advanced/security/oauth2-scopes.md
- advanced/security/http-basic-auth.md
- advanced/using-request-directly.md
- advanced/dataclasses.md
- advanced/middleware.md
- advanced/sql-databases-peewee.md
- advanced/async-sql-databases.md
@@ -172,7 +176,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -186,16 +192,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

View File

@@ -1,9 +1,38 @@
{% extends "base.html" %}
{% block announce %}
<a class="announce" href="https://fastapi.tiangolo.com/newsletter/">
<span class="twemoji">
{% include ".icons/material/email.svg" %}
</span> Subscribe to the <strong>FastAPI and friends</strong> newsletter 🎉
</a>
{% endblock %}
<div class="announce-wrapper">
<div id="announce-left">
<div class="item">
<a class="announce-link" href="https://fastapi.tiangolo.com/newsletter/">
<span class="twemoji">
{% include ".icons/material/email.svg" %}
</span> Subscribe to the <strong>FastAPI and friends</strong> newsletter 🎉
</a>
</div>
<div class="item">
<iframe style="display: inline-block; vertical-align: middle; border: none; margin-right: 0.5rem;" src="https://github.com/sponsors/tiangolo/button" title="Sponsor tiangolo" height="35" width="116" style="border: 0;"></iframe> <a class="announce-link" target="_blank" href="https://github.com/sponsors/tiangolo">You can now sponsor <strong>FastAPI</strong> 🍰</a>
</div>
</div>
<div id="announce-right" style="position: relative;">
<div class="item">
<a title="The launchpad for all your (team's) ideas" style="display: block; position: relative;" href="https://www.deta.sh/?ref=fastapi" target="_blank">
<span class="sponsor-badge">sponsor</span>
<img class="sponsor-image" src="/img/sponsors/deta-banner.svg" />
</a>
</div>
<div class="item">
<a title="Get three courses at 10% off their current prices! Plus, we'll be donating 10% of all profits from sales of this bundle to the FastAPI team." style="display: block; position: relative;" href="https://testdriven.io/talkpython/" target="_blank">
<span class="sponsor-badge">sponsor</span>
<img class="sponsor-image" src="/img/sponsors/fastapi-course-bundle-banner.svg" />
</a>
</div>
<div class="item">
<a title="Jina: build neural search-as-a-service for any kind of data in just minutes." style="display: block; position: relative;" href="https://bit.ly/2QSouzH" target="_blank">
<span class="sponsor-badge">sponsor</span>
<img class="sponsor-image" src="/img/sponsors/jina-banner.svg" />
</a>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,37 @@
# Códigos de estado adicionales
Por defecto, **FastAPI** devolverá las respuestas utilizando una `JSONResponse`, poniendo el contenido que devuelves en tu *operación de path* dentro de esa `JSONResponse`.
Utilizará el código de estado por defecto, o el que hayas asignado en tu *operación de path*.
## Códigos de estado adicionales
Si quieres devolver códigos de estado adicionales además del principal, puedes hacerlo devolviendo directamente una `Response`, como una `JSONResponse`, y asignar directamente el código de estado adicional.
Por ejemplo, digamos que quieres tener una *operación de path* que permita actualizar ítems y devolver códigos de estado HTTP 200 "OK" cuando sea exitosa.
Pero también quieres que acepte nuevos ítems. Cuando los ítems no existan anteriormente, serán creados y devolverá un código de estado HTTP 201 "Created".
Para conseguir esto importa `JSONResponse` y devuelve ahí directamente tu contenido, asignando el `status_code` que quieras:
```Python hl_lines="2 19"
{!../../../docs_src/additional_status_codes/tutorial001.py!}
```
!!! warning "Advertencia"
Cuando devuelves directamente una `Response`, como en los ejemplos anteriores, será devuelta directamente.
No será serializado con el modelo, etc.
Asegurate de que la respuesta tenga los datos que quieras, y que los valores sean JSON válidos (si estás usando `JSONResponse`).
!!! note "Detalles Técnicos"
También podrías utilizar `from starlette.responses import JSONResponse`.
**FastAPI** provee las mismas `starlette.responses` que `fastapi.responses` simplemente como una convención para ti, el desarrollador. Pero la mayoría de las respuestas disponibles vienen directamente de Starlette. Lo mismo con `status`.
## OpenAPI y documentación de API
Si quieres devolver códigos de estado y respuestas adicionales directamente, estas no estarán incluidas en el schema de OpenAPI (documentación de API), porque FastAPI no tiene una manera de conocer de antemano lo que vas a devolver.
Pero puedes documentar eso en tu código usando [Respuestas Adicionales](additional-responses.md){.internal-link target=_blank}.

View File

@@ -0,0 +1,52 @@
# Configuración avanzada de las operaciones de path
## OpenAPI operationId
!!! warning "Advertencia"
Si no eres una persona "experta" en OpenAPI, probablemente no necesitas leer esto.
Puedes asignar el `operationId` de OpenAPI para ser usado en tu *operación de path* con el parámetro `operation_id`.
En este caso tendrías que asegurarte de que sea único para cada operación.
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### Usando el nombre de la *función de la operación de path* en el operationId
Si quieres usar tus nombres de funciones de API como `operationId`s, puedes iterar sobre todos ellos y sobrescribir `operation_id` de cada *operación de path* usando su `APIRoute.name`.
Deberías hacerlo después de adicionar todas tus *operaciones de path*.
```Python hl_lines="2 12 13 14 15 16 17 18 19 20 21 24"
{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
!!! tip "Consejo"
Si llamas manualmente a `app.openapi()`, debes actualizar el `operationId`s antes de hacerlo.
!!! warning "Advertencia"
Si haces esto, debes asegurarte de que cada una de tus *funciones de las operaciones de path* tenga un nombre único.
Incluso si están en diferentes módulos (archivos Python).
## Excluir de OpenAPI
Para excluir una *operación de path* del esquema OpenAPI generado (y por tanto del la documentación generada automáticamente), usa el parámetro `include_in_schema` y asigna el valor como `False`;
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## Descripción avanzada desde el docstring
Puedes limitar las líneas usadas desde el docstring de una *operación de path* para OpenAPI.
Agregar un `\f` (un carácter de "form feed" escapado) hace que **FastAPI** trunque el output utilizada para OpenAPI en ese punto.
No será mostrado en la documentación, pero otras herramientas (como Sphinx) serán capaces de usar el resto.
```Python hl_lines="19 20 21 22 23 24 25 26 27 28 29"
{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```

View File

@@ -0,0 +1,63 @@
# Devolver una respuesta directamente
Cuando creas una *operación de path* normalmente puedes devolver cualquier dato: un `dict`, una `list`, un modelo Pydantic, un modelo de base de datos, etc.
Por defecto, **FastAPI** convertiría automáticamente ese valor devuelto a JSON usando el `jsonable_encoder` explicado en [Codificador Compatible JSON](../tutorial/encoder.md){.internal-link target=_blank}.
Luego, tras bastidores, pondría esos datos compatibles con JSON (por ejemplo, un `dict`) dentro de una `JSONResponse` que se usaría para enviar la respuesta al cliente.
Pero puedes devolver una `JSONResponse` directamente de tu *operación de path*.
Esto puede ser útil, por ejemplo, para devolver cookies o headers personalizados.
## Devolver una `Response`
De hecho, puedes devolver cualquier `Response` o cualquier subclase de la misma.
!!! tip "Consejo"
`JSONResponse` en sí misma es una subclase de `Response`.
Y cuando devuelves una `Response`, **FastAPI** la pasará directamente.
No hará ninguna conversión de datos con modelos Pydantic, no convertirá el contenido a ningún tipo, etc.
Esto te da mucha flexibilidad. Puedes devolver cualquier tipo de dato, sobrescribir cualquer declaración de datos o validación, etc.
## Usando el `jsonable_encoder` en una `Response`
Como **FastAPI** no realiza ningún cambio en la `Response` que devuelves, debes asegurarte de que el contenido está listo.
Por ejemplo, no puedes poner un modelo Pydantic en una `JSONResponse` sin primero convertirlo a un `dict` con todos los tipos de datos (como `datetime`, `UUID`, etc) convertidos a tipos compatibles con JSON.
Para esos casos, puedes usar el `jsonable_encoder` para convertir tus datos antes de pasarlos a la respuesta:
```Python hl_lines="4 6 20 21"
{!../../../docs_src/response_directly/tutorial001.py!}
```
!!! note "Detalles Técnicos"
También puedes usar `from starlette.responses import JSONResponse`.
**FastAPI** provee `starlette.responses` como `fastapi.responses`, simplemente como una conveniencia para ti, el desarrollador. Pero la mayoría de las respuestas disponibles vienen directamente de Starlette.
## Devolviendo una `Response` personalizada
El ejemplo anterior muestra las partes que necesitas, pero no es muy útil todavía, dado que podrías simplemente devolver el `item` directamente, y **FastAPI** lo pondría en una `JSONResponse` por ti, convirtiéndolo en un `dict`, etc. Todo esto por defecto.
Ahora, veamos cómo puedes usarlo para devolver una respuesta personalizada.
Digamos que quieres devolver una respuesta <a href="https://en.wikipedia.org/wiki/XML" class="external-link" target="_blank">XML</a>.
Podrías poner tu contenido XML en un string, ponerlo en una `Response` y devolverlo:
```Python hl_lines="1 18"
{!../../../docs_src/response_directly/tutorial002.py!}
```
## Notas
Cuando devuelves una `Response` directamente, los datos no son validados, convertidos (serializados), ni documentados automáticamente.
Pero todavía es posible documentarlo como es descrito en [Respuestas adicionales en OpenAPI](additional-responses.md){.internal-link target=_blank}.
Puedes ver en secciones posteriores como usar/declarar esas `Response`s personalizadas aún teniendo conversión automática de datos, documentación, etc.

View File

@@ -39,13 +39,16 @@ Sus características principales son:
<small>* Esta estimación está basada en pruebas con un equipo de desarrollo interno contruyendo aplicaciones listas para producción.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -0,0 +1,333 @@
# Primeros pasos
Un archivo muy simple de FastAPI podría verse así:
```Python
{!../../../docs_src/first_steps/tutorial001.py!}
```
Copia eso a un archivo `main.py`.
Corre el servidor en vivo:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
<span style="color: green;">INFO</span>: Started reloader process [28720]
<span style="color: green;">INFO</span>: Started server process [28722]
<span style="color: green;">INFO</span>: Waiting for application startup.
<span style="color: green;">INFO</span>: Application startup complete.
```
</div>
!!! note "Nota"
El comando `uvicorn main:app` se refiere a:
* `main`: el archivo `main.py` (el "módulo" de Python).
* `app`: el objeto creado dentro de `main.py` con la línea `app = FastAPI()`.
* `--reload`: hace que el servidor se reinicie cada vez que cambia el código. Úsalo únicamente para desarrollo.
En el output, hay una línea que dice más o menos:
```hl_lines="4"
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
Esa línea muestra la URL dónde se está sirviendo tu app en tu maquina local.
### Revísalo
Abre tu navegador en <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000</a>.
Verás la respuesta en JSON:
```JSON
{"message": "Hello World"}
```
### Documentación interactiva de la API
Ahora dirígete a <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
Ahí verás la documentación automática e interactiva de la API (proveída por <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Documentación alternativa de la API
Ahora, dirígete a <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
Aquí verás la documentación automática alternativa (proveída por <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
### OpenAPI
**FastAPI** genera un "schema" con toda tu API usando el estándar para definir APIs, **OpenAPI**.
#### "Schema"
Un "schema" es una definición o descripción de algo. No es el código que la implementa, sino solo una descripción abstracta.
#### "Schema" de la API
En este caso, <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> es una especificación que dicta como se debe definir el schema de tu API.
La definición del schema incluye los paths de tu API, los parámetros que podría recibir, etc.
#### "Schema" de datos
El concepto "schema" también se puede referir a la forma de algunos datos, como un contenido en formato JSON.
En ese caso haría referencia a los atributos del JSON, los tipos de datos que tiene, etc.
#### OpenAPI y JSON Schema
OpenAPI define un schema de API para tu API. Ese schema incluye definiciones (o "schemas") de los datos enviados y recibidos por tu API usando **JSON Schema**, el estándar para los schemas de datos en JSON.
#### Revisa el `openapi.json`
Si sientes curiosidad por saber cómo se ve el schema de OpenAPI en bruto, FastAPI genera automáticamente un (schema) JSON con la descripción de todo tu API.
Lo puedes ver directamente en: <a href="http://127.0.0.1:8000/openapi.json" class="external-link" target="_blank">http://127.0.0.1:8000/openapi.json</a>.
Esto te mostrará un JSON que comienza con algo como:
```JSON
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/items/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
...
```
#### ¿Para qué se usa OpenAPI?
El schema de OpenAPI es lo que alimenta a los dos sistemas de documentación interactiva incluidos.
También hay docenas de alternativas, todas basadas en OpenAPI. Podrías añadir fácilmente cualquiera de esas alternativas a tu aplicación construida con **FastAPI**.
También podrías usarlo para generar código automáticamente, para los clientes que se comunican con tu API. Por ejemplo, frontend, móvil o aplicaciones de IoT.
## Repaso, paso a paso
### Paso 1: importa `FastAPI`
```Python hl_lines="1"
{!../../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI` es una clase de Python que provee toda la funcionalidad para tu API.
!!! note "Detalles Técnicos"
`FastAPI` es una clase que hereda directamente de `Starlette`.
También puedes usar toda la funcionalidad de <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>.
### Paso 2: crea un "instance" de `FastAPI`
```Python hl_lines="3"
{!../../../docs_src/first_steps/tutorial001.py!}
```
Aquí la variable `app` será un instance de la clase `FastAPI`.
Este será el punto de interacción principal para crear todo tu API.
Esta `app` es la misma a la que nos referimos cuando usamos el comando de `uvicorn`:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
Si creas un app como:
```Python hl_lines="3"
{!../../../docs_src/first_steps/tutorial002.py!}
```
y lo guardas en un archivo `main.py`, entonces ejecutarías `uvicorn` así:
<div class="termy">
```console
$ uvicorn main:my_awesome_api --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
### Paso 3: crea un *operación de path*
#### Path
"Path" aquí se refiere a la última parte de una URL comenzando desde el primer `/`.
Entonces, en una URL como:
```
https://example.com/items/foo
```
...el path sería:
```
/items/foo
```
!!! info "Información"
Un "path" también se conoce habitualmente como "endpoint", "route" o "ruta".
Cuando construyes una API, el "path" es la manera principal de separar los <abbr title="en inglés: separation of concerns">"intereses"</abbr> y los "recursos".
#### Operación
"Operación" aquí se refiere a uno de los "métodos" de HTTP.
Uno como:
* `POST`
* `GET`
* `PUT`
* `DELETE`
...y los más exóticos:
* `OPTIONS`
* `HEAD`
* `PATCH`
* `TRACE`
En el protocolo de HTTP, te puedes comunicar con cada path usando uno (o más) de estos "métodos".
---
Cuando construyes APIs, normalmente usas uno de estos métodos específicos de HTTP para realizar una acción específica.
Normalmente usas:
* `POST`: para crear datos.
* `GET`: para leer datos.
* `PUT`: para actualizar datos.
* `DELETE`: para borrar datos.
Así que en OpenAPI, cada uno de estos métodos de HTTP es referido como una "operación".
Nosotros también los llamaremos "**operación**".
#### Define un *decorador de operaciones de path*
```Python hl_lines="6"
{!../../../docs_src/first_steps/tutorial001.py!}
```
El `@app.get("/")` le dice a **FastAPI** que la función que tiene justo debajo está a cargo de manejar los requests que van a:
* el path `/`
* usando una <abbr title="an HTTP GET method">operación <code>get</code></abbr>
!!! info "Información sobre `@decorator`"
Esa sintaxis `@algo` se llama un "decorador" en Python.
Lo pones encima de una función. Es como un lindo sombrero decorado (creo que de ahí salió el concepto).
Un "decorador" toma la función que tiene debajo y hace algo con ella.
En nuestro caso, este decorador le dice a **FastAPI** que la función que está debajo corresponde al **path** `/` con una **operación** `get`.
Es el "**decorador de operaciones de path**".
También puedes usar las otras operaciones:
* `@app.post()`
* `@app.put()`
* `@app.delete()`
y las más exóticas:
* `@app.options()`
* `@app.head()`
* `@app.patch()`
* `@app.trace()`
!!! tip "Consejo"
Tienes la libertad de usar cada operación (método de HTTP) como quieras.
**FastAPI** no impone ningún significado específico.
La información que está presentada aquí es una guía, no un requerimiento.
Por ejemplo, cuando usas GraphQL normalmente realizas todas las acciones usando únicamente operaciones `POST`.
### Paso 4: define la **función de la operación de path**
Esta es nuestra "**función de la operación de path**":
* **path**: es `/`.
* **operación**: es `get`.
* **función**: es la función debajo del "decorador" (debajo de `@app.get("/")`).
```Python hl_lines="7"
{!../../../docs_src/first_steps/tutorial001.py!}
```
Esto es una función de Python.
Esta función será llamada por **FastAPI** cada vez que reciba un request en la URL "`/`" usando una operación `GET`.
En este caso es una función `async`.
---
También podrías definirla como una función normal, en vez de `async def`:
```Python hl_lines="7"
{!../../../docs_src/first_steps/tutorial003.py!}
```
!!! note "Nota"
Si no sabes la diferencia, revisa el [Async: *"¿Tienes prisa?"*](../async.md#in-a-hurry){.internal-link target=_blank}.
### Paso 5: devuelve el contenido
```Python hl_lines="8"
{!../../../docs_src/first_steps/tutorial001.py!}
```
Puedes devolver `dict`, `list`, valores singulares como un `str`, `int`, etc.
También puedes devolver modelos de Pydantic (ya verás más sobre esto más adelante).
Hay muchos objetos y modelos que pueden ser convertidos automáticamente a JSON (incluyendo ORMs, etc.). Intenta usar tus favoritos, es muy probable que ya tengan soporte.
## Repaso
* Importa `FastAPI`.
* Crea un instance de `app`.
* Escribe un **decorador de operación de path** (como `@app.get("/")`).
* Escribe una **función de la operación de path** (como `def root(): ...` arriba).
* Corre el servidor de desarrollo (como `uvicorn main:app --reload`).

View File

@@ -0,0 +1,244 @@
# Parámetros de path
Puedes declarar los "parámetros" o "variables" con la misma sintaxis que usan los format strings de Python:
```Python hl_lines="6-7"
{!../../../docs_src/path_params/tutorial001.py!}
```
El valor del parámetro de path `item_id` será pasado a tu función como el argumento `item_id`.
Entonces, si corres este ejemplo y vas a <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a>, verás una respuesta de:
```JSON
{"item_id":"foo"}
```
## Parámetros de path con tipos
Puedes declarar el tipo de un parámetro de path en la función usando las anotaciones de tipos estándar de Python:
```Python hl_lines="7"
{!../../../docs_src/path_params/tutorial002.py!}
```
En este caso, `item_id` es declarado como un `int`.
!!! check "Revisa"
Esto te dará soporte en el editor dentro de tu función, con chequeos de errores, autocompletado, etc.
## <abbr title="también conocido en inglés como: serialization, parsing, marshalling">Conversión</abbr> de datos
Si corres este ejemplo y abres tu navegador en <a href="http://127.0.0.1:8000/items/3" class="external-link" target="_blank">http://127.0.0.1:8000/items/3</a> verás una respuesta de:
```JSON
{"item_id":3}
```
!!! check "Revisa"
Observa que el valor que recibió (y devolvió) tu función es `3`, como un Python `int`, y no un string `"3"`.
Entonces, con esa declaración de tipos **FastAPI** te da <abbr title="convertir el string que viene de un HTTP request a datos de Python">"parsing"</abbr> automático del request.
## Validación de datos
Pero si abres tu navegador en <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a> verás este lindo error de HTTP:
```JSON
{
"detail": [
{
"loc": [
"path",
"item_id"
],
"msg": "value is not a valid integer",
"type": "type_error.integer"
}
]
}
```
debido a que el parámetro de path `item_id` tenía el valor `"foo"`, que no es un `int`.
El mismo error aparecería si pasaras un `float` en vez de un `int` como en: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2</a>
!!! check "Revisa"
Así, con la misma declaración de tipo de Python, **FastAPI** te da validación de datos.
Observa que el error también muestra claramente el punto exacto en el que no pasó la validación.
Esto es increíblemente útil cuando estás desarrollando y debugging código que interactúa con tu API.
## Documentación
Cuando abras tu navegador en <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a> verás la documentación automática e interactiva del API como:
<img src="/img/tutorial/path-params/image01.png">
!!! check "Revisa"
Nuevamente, con la misma declaración de tipo de Python, **FastAPI** te da documentación automática e interactiva (integrándose con Swagger UI)
Observa que el parámetro de path está declarado como un integer.
## Beneficios basados en estándares, documentación alternativa
Debido a que el schema generado es del estándar <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md" class="external-link" target="_blank">OpenAPI</a> hay muchas herramientas compatibles.
Es por esto que **FastAPI** mismo provee una documentación alternativa de la API (usando ReDoc), a la que puedes acceder en <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>:
<img src="/img/tutorial/path-params/image02.png">
De la misma manera hay muchas herramientas compatibles. Incluyendo herramientas de generación de código para muchos lenguajes.
## Pydantic
Toda la validación de datos es realizada tras bastidores por <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>, así que obtienes todos sus beneficios. Así sabes que estás en buenas manos.
Puedes usar las mismas declaraciones de tipos con `str`, `float`, `bool` y otros tipos de datos más complejos.
Exploraremos varios de estos tipos en los próximos capítulos del tutorial.
## El orden importa
Cuando creas *operaciones de path* puedes encontrarte con situaciones en las que tengas un path fijo.
Digamos algo como `/users/me` que sea para obtener datos del usuario actual.
... y luego puedes tener el path `/users/{user_id}` para obtener los datos sobre un usuario específico asociados a un ID de usuario.
Porque las *operaciones de path* son evaluadas en orden, tienes que asegurarte de que el path para `/users/me` sea declarado antes que el path para `/users/{user_id}`:
```Python hl_lines="6 11"
{!../../../docs_src/path_params/tutorial003.py!}
```
De otra manera el path para `/users/{user_id}` coincidiría también con `/users/me` "pensando" que está recibiendo el parámetro `user_id` con el valor `"me"`.
## Valores predefinidos
Si tienes una *operación de path* que recibe un *parámetro de path* pero quieres que los valores posibles del *parámetro de path* sean predefinidos puedes usar un <abbr title="Enumeration">`Enum`</abbr> estándar de Python.
### Crea una clase `Enum`
Importa `Enum` y crea una sub-clase que herede desde `str` y desde `Enum`.
Al heredar desde `str` la documentación de la API podrá saber que los valores deben ser de tipo `string` y podrá mostrarlos correctamente.
Luego crea atributos de clase con valores fijos, que serán los valores disponibles válidos:
```Python hl_lines="1 6-9"
{!../../../docs_src/path_params/tutorial005.py!}
```
!!! info "Información"
Las <a href="https://docs.python.org/3/library/enum.html" class="external-link" target="_blank">Enumerations (o enums) están disponibles en Python</a> desde la versión 3.4.
!!! tip "Consejo"
Si lo estás dudando, "AlexNet", "ResNet", y "LeNet" son solo nombres de <abbr title="Tecnicamente, arquitecturas de modelos de Deep Learning">modelos</abbr> de Machine Learning.
### Declara un *parámetro de path*
Luego, crea un *parámetro de path* con anotaciones de tipos usando la clase enum que creaste (`ModelName`):
```Python hl_lines="16"
{!../../../docs_src/path_params/tutorial005.py!}
```
### Revisa la documentación
Debido a que los valores disponibles para el *parámetro de path* están predefinidos, la documentación interactiva los puede mostrar bien:
<img src="/img/tutorial/path-params/image03.png">
### Trabajando con los *enumerations* de Python
El valor del *parámetro de path* será un *enumeration member*.
#### Compara *enumeration members*
Puedes compararlo con el *enumeration member* en el enum (`ModelName`) que creaste:
```Python hl_lines="17"
{!../../../docs_src/path_params/tutorial005.py!}
```
#### Obtén el *enumeration value*
Puedes obtener el valor exacto (un `str` en este caso) usando `model_name.value`, o en general, `your_enum_member.value`:
```Python hl_lines="20"
{!../../../docs_src/path_params/tutorial005.py!}
```
!!! tip "Consejo"
También podrías obtener el valor `"lenet"` con `ModelName.lenet.value`.
#### Devuelve *enumeration members*
Puedes devolver *enum members* desde tu *operación de path* inclusive en un body de JSON anidado (por ejemplo, un `dict`).
Ellos serán convertidos a sus valores correspondientes (strings en este caso) antes de devolverlos al cliente:
```Python hl_lines="18 21 23"
{!../../../docs_src/path_params/tutorial005.py!}
```
En tu cliente obtendrás una respuesta en JSON como:
```JSON
{
"model_name": "alexnet",
"message": "Deep Learning FTW!"
}
```
## Parámetros de path parameters que contienen paths
Digamos que tienes una *operación de path* con un path `/files/{file_path}`.
Pero necesitas que el mismo `file_path` contenga un path como `home/johndoe/myfile.txt`.
Entonces, la URL para ese archivo sería algo como: `/files/home/johndoe/myfile.txt`.
### Soporte de OpenAPI
OpenAPI no soporta una manera de declarar un *parámetro de path* que contenga un path, dado que esto podría llevar a escenarios que son difíciles de probar y definir.
Sin embargo, lo puedes hacer en **FastAPI** usando una de las herramientas internas de Starlette.
La documentación seguirá funcionando, aunque no añadirá ninguna información diciendo que el parámetro debería contener un path.
### Convertidor de path
Usando una opción directamente desde Starlette puedes declarar un *parámetro de path* que contenga un path usando una URL como:
```
/files/{file_path:path}
```
En este caso el nombre del parámetro es `file_path` y la última parte, `:path`, le dice que el parámetro debería coincidir con cualquier path.
Entonces lo puedes usar con:
```Python hl_lines="6"
{!../../../docs_src/path_params/tutorial004.py!}
```
!!! tip "Consejo"
Podrías necesitar que el parámetro contenga `/home/johndoe/myfile.txt` con un slash inicial (`/`).
En este caso la URL sería `/files//home/johndoe/myfile.txt` con un slash doble (`//`) entre `files` y `home`.
## Repaso
Con **FastAPI**, usando declaraciones de tipo de Python intuitivas y estándares, obtienes:
* Soporte en el editor: chequeos de errores, auto-completado, etc.
* "<abbr title="convertir el string que viene de un HTTP request a datos de Python">Parsing</abbr>" de datos
* Validación de datos
* Anotación de la API y documentación automática
Solo tienes que declararlos una vez.
Esa es probablemente la principal ventaja visible de **FastAPI** sobre otros frameworks alternativos (aparte del rendimiento puro).

View File

@@ -0,0 +1,197 @@
# Parámetros de query
Cuando declaras otros parámetros de la función que no hacen parte de los parámetros de path estos se interpretan automáticamente como parámetros de "query".
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial001.py!}
```
El query es el conjunto de pares de key-value que van después del `?` en la URL, separados por caracteres `&`.
Por ejemplo, en la URL:
```
http://127.0.0.1:8000/items/?skip=0&limit=10
```
...los parámetros de query son:
* `skip`: con un valor de `0`
* `limit`: con un valor de `10`
Dado que son parte de la URL son strings "naturalmente".
Pero cuando los declaras con tipos de Python (en el ejemplo arriba, como `int`) son convertidos a ese tipo y son validados con él.
Todo el proceso que aplicaba a los parámetros de path también aplica a los parámetros de query:
* Soporte del editor (obviamente)
* <abbr title="convertir el string que viene de un HTTP request a datos de Python">"Parsing"</abbr> de datos
* Validación de datos
* Documentación automática
## Configuraciones por defecto
Como los parámetros de query no están fijos en una parte del path pueden ser opcionales y pueden tener valores por defecto.
El ejemplo arriba tiene `skip=0` y `limit=10` como los valores por defecto.
Entonces, si vas a la URL:
```
http://127.0.0.1:8000/items/
```
Sería lo mismo que ir a:
```
http://127.0.0.1:8000/items/?skip=0&limit=10
```
Pero, si por ejemplo vas a:
```
http://127.0.0.1:8000/items/?skip=20
```
Los valores de los parámetros en tu función serán:
* `skip=20`: porque lo definiste en la URL
* `limit=10`: porque era el valor por defecto
## Parámetros opcionales
Del mismo modo puedes declarar parámetros de query opcionales definiendo el valor por defecto como `None`:
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial002.py!}
```
En este caso el parámetro de la función `q` será opcional y será `None` por defecto.
!!! check "Revisa"
También puedes notar que **FastAPI** es lo suficientemente inteligente para darse cuenta de que el parámetro de path `item_id` es un parámetro de path y que `q` no lo es, y por lo tanto es un parámetro de query.
!!! note "Nota"
FastAPI sabrá que `q` es opcional por el `= None`.
El `Optional` en `Optional[str]` no es usado por FastAPI (FastAPI solo usará la parte `str`), pero el `Optional[str]` le permitirá a tu editor ayudarte a encontrar errores en tu código.
## Conversión de tipos de parámetros de query
También puedes declarar tipos `bool` y serán convertidos:
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial003.py!}
```
En este caso, si vas a:
```
http://127.0.0.1:8000/items/foo?short=1
```
o
```
http://127.0.0.1:8000/items/foo?short=True
```
o
```
http://127.0.0.1:8000/items/foo?short=true
```
o
```
http://127.0.0.1:8000/items/foo?short=on
```
o
```
http://127.0.0.1:8000/items/foo?short=yes
```
o cualquier otra variación (mayúsculas, primera letra en mayúscula, etc.) tu función verá el parámetro `short` con un valor `bool` de `True`. Si no, lo verá como `False`.
## Múltiples parámetros de path y query
Puedes declarar múltiples parámetros de path y parámetros de query al mismo tiempo. **FastAPI** sabe cuál es cuál.
No los tienes que declarar en un orden específico.
Serán detectados por nombre:
```Python hl_lines="8 10"
{!../../../docs_src/query_params/tutorial004.py!}
```
## Parámetros de query requeridos
Cuando declaras un valor por defecto para los parámetros que no son de path (por ahora solo hemos visto parámetros de query), entonces no es requerido.
Si no quieres añadir un valor específico sino solo hacerlo opcional, pon el valor por defecto como `None`.
Pero cuando quieres hacer que un parámetro de query sea requerido, puedes simplemente no declararle un valor por defecto:
```Python hl_lines="6-7"
{!../../../docs_src/query_params/tutorial005.py!}
```
Aquí el parámetro de query `needy` es un parámetro de query requerido, del tipo `str`.
Si abres tu navegador en una URL como:
```
http://127.0.0.1:8000/items/foo-item
```
...sin añadir el parámetro `needy` requerido, verás un error como:
```JSON
{
"detail": [
{
"loc": [
"query",
"needy"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}
```
Dado que `needy` es un parámetro requerido necesitarías declararlo en la URL:
```
http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
```
...esto funcionaría:
```JSON
{
"item_id": "foo-item",
"needy": "sooooneedy"
}
```
Por supuesto que también puedes definir algunos parámetros como requeridos, con un valor por defecto y otros completamente opcionales:
```Python hl_lines="10"
{!../../../docs_src/query_params/tutorial006.py!}
```
En este caso hay 3 parámetros de query:
* `needy`, un `str` requerido.
* `skip`, un `int` con un valor por defecto de `0`.
* `limit`, un `int` opcional.
!!! tip "Consejo"
También podrías usar los `Enum`s de la misma manera que con los [Parámetros de path](path-params.md#predefined-values){.internal-link target=_blank}.

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -54,6 +57,9 @@ nav:
- python-types.md
- Tutorial - Guía de Usuario:
- tutorial/index.md
- tutorial/first-steps.md
- tutorial/path-params.md
- tutorial/query-params.md
- Guía de Usuario Avanzada:
- advanced/index.md
- async.md
@@ -76,7 +82,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -90,16 +98,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

View File

@@ -0,0 +1,446 @@
# Alternatives, inspiration et comparaisons
Ce qui a inspiré **FastAPI**, comment il se compare à d'autres solutions et ce qu'il en a appris.
## Intro
**FastAPI** n'existerait pas sans les précédentes contributions d'autres projets.
De nombreux outils ont été créés auparavant et ont contribué à inspirer sa création.
J'ai évité la création d'un nouveau framework pendant plusieurs années. J'ai d'abord essayé de combler toutes les
fonctionnalités couvertes par **FastAPI** en utilisant de nombreux frameworks, plug-ins et outils différents.
Mais à un moment donné il n'y avait pas d'autre option que de créer quelque chose qui offrait toutes ces
fonctionnalités, en reprenant et en combinant de la meilleure façon possible les meilleures idées des outils
précédents, en utilisant des fonctionnalités du langage qui n'étaient même pas disponibles auparavant (type hints depuis Python 3.6+).
## Outils précédents
### <a href="https://www.djangoproject.com/" class="external-link" target="_blank">Django</a>
C'est le framework Python le plus populaire et il bénéficie d'une grande confiance. Il est utilisé pour construire
des systèmes tel qu'Instagram.
Il est relativement fortement couplé aux bases de données relationnelles (comme MySQL ou PostgreSQL), de sorte qu'il
n'est pas très facile d'utiliser une base de données NoSQL (comme Couchbase, MongoDB, Cassandra, etc.) comme principal moyen de
stockage.
Il a été créé pour générer le HTML en backend, pas pour créer des API consommées par un frontend moderne (comme React, Vue.js et Angular) ou par d'autres systèmes (comme les appareils <abbr title="Internet of Things">IoT</abbr>) communiquant avec lui.
### <a href="https://www.django-rest-framework.org/" class="external-link" target="_blank">Django REST Framework</a>
Django REST framework a été conçu comme une boîte à outils flexible permettant de construire des API Web à partir de Django, afin d'améliorer ses capacités en matière d'API.
Il est utilisé par de nombreuses entreprises, dont Mozilla, Red Hat et Eventbrite.
Il s'agissait de l'un des premiers exemples de **documentation automatique pour API**, et c'est précisément l'une des
premières idées qui a inspiré "la recherche de" **FastAPI**.
!!! note
Django REST framework a été créé par Tom Christie. Le créateur de Starlette et Uvicorn, sur lesquels **FastAPI** est basé.
!!! check "A inspiré **FastAPI** à"
Avoir une interface de documentation automatique de l'API.
### <a href="https://flask.palletsprojects.com" class="external-link" target="_blank">Flask</a>
Flask est un "micro-framework", il ne comprend pas d'intégrations de bases de données ni beaucoup de choses qui sont fournies par défaut dans Django.
Cette simplicité et cette flexibilité permettent d'utiliser des bases de données NoSQL comme principal système de stockage de données.
Comme il est très simple, son apprentissage est relativement intuitif, bien que la documentation soit quelque peu
technique par moments.
Il est aussi couramment utilisé pour d'autres applications qui n'ont pas nécessairement besoin d'une base de données, de gestion des utilisateurs ou de l'une des nombreuses fonctionnalités préinstallées dans Django. Bien que beaucoup de ces fonctionnalités puissent être ajoutées avec des plug-ins.
Ce découplage des parties, et le fait d'être un "micro-framework" qui puisse être étendu pour couvrir exactement ce
qui est nécessaire, était une caractéristique clé que je voulais conserver.
Compte tenu de la simplicité de Flask, il semblait bien adapté à la création d'API. La prochaine chose à trouver était un "Django REST Framework" pour Flask.
!!! check "A inspiré **FastAPI** à"
Être un micro-framework. Il est donc facile de combiner les outils et les pièces nécessaires.
Proposer un système de routage simple et facile à utiliser.
### <a href="https://requests.readthedocs.io" class="external-link" target="_blank">Requests</a>
**FastAPI** n'est pas réellement une alternative à **Requests**. Leur cadre est très différent.
Il serait en fait plus courant d'utiliser Requests _à l'intérieur_ d'une application FastAPI.
Mais quand même, FastAPI s'est inspiré de Requests.
**Requests** est une bibliothèque pour _interagir_ avec les API (en tant que client), tandis que **FastAPI** est une bibliothèque pour _créer_ des API (en tant que serveur).
Ils sont, plus ou moins, aux extrémités opposées, se complétant l'un l'autre.
Requests a un design très simple et intuitif, il est très facile à utiliser, avec des valeurs par défaut raisonnables, tout en étant très puissant et personnalisable.
C'est pourquoi, comme le dit le site officiel :
> Requests est l'un des packages Python les plus téléchargés de tous les temps
La façon dont vous l'utilisez est très simple. Par exemple, pour faire une requête `GET`, vous devez écrire :
```Python
response = requests.get("http://example.com/some/url")
```
En contrepartie l'API _des opérations de chemin_ de FastAPI pourrait ressembler à ceci :
```Python hl_lines="1"
@app.get("/some/url")
def read_url():
return {"message": "Hello World"}
```
Notez les similitudes entre `requests.get(...)` et `@app.get(...)`.
!!! check "A inspiré **FastAPI** à"
_ Avoir une API simple et intuitive.
_ Utiliser les noms de méthodes HTTP (opérations) directement, de manière simple et intuitive. \* Avoir des valeurs par défaut raisonnables, mais des personnalisations puissantes.
### <a href="https://swagger.io/" class="external-link" target="_blank">Swagger</a> / <a href="https://github.com/OAI/OpenAPI-Specification/" class="external-link" target="_blank">OpenAPI</a>
La principale fonctionnalité que j'ai emprunté à Django REST Framework était la documentation automatique des API.
Puis j'ai découvert qu'il existait une norme pour documenter les API, en utilisant JSON (ou YAML, une extension de JSON) appelée Swagger.
Il existait déjà une interface utilisateur Web pour les API Swagger. Donc, être capable de générer une documentation
Swagger pour une API permettrait d'utiliser cette interface utilisateur web automatiquement.
À un moment donné, Swagger a été cédé à la Fondation Linux, puis a été rebaptisé OpenAPI.
C'est pourquoi, lorsqu'on parle de la version 2.0, il est courant de dire "Swagger", et pour la version 3+ "OpenAPI".
!!! check "A inspiré **FastAPI** à"
Adopter et utiliser une norme ouverte pour les spécifications des API, au lieu d'un schéma personnalisé.
Intégrer des outils d'interface utilisateur basés sur des normes :
* <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>
* <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>
Ces deux-là ont été choisis parce qu'ils sont populaires et stables, mais en faisant une recherche rapide, vous pourriez trouver des dizaines d'alternatives supplémentaires pour OpenAPI (que vous pouvez utiliser avec **FastAPI**).
### Frameworks REST pour Flask
Il y a plusieurs frameworks REST pour Flask, mais après avoir investi du temps et du travail pour les étudier, j'ai
découvert que le développement de beaucoup d'entre eux sont suspendus ou abandonnés, avec plusieurs problèmes
permanents qui les rendent inadaptés.
### <a href="https://marshmallow.readthedocs.io/en/3.0/" class="external-link" target="_blank">Marshmallow</a>
L'une des principales fonctionnalités nécessaires aux systèmes API est la "<abbr title="également appelée
marshalling, conversion">sérialisation</abbr>" des données, qui consiste à prendre les données du code (Python) et à
les convertir en quelque chose qui peut être envoyé sur le réseau. Par exemple, convertir un objet contenant des
données provenant d'une base de données en un objet JSON. Convertir des objets `datetime` en strings, etc.
La validation des données est une autre fonctionnalité importante dont ont besoin les API. Elle permet de s'assurer
que les données sont valides, compte tenu de certains paramètres. Par exemple, qu'un champ est un `int`, et non un
string.
Ceci est particulièrement utile pour les données entrantes.
Sans un système de validation des données, vous devriez effectuer toutes les vérifications à la main, dans le code.
Ces fonctionnalités sont ce pourquoi Marshmallow a été construit. C'est une excellente bibliothèque, et je l'ai déjà beaucoup utilisée.
Mais elle a été créée avant que les type hints n'existent en Python. Ainsi, pour définir chaque <abbr title="la définition de
la façon dont les données doivent être formées">schéma</abbr>, vous devez utiliser des utilitaires et des classes spécifiques fournies par Marshmallow.
!!! check "A inspiré **FastAPI** à"
Utilisez du code pour définir des "schémas" qui fournissent automatiquement les types de données et la validation.
### <a href="https://webargs.readthedocs.io/en/latest/" class="external-link" target="_blank">Webargs</a>
Une autre grande fonctionnalité requise par les API est le <abbr title="la lecture et la conversion en données
Python">parsing</abbr> des données provenant des requêtes entrantes.
Webargs est un outil qui a été créé pour fournir cela par-dessus plusieurs frameworks, dont Flask.
Il utilise Marshmallow pour effectuer la validation des données. Et il a été créé par les mêmes développeurs.
C'est un outil formidable et je l'ai beaucoup utilisé aussi, avant d'avoir **FastAPI**.
!!! info
Webargs a été créé par les développeurs de Marshmallow.
!!! check "A inspiré **FastAPI** à"
Disposer d'une validation automatique des données des requêtes entrantes.
### <a href="https://apispec.readthedocs.io/en/stable/" class="external-link" target="_blank">APISpec</a>
Marshmallow et Webargs fournissent la validation, l'analyse et la sérialisation en tant que plug-ins.
Mais la documentation fait toujours défaut. C'est alors qu'APISpec a été créé.
Il s'agit d'un plug-in pour de nombreux frameworks (et il existe également un plug-in pour Starlette).
Le principe est le suivant : vous écrivez la définition du schéma au format YAML dans la docstring de chaque fonction gérant une route.
Et il génère des schémas OpenAPI.
C'est ainsi que cela fonctionne dans Flask, Starlette, Responder, etc.
Mais alors, nous avons à nouveau le problème d'avoir une micro-syntaxe, dans une docstring Python (un gros morceau de YAML).
L'éditeur ne peut guère aider en la matière. Et si nous modifions les paramètres ou les schémas Marshmallow et que nous oublions de modifier également cette docstring YAML, le schéma généré deviendrait obsolète.
!!! info
APISpec a été créé par les développeurs de Marshmallow.
!!! check "A inspiré **FastAPI** à"
Supporter la norme ouverte pour les API, OpenAPI.
### <a href="https://flask-apispec.readthedocs.io/en/latest/" class="external-link" target="_blank">Flask-apispec</a>
C'est un plug-in pour Flask, qui relie Webargs, Marshmallow et APISpec.
Il utilise les informations de Webargs et Marshmallow pour générer automatiquement des schémas OpenAPI, en utilisant APISpec.
C'est un excellent outil, très sous-estimé. Il devrait être beaucoup plus populaire que de nombreux plug-ins Flask. C'est peut-être dû au fait que sa documentation est trop concise et abstraite.
Cela a permis de ne pas avoir à écrire YAML (une autre syntaxe) à l'intérieur des docstrings Python.
Cette combinaison de Flask, Flask-apispec avec Marshmallow et Webargs était ma stack backend préférée jusqu'à la création de **FastAPI**.
Son utilisation a conduit à la création de plusieurs générateurs Flask full-stack. Ce sont les principales stacks que
j'ai (ainsi que plusieurs équipes externes) utilisées jusqu'à présent :
- <a href="https://github.com/tiangolo/full-stack" class="external-link" target="_blank">https://github.com/tiangolo/full-stack</a>
- <a href="https://github.com/tiangolo/full-stack-flask-couchbase" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-flask-couchbase</a>
- <a href="https://github.com/tiangolo/full-stack-flask-couchdb" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-flask-couchdb</a>
Ces mêmes générateurs full-stack ont servi de base aux [Générateurs de projets pour **FastAPI**](project-generation.md){.internal-link target=\_blank}.
!!! info
Flask-apispec a été créé par les développeurs de Marshmallow.
!!! check "A inspiré **FastAPI** à"
Générer le schéma OpenAPI automatiquement, à partir du même code qui définit la sérialisation et la validation.
### <a href="https://nestjs.com/" class="external-link" target="_blank">NestJS</a> (et <a href="https://angular.io/" class="external-link" target="_blank">Angular</a>)
Ce n'est même pas du Python, NestJS est un framework JavaScript (TypeScript) NodeJS inspiré d'Angular.
Il réalise quelque chose de similaire à ce qui peut être fait avec Flask-apispec.
Il possède un système d'injection de dépendances intégré, inspiré d'Angular 2. Il nécessite de pré-enregistrer les "injectables" (comme tous les autres systèmes d'injection de dépendances que je connais), donc, cela ajoute à la verbosité et à la répétition du code.
Comme les paramètres sont décrits avec des types TypeScript (similaires aux type hints de Python), la prise en charge
par l'éditeur est assez bonne.
Mais comme les données TypeScript ne sont pas préservées après la compilation en JavaScript, il ne peut pas compter sur les types pour définir la validation, la sérialisation et la documentation en même temps. En raison de cela et de certaines décisions de conception, pour obtenir la validation, la sérialisation et la génération automatique de schémas, il est nécessaire d'ajouter des décorateurs à de nombreux endroits. Cela devient donc assez verbeux.
Il ne peut pas très bien gérer les modèles imbriqués. Ainsi, si le corps JSON de la requête est un objet JSON comportant des champs internes qui sont à leur tour des objets JSON imbriqués, il ne peut pas être correctement documenté et validé.
!!! check "A inspiré **FastAPI** à"
Utiliser les types Python pour bénéficier d'un excellent support de l'éditeur.
Disposer d'un puissant système d'injection de dépendances. Trouver un moyen de minimiser la répétition du code.
### <a href="https://sanic.readthedocs.io/en/latest/" class="external-link" target="_blank">Sanic</a>
C'était l'un des premiers frameworks Python extrêmement rapides basés sur `asyncio`. Il a été conçu pour être très similaire à Flask.
!!! note "Détails techniques"
Il utilisait <a href="https://github.com/MagicStack/uvloop" class="external-link" target="_blank">`uvloop`</a> au lieu du système par défaut de Python `asyncio`. C'est ce qui l'a rendu si rapide.
Il a clairement inspiré Uvicorn et Starlette, qui sont actuellement plus rapides que Sanic dans les benchmarks.
!!! check "A inspiré **FastAPI** à"
Trouvez un moyen d'avoir une performance folle.
C'est pourquoi **FastAPI** est basé sur Starlette, car il s'agit du framework le plus rapide disponible (testé par des benchmarks tiers).
### <a href="https://falconframework.org/" class="external-link" target="_blank">Falcon</a>
Falcon est un autre framework Python haute performance, il est conçu pour être minimal, et est utilisé comme fondation pour d'autres frameworks comme Hug.
Il utilise le standard précédent pour les frameworks web Python (WSGI) qui est synchrone, donc il ne peut pas gérer les WebSockets et d'autres cas d'utilisation. Néanmoins, il offre de très bonnes performances.
Il est conçu pour avoir des fonctions qui reçoivent deux paramètres, une "requête" et une "réponse". Ensuite, vous
"lisez" des parties de la requête et "écrivez" des parties dans la réponse. En raison de cette conception, il n'est
pas possible de déclarer des paramètres de requête et des corps avec des indications de type Python standard comme paramètres de fonction.
Ainsi, la validation, la sérialisation et la documentation des données doivent être effectuées dans le code, et non pas automatiquement. Ou bien elles doivent être implémentées comme un framework au-dessus de Falcon, comme Hug. Cette même distinction se retrouve dans d'autres frameworks qui s'inspirent de la conception de Falcon, qui consiste à avoir un objet de requête et un objet de réponse comme paramètres.
!!! check "A inspiré **FastAPI** à"
Trouver des moyens d'obtenir de bonnes performances.
Avec Hug (puisque Hug est basé sur Falcon), **FastAPI** a inspiré la déclaration d'un paramètre `response` dans les fonctions.
Bien que dans FastAPI, il est facultatif, et est utilisé principalement pour définir les en-têtes, les cookies, et les codes de statut alternatifs.
### <a href="https://moltenframework.com/" class="external-link" target="_blank">Molten</a>
J'ai découvert Molten lors des premières étapes de développement de **FastAPI**. Et il a des idées assez similaires :
- Basé sur les type hints Python.
- Validation et documentation via ces types.
- Système d'injection de dépendances.
Il n'utilise pas une librairie tiers de validation, sérialisation et de documentation tel que Pydantic, il utilise son propre système. Ainsi, ces définitions de types de données ne sont pas réutilisables aussi facilement.
Il nécessite une configuration un peu plus verbeuse. Et comme il est basé sur WSGI (au lieu dASGI), il n'est pas
conçu pour profiter des hautes performances fournies par des outils comme Uvicorn, Starlette et Sanic.
Le système d'injection de dépendances exige le pré-enregistrement des dépendances et les dépendances sont résolues sur la base des types déclarés. Ainsi, il n'est pas possible de déclarer plus d'un "composant" qui fournit un certain type.
Les routes sont déclarées à un seul endroit, en utilisant des fonctions déclarées à d'autres endroits (au lieu
d'utiliser des décorateurs qui peuvent être placés juste au-dessus de la fonction qui gère l'endpoint). Cette
méthode est plus proche de celle de Django que de celle de Flask (et Starlette). Il sépare dans le code des choses
qui sont relativement fortement couplées.
!!! check "A inspiré **FastAPI** à"
Définir des validations supplémentaires pour les types de données utilisant la valeur "par défaut" des attributs du modèle. Ceci améliore le support de l'éditeur, et n'était pas disponible dans Pydantic auparavant.
Cela a en fait inspiré la mise à jour de certaines parties de Pydantic, afin de supporter le même style de déclaration de validation (toute cette fonctionnalité est maintenant déjà disponible dans Pydantic).
### <a href="https://www.hug.rest/" class="external-link" target="_blank">Hug</a>
Hug a été l'un des premiers frameworks à implémenter la déclaration des types de paramètres d'API en utilisant les type hints Python. C'était une excellente idée qui a inspiré d'autres outils à faire de même.
Il utilisait des types personnalisés dans ses déclarations au lieu des types Python standard, mais c'était tout de même un énorme pas en avant.
Il a également été l'un des premiers frameworks à générer un schéma personnalisé déclarant l'ensemble de l'API en JSON.
Il n'était pas basé sur une norme comme OpenAPI et JSON Schema. Il ne serait donc pas simple de l'intégrer à d'autres outils, comme Swagger UI. Mais encore une fois, c'était une idée très innovante.
Il présente une caractéristique intéressante et peu commune : à l'aide du même framework, il est possible de créer des
API et des CLI.
Comme il est basé sur l'ancienne norme pour les frameworks web Python synchrones (WSGI), il ne peut pas gérer les Websockets et autres, bien qu'il soit également très performant.
!!! info
Hug a été créé par Timothy Crosley, le créateur de <a href="https://github.com/timothycrosley/isort" class="external-link" target="_blank">`isort`</a>, un excellent outil pour trier automatiquement les imports dans les fichiers Python.
!!! check "A inspiré **FastAPI** à"
Hug a inspiré certaines parties d'APIStar, et était l'un des outils que je trouvais les plus prometteurs, à côté d'APIStar.
Hug a contribué à inspirer **FastAPI** pour utiliser les type hints Python
pour déclarer les paramètres, et pour générer automatiquement un schéma définissant l'API.
Hug a inspiré **FastAPI** pour déclarer un paramètre `response` dans les fonctions pour définir les en-têtes et les cookies.
### <a href="https://github.com/encode/apistar" class="external-link" target="_blank">APIStar</a> (<= 0.5)
Juste avant de décider de développer **FastAPI**, j'ai trouvé le serveur **APIStar**. Il contenait presque tout ce
que je recherchais et avait un beau design.
C'était l'une des premières implémentations d'un framework utilisant les type hints Python pour déclarer les paramètres
et les requêtes que j'ai vues (avant NestJS et Molten). Je l'ai trouvé plus ou moins en même temps que Hug. Mais APIStar utilisait le standard OpenAPI.
Il disposait de la validation automatique, sérialisation des données et d'une génération de schéma OpenAPI basée sur les mêmes type hints à plusieurs endroits.
La définition du schéma de corps de requête n'utilisait pas les mêmes type hints Python que Pydantic, il était un peu plus proche de Marshmallow, donc le support de l'éditeur n'était pas aussi bon, mais APIStar était quand même la meilleure option disponible.
Il avait les meilleures performances d'après les benchmarks de l'époque (seulement surpassé par Starlette).
Au départ, il ne disposait pas d'une interface web de documentation automatique de l'API, mais je savais que je pouvais lui ajouter une interface Swagger.
Il avait un système d'injection de dépendances. Il nécessitait un pré-enregistrement des composants, comme d'autres outils discutés ci-dessus. Mais c'était quand même une excellente fonctionnalité.
Je n'ai jamais pu l'utiliser dans un projet complet, car il n'avait pas d'intégration de sécurité, et je ne pouvais donc pas remplacer toutes les fonctionnalités que j'avais avec les générateurs complets basés sur Flask-apispec. J'avais dans mon backlog de projets de créer une pull request pour ajouter cette fonctionnalité.
Mais ensuite, le projet a changé d'orientation.
Il ne s'agissait plus d'un framework web API, le créateur devant se concentrer sur Starlette.
Maintenant, APIStar est un ensemble d'outils pour valider les spécifications OpenAPI, et non un framework web.
!!! info
APIStar a été créé par Tom Christie. Le même gars qui a créé :
* Django REST Framework
* Starlette (sur lequel **FastAPI** est basé)
* Uvicorn (utilisé par Starlette et **FastAPI**)
!!! check "A inspiré **FastAPI** à"
Exister.
L'idée de déclarer plusieurs choses (validation des données, sérialisation et documentation) avec les mêmes types Python, tout en offrant un excellent support pour les éditeurs, était pour moi une idée brillante.
Et après avoir longtemps cherché un framework similaire et testé de nombreuses alternatives, APIStar était la meilleure option disponible.
Puis APIStar a cessé d'exister en tant que serveur et Starlette a été créé, et a constitué une meilleure base pour un tel système. Ce fut l'inspiration finale pour construire **FastAPI**.
Je considère **FastAPI** comme un "successeur spirituel" d'APIStar, tout en améliorant et en augmentant les fonctionnalités, le système de typage et d'autres parties, sur la base des enseignements tirés de tous ces outils précédents.
## Utilisés par **FastAPI**
### <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>
Pydantic est une bibliothèque permettant de définir la validation, la sérialisation et la documentation des données (à l'aide de JSON Schema) en se basant sur les Python type hints.
Cela le rend extrêmement intuitif.
Il est comparable à Marshmallow. Bien qu'il soit plus rapide que Marshmallow dans les benchmarks. Et comme il est
basé sur les mêmes type hints Python, le support de l'éditeur est grand.
!!! check "**FastAPI** l'utilise pour"
Gérer toute la validation des données, leur sérialisation et la documentation automatique du modèle (basée sur le schéma JSON).
**FastAPI** prend ensuite ces données JSON Schema et les place dans OpenAPI, en plus de toutes les autres choses qu'il fait.
### <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>
Starlette est un framework/toolkit léger <abbr title="Le nouveau standard pour construire des applications web assynchrones en Python">ASGI</abbr>, qui est idéal pour construire des services asyncio performants.
Il est très simple et intuitif. Il est conçu pour être facilement extensible et avoir des composants modulaires.
Il offre :
- Des performances vraiment impressionnantes.
- Le support des WebSockets.
- Le support de GraphQL.
- Les tâches d'arrière-plan.
- Les événements de démarrage et d'arrêt.
- Un client de test basé sur request.
- CORS, GZip, fichiers statiques, streaming des réponses.
- Le support des sessions et des cookies.
- Une couverture de test à 100 %.
- 100 % de la base de code avec des annotations de type.
- Zéro forte dépendance à d'autres packages.
Starlette est actuellement le framework Python le plus rapide testé. Seulement dépassé par Uvicorn, qui n'est pas un framework, mais un serveur.
Starlette fournit toutes les fonctionnalités de base d'un micro-framework web.
Mais il ne fournit pas de validation automatique des données, de sérialisation ou de documentation.
C'est l'une des principales choses que **FastAPI** ajoute par-dessus, le tout basé sur les type hints Python (en utilisant Pydantic). Cela, plus le système d'injection de dépendances, les utilitaires de sécurité, la génération de schémas OpenAPI, etc.
!!! note "Détails techniques"
ASGI est une nouvelle "norme" développée par les membres de l'équipe principale de Django. Il ne s'agit pas encore d'une "norme Python" (un PEP), bien qu'ils soient en train de le faire.
Néanmoins, il est déjà utilisé comme "standard" par plusieurs outils. Cela améliore grandement l'interopérabilité, puisque vous pouvez remplacer Uvicorn par n'importe quel autre serveur ASGI (comme Daphne ou Hypercorn), ou vous pouvez ajouter des outils compatibles ASGI, comme `python-socketio`.
!!! check "**FastAPI** l'utilise pour"
Gérer toutes les parties web de base. Ajouter des fonctionnalités par-dessus.
La classe `FastAPI` elle-même hérite directement de la classe `Starlette`.
Ainsi, tout ce que vous pouvez faire avec Starlette, vous pouvez le faire directement avec **FastAPI**, car il s'agit en fait de Starlette sous stéroïdes.
### <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>
Uvicorn est un serveur ASGI rapide comme l'éclair, basé sur uvloop et httptools.
Il ne s'agit pas d'un framework web, mais d'un serveur. Par exemple, il ne fournit pas d'outils pour le routing. C'est
quelque chose qu'un framework comme Starlette (ou **FastAPI**) fournirait par-dessus.
C'est le serveur recommandé pour Starlette et **FastAPI**.
!!! check "**FastAPI** le recommande comme"
Le serveur web principal pour exécuter les applications **FastAPI**.
Vous pouvez le combiner avec Gunicorn, pour avoir un serveur multi-processus asynchrone.
Pour plus de détails, consultez la section [Déploiement](deployment/index.md){.internal-link target=_blank}.
## Benchmarks et vitesse
Pour comprendre, comparer et voir la différence entre Uvicorn, Starlette et FastAPI, consultez la section sur les [Benchmarks](benchmarks.md){.internal-link target=\_blank}.

View File

@@ -0,0 +1,82 @@
# Articles et liens externes
**FastAPI** possède une grande communauté en constante extension.
Il existe de nombreux articles, outils et projets liés à **FastAPI**.
Voici une liste incomplète de certains d'entre eux.
!!! tip "Astuce"
Si vous avez un article, projet, outil, ou quoi que ce soit lié à **FastAPI** qui n'est actuellement pas listé ici, créez une <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">Pull Request l'ajoutant</a>.
## Articles
### Anglais
{% if external_links %}
{% for article in external_links.articles.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Japonais
{% if external_links %}
{% for article in external_links.articles.japanese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Vietnamien
{% if external_links %}
{% for article in external_links.articles.vietnamese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Russe
{% if external_links %}
{% for article in external_links.articles.russian %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### Allemand
{% if external_links %}
{% for article in external_links.articles.german %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Podcasts
{% if external_links %}
{% for article in external_links.podcasts.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Conférences
{% if external_links %}
{% for article in external_links.talks.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> par <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## Projets
Les projets Github avec le topic `fastapi` les plus récents :
<div class="github-topic-projects">
</div>

View File

@@ -0,0 +1,175 @@
# La communauté FastAPI
FastAPI a une communauté extraordinaire qui accueille des personnes de tous horizons.
## Créateur - Mainteneur
Salut! 👋
C'est moi :
{% if people %}
<div class="user-list user-list-center">
{% for user in people.maintainers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Réponses: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div>
{% endfor %}
</div>
{% endif %}
Je suis le créateur et le responsable de **FastAPI**. Vous pouvez en lire plus à ce sujet dans [Aide FastAPI - Obtenir de l'aide - Se rapprocher de l'auteur](help-fastapi.md#connect-with-the-author){.internal-link target=_blank}.
...Mais ici, je veux vous montrer la communauté.
---
**FastAPI** reçoit beaucoup de soutien de la part de la communauté. Et je tiens à souligner leurs contributions.
Ce sont ces personnes qui :
* [Aident les autres à résoudre des problèmes (questions) dans GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank}.
* [Créent des Pull Requests](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}.
* Review les Pull Requests, [particulièrement important pour les traductions](contributing.md#translations){.internal-link target=_blank}.
Une salve d'applaudissements pour eux. 👏 🙇
## Utilisateurs les plus actifs le mois dernier
Ce sont les utilisateurs qui ont [aidé le plus les autres avec des problèmes (questions) dans GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank} au cours du dernier mois. ☕
{% if people %}
<div class="user-list user-list-center">
{% for user in people.last_month_active %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Questions répondues: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Experts
Voici les **Experts FastAPI**. 🤓
Ce sont les utilisateurs qui ont [aidé le plus les autres avec des problèmes (questions) dans GitHub](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank} depuis *toujours*.
Ils ont prouvé qu'ils étaient des experts en aidant beaucoup d'autres personnes. ✨
{% if people %}
<div class="user-list user-list-center">
{% for user in people.experts %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Questions répondues: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Principaux contributeurs
Ces utilisateurs sont les **Principaux contributeurs**. 👷
Ces utilisateurs ont [créé le plus grand nombre de demandes Pull Request](help-fastapi.md#create-a-pull-request){.internal-link target=_blank} qui ont été *merged*.
Ils ont contribué au code source, à la documentation, aux traductions, etc. 📦
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_contributors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Pull Requests: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
Il existe de nombreux autres contributeurs (plus d'une centaine), vous pouvez les voir tous dans la <a href="https://github.com/tiangolo/fastapi/graphs/contributors" class="external-link" target="_blank">Page des contributeurs de FastAPI GitHub</a>. 👷
## Principaux Reviewers
Ces utilisateurs sont les **Principaux Reviewers**. 🕵️
### Reviewers des traductions
Je ne parle que quelques langues (et pas très bien 😅). Ainsi, les reviewers sont ceux qui ont le [**pouvoir d'approuver les traductions**](contributing.md#translations){.internal-link target=_blank} de la documentation. Sans eux, il n'y aurait pas de documentation dans plusieurs autres langues.
---
Les **Principaux Reviewers** 🕵️ ont examiné le plus grand nombre de demandes Pull Request des autres, assurant la qualité du code, de la documentation, et surtout, des **traductions**.
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_reviewers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Reviews: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Sponsors
Ce sont les **Sponsors**. 😎
Ils soutiennent mon travail avec **FastAPI** (et d'autres) avec <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a>.
### Gold 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 %}
{% endif %}
### Silver Sponsors
{% if sponsors %}
{% 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 %}
### Bronze Sponsors
{% if sponsors %}
{% for sponsor in sponsors.bronze -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}
### Individual Sponsors
{% if people %}
{% if people.sponsors_50 %}
<div class="user-list user-list-center">
{% for user in people.sponsors_50 %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% if people %}
<div class="user-list user-list-center">
{% for user in people.sponsors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
## À propos des données - détails techniques
L'intention de cette page est de souligner l'effort de la communauté pour aider les autres.
Notamment en incluant des efforts qui sont normalement moins visibles, et, dans de nombreux cas, plus difficile, comme aider d'autres personnes à résoudre des problèmes et examiner les Pull Requests de traduction.
Les données sont calculées chaque mois, vous pouvez lire le <a href="https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">code source ici</a>.
Je me réserve également le droit de mettre à jour l'algorithme, les sections, les seuils, etc. (juste au cas où 🤷).

201
docs/fr/docs/features.md Normal file
View File

@@ -0,0 +1,201 @@
# Fonctionnalités
## Fonctionnalités de FastAPI
**FastAPI** vous offre ceci:
### Basé sur des standards ouverts
* <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank"><strong>OpenAPI</strong></a> pour la création d'API, incluant la déclaration de <abbr title="en français: routes. Aussi connu sous le nom anglais endpoints ou routes">path</abbr> <abbr title="Aussi connu sous le nom de méthodes HTTP. À savoir POST, GET, PUT, DELETE">operations</abbr>, paramètres, corps de requêtes, sécurité, etc.
* Documentation automatique des modèles de données avec <a href="http://json-schema.org/" class="external-link" target="_blank"><strong>JSON Schema</strong></a> (comme OpenAPI est aussi basée sur JSON Schema).
* Conçue avec ces standards après une analyse méticuleuse. Plutôt qu'en rajoutant des surcouches après coup.
* Cela permet d'utiliser de la **génération automatique de code client** dans beaucoup de langages.
### Documentation automatique
Documentation d'API interactive et interface web d'exploration. Comme le framework est basé sur OpenAPI, de nombreuses options sont disponibles. Deux d'entre-elles sont incluses par défaut.
* <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank"><strong>Swagger UI</strong></a>, propose une documentation interactive. Vous permet de directement tester l'API depuis votre navigateur.
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Une autre documentation d'API est fournie par <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank"><strong>ReDoc</strong></a>.
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Faite en python moderne
Tout est basé sur la déclaration de type standard de **Python 3.6** (grâce à Pydantic). Pas de nouvelles syntaxes à apprendre. Juste du Python standard et moderne.
Si vous souhaitez un rappel de 2 minutes sur l'utilisation des types en Python (même si vous ne comptez pas utiliser FastAPI), jetez un oeil au tutoriel suivant: [Python Types](python-types.md){.internal-link target=_blank}.
Vous écrivez du python standard avec des annotations de types:
```Python
from typing import List, Dict
from datetime import date
from pydantic import BaseModel
# Déclare une variable comme étant une str
# et profitez de l'aide de votre IDE dans cette fonction
def main(user_id: str):
return user_id
# Un modèle Pydantic
class User(BaseModel):
id: int
name: str
joined: date
```
Qui peuvent ensuite être utilisés comme cela:
```Python
my_user: User = User(id=3, name="John Doe", joined="2018-07-19")
second_user_data = {
"id": 4,
"name": "Mary",
"joined": "2018-11-30",
}
my_second_user: User = User(**second_user_data)
```
!!! info
`**second_user_data` signifie:
Utilise les clés et valeurs du dictionnaire `second_user_data` directement comme des arguments clé-valeur. C'est équivalent à: `User(id=4, name="Mary", joined="2018-11-30")`
### Support d'éditeurs
Tout le framework a été conçu pour être facile et intuitif d'utilisation, toutes les décisions de design ont été testées sur de nombreux éditeurs avant même de commencer le développement final afin d'assurer la meilleure expérience de développement possible.
Dans le dernier sondage effectué auprès de développeurs python il était clair que <a href="https://www.jetbrains.com/research/python-developers-survey-2017/#tools-and-features" class="external-link" target="_blank">la fonctionnalité la plus utilisée est "l'autocomplètion"</a>.
Tout le framwork **FastAPI** a été conçu avec cela en tête. L'autocomplétion fonctionne partout.
Vous devrez rarement revenir à la documentation.
Voici comment votre éditeur peut vous aider:
* dans <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
* dans <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>:
![editor support](https://fastapi.tiangolo.com/img/pycharm-completion.png)
Vous aurez des propositions de complétion que vous n'auriez jamais imaginées. Par exemple la clé `prix` dans le corps d'un document JSON (qui est peut-être imbriqué) venant d'une requête.
Plus jamais vous ne vous tromperez en tapant le nom d'une clé, vous ne ferez des aller-retour entre votre code et la documentation ou vous ne scrollerez de haut en bas afin d'enfin savoir si vous devez taper `username` ou `user_name`.
### Court
Des **valeurs par défaut** sont définies pour tout, des configurations optionnelles sont présentent partout. Tous ces paramètres peuvent être ajustés afin de faire ce que vous voulez et définir l'API dont vous avez besoin.
Mais, **tout fonctionne** par défaut.
### Validation
* Validation pour la plupart (ou tous?) les **types de données** Python incluant:
* objets JSON (`dict`).
* listes JSON (`list`) définissant des types d'éléments.
* Champs String (`str`), définition de longueur minimum ou maximale.
* Nombres (`int`, `float`) avec valeur minimale and maximale, etc.
* Validation pour des types plus exotiques, tel que:
* URL.
* Email.
* UUID.
* ...et autres.
Toutes les validations sont gérées par le bien établi et robuste **Pydantic**.
### Sécurité et authentification
La sécurité et l'authentification sont intégrées. Sans aucun compromis avec les bases de données ou les modèles de données.
Tous les protocoles de sécurités sont définis dans OpenAPI, incluant:
* HTTP Basic.
* **OAuth2** (aussi avec **JWT tokens**). Jetez un oeil au tutoriel [OAuth2 avec JWT](tutorial/security/oauth2-jwt.md){.internal-link target=_blank}.
* Clés d'API dans:
* Le header.
* Les paramètres de requêtes.
* Les cookies, etc.
Plus toutes les fonctionnalités de sécurités venant de Starlette (incluant les **cookies de sessions**).
Le tout conçu en composant réutilisable facilement intégrable à vos systèmes, data stores, base de données relationnelle ou NoSQL, etc.
### Injection de dépendances
FastAPI contient un système simple mais extrêmement puissant d'<abbr title='aussi connus sous le nom de "composants", "ressources", "services", "providers"'><strong>Injection de Dépendances</strong></abbr>.
* Même les dépendances peuvent avoir des dépendances, créant une hiérarchie ou un **"graph" de dépendances**
* Tout est **automatiquement géré** par le framework
* Toutes les dépendances peuvent éxiger des données d'une requêtes et **Augmenter les contraintes d'un path operation** et de la documentation automatique.
* **Validation automatique** même pour les paramètres de *path operation* définis dans les dépendances.
* Supporte les systèmes d'authentification d'utilisateurs complexes, les **connexions de base de données**, etc.
* **Aucun compromis** avec les bases de données, les frontends, etc. Mais une intégration facile avec n'importe lequel d'entre eux.
### "Plug-ins" illimités
Ou, en d'autres termes, pas besoin d'eux, importez le code que vous voulez et utilisez le.
Tout intégration est conçue pour être si simple à utiliser (avec des dépendances) que vous pouvez créer un "plug-in" pour votre application en deux lignes de code utilisant la même syntaxe que celle de vos *path operations*
### Testé
* 100% <abbr title="La quantité de code qui est testé automatiquement">de couverture de test</abbr>.
* 100% <abbr title="Annotation de types Python, avec cela votre éditeur et autres outils externes peuvent vous fournir un meilleur support">d'annotations de type</abbr> dans le code.
* Utilisé dans des applications mises en production.
## Fonctionnalités de Starlette
**FastAPI** est complètement compatible (et basé sur) <a href="https://www.starlette.io/" class="external-link" target="_blank"><strong>Starlette</strong></a>. Le code utilisant Starlette que vous ajouterez fonctionnera donc aussi.
En fait, `FastAPI` est un sous compposant de `Starlette`. Donc, si vous savez déjà comment utiliser Starlette, la plupart des fonctionnalités fonctionneront de la même manière.
Avec **FastAPI** vous aurez toutes les fonctionnalités de **Starlette** (FastAPI est juste Starlette sous stéroïdes):
* Des performances vraiments impressionnantes. C'est l'<a href="https://github.com/encode/starlette#performance" class="external-link" target="_blank">un des framework Python les plus rapide, à égalité avec **NodeJS** et **GO**</a>.
* Le support des **WebSockets**.
* Le support de **GraphQL**.
* Les <abbr title="En anglais: In-process background tasks">tâches d'arrière-plan.</abbr>
* Des évènements de démarrages et d'arrêt.
* Un client de test basé sur `request`
* **CORS**, GZip, Static Files, Streaming responses.
* Le support des **Sessions et Cookies**.
* Une couverture de test à 100 %.
* 100 % de la base de code avec des annotations de type.
## Fonctionnalités de Pydantic
**FastAPI** est totalement compatible avec (et basé sur) <a href="https://pydantic-docs.helpmanual.io" class="external-link" target="_blank"><strong>Pydantic</strong></a>. Le code utilisant Pydantic que vous ajouterez fonctionnera donc aussi.
Inclus des librairies externes basées, aussi, sur Pydantic, servent d'<abbr title="Object-Relational Mapper">ORM</abbr>s, <abbr title="Object-Document Mapper">ODM</abbr>s pour les bases de données.
Cela signifie aussi que, dans la plupart des cas, vous pouvez fournir l'objet reçu d'une requête **directement à la base de données**, comme tout est validé automatiquement.
Inversément, dans la plupart des cas vous pourrez juste envoyer l'objet récupéré de la base de données **directement au client**
Avec **FastAPI** vous aurez toutes les fonctionnalités de **Pydantic** (comme FastAPI est basé sur Pydantic pour toutes les manipulations de données):
* **Pas de prise de tête**:
* Pas de nouveau langage de définition de schéma à apprendre.
* Si vous connaissez le typage en python vous savez comment utiliser Pydantic.
* Aide votre **<abbr title="Integrated Development Environment, il s'agit de votre éditeur de code">IDE</abbr>/<abbr title="Programme qui analyse le code à la recherche d'erreurs">linter</abbr>/cerveau**:
* Parce que les structures de données de pydantic consistent seulement en une instance de classe que vous définissez; l'auto-complétion, le linting, mypy et votre intuition devrait être largement suffisante pour valider vos données.
* **Rapide**:
* Dans les <a href="https://pydantic-docs.helpmanual.io/#benchmarks-tag" class="external-link" target="_blank">benchmarks</a> Pydantic est plus rapide que toutes les autres librairies testées.
* Valide les **structures complexes**:
* Utilise les modèles hiérarchique de Pydantic, le `typage` Python pour les `Lists`, `Dict`, etc.
* Et les validateurs permettent aux schémas de données complexes d'être clairement et facilement définis, validés et documentés sous forme d'un schéma JSON.
* Vous pouvez avoir des objets **JSON fortements imbriqués** tout en ayant, pour chacun, de la validation et des annotations.
* **Renouvelable**:
* Pydantic permet de définir de nouveaux types de données ou vous pouvez étendre la validation avec des méthodes sur un modèle décoré avec le<abbr title="en anglais: validator decorator"> décorateur de validation</abbr>
* 100% de couverture de test.

View File

@@ -44,13 +44,16 @@ The key features are:
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -0,0 +1,84 @@
# Génération de projets - Modèle
Vous pouvez utiliser un générateur de projet pour commencer, qui réalisera pour vous la mise en place de bases côté architecture globale, sécurité, base de données et premières routes d'API.
Un générateur de projet fera toujours une mise en place très subjective que vous devriez modifier et adapter suivant vos besoins, mais cela reste un bon point de départ pour vos projets.
## Full Stack FastAPI PostgreSQL
GitHub : <a href="https://github.com/tiangolo/full-stack-fastapi-postgresql" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-fastapi-postgresql</a>
### Full Stack FastAPI PostgreSQL - Fonctionnalités
* Intégration **Docker** complète (basée sur Docker).
* Déploiement Docker en mode <a href="https://docs.docker.com/engine/swarm/" class="external-link" target="_blank">Swarm</a>
* Intégration **Docker Compose** et optimisation pour développement local.
* Serveur web Python **prêt au déploiement** utilisant Uvicorn et Gunicorn.
* Backend Python <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">**FastAPI**</a> :
* **Rapide** : Très hautes performances, comparables à **NodeJS** ou **Go** (grâce à Starlette et Pydantic).
* **Intuitif** : Excellent support des éditeurs. <abbr title="aussi appelée auto-complétion, autocomplétion, IntelliSense...">Complétion</abbr> partout. Moins de temps passé à déboguer.
* **Facile** : Fait pour être facile à utiliser et apprendre. Moins de temps passé à lire de la documentation.
* **Concis** : Minimise la duplication de code. Plusieurs fonctionnalités à chaque déclaration de paramètre.
* **Robuste** : Obtenez du code prêt pour être utilisé en production. Avec de la documentation automatique interactive.
* **Basé sur des normes** : Basé sur (et totalement compatible avec) les normes ouvertes pour les APIs : <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> et <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>.
* <a href="https://fastapi.tiangolo.com/features/" class="external-link" target="_blank">**Et bien d'autres fonctionnalités**</a> comme la validation automatique, la sérialisation, l'authentification avec OAuth2 JWT tokens, etc.
* Hashage de **mots de passe sécurisé** par défaut.
* Authentification par **jetons JWT**.
* Modèles **SQLAlchemy** (indépendants des extensions Flask, afin qu'ils puissent être utilisés directement avec des *workers* Celery).
* Modèle de démarrages basiques pour les utilisateurs (à modifier et supprimer au besoin).
* Migrations **Alembic**.
* **CORS** (partage des ressources entre origines multiples, ou *Cross Origin Resource Sharing*).
* *Worker* **Celery** pouvant importer et utiliser les modèles et le code du reste du backend.
* Tests du backend REST basés sur **Pytest**, intégrés dans Docker, pour que vous puissiez tester toutes les interactions de l'API indépendamment de la base de données. Étant exécutés dans Docker, les tests peuvent utiliser un nouvel entrepôt de données créé de zéro à chaque fois (vous pouvez donc utiliser ElasticSearch, MongoDB, CouchDB, etc. et juste tester que l'API fonctionne).
* Intégration Python facile avec **Jupyter Kernels** pour le développement à distance ou intra-Docker avec des extensions comme Atom Hydrogen ou Visual Studio Code Jupyter.
* Frontend **Vue** :
* Généré avec Vue CLI.
* Gestion de l'**Authentification JWT**.
* Page de connexion.
* Après la connexion, page de tableau de bord principal.
* Tableau de bord principal avec création et modification d'utilisateurs.
* Modification de ses propres caractéristiques utilisateur.
* **Vuex**.
* **Vue-router**.
* **Vuetify** pour de magnifiques composants *material design*.
* **TypeScript**.
* Serveur Docker basé sur **Nginx** (configuré pour être facilement manipulé avec Vue-router).
* Utilisation de *Docker multi-stage building*, pour ne pas avoir besoin de sauvegarder ou *commit* du code compilé.
* Tests frontend exécutés à la compilation (pouvant être désactivés).
* Fait aussi modulable que possible, pour pouvoir fonctionner comme tel, tout en pouvant être utilisé qu'en partie grâce à Vue CLI.
* **PGAdmin** pour les bases de données PostgreSQL, facilement modifiable pour utiliser PHPMYAdmin ou MySQL.
* **Flower** pour la surveillance de tâches Celery.
* Équilibrage de charge entre le frontend et le backend avec **Traefik**, afin de pouvoir avoir les deux sur le même domaine, séparés par chemins, mais servis par différents conteneurs.
* Intégration Traefik, comprenant la génération automatique de certificat **HTTPS** Let's Encrypt.
* GitLab **CI** (intégration continue), comprenant des tests pour le frontend et le backend.
## Full Stack FastAPI Couchbase
GitHub : <a href="https://github.com/tiangolo/full-stack-fastapi-couchbase" class="external-link" target="_blank">https://github.com/tiangolo/full-stack-fastapi-couchbase</a>
⚠️ **ATTENTION** ⚠️
Si vous démarrez un nouveau projet de zéro, allez voir les alternatives au début de cette page.
Par exemple, le générateur de projet <a href="https://github.com/tiangolo/full-stack-fastapi-postgresql" class="external-link" target="_blank">Full Stack FastAPI PostgreSQL</a> peut être une meilleure alternative, étant activement maintenu et utilisé et comprenant toutes les nouvelles fonctionnalités et améliorations.
Vous êtes toujours libre d'utiliser le générateur basé sur Couchbase si vous le voulez, cela devrait probablement fonctionner correctement, et si vous avez déjà un projet généré en utilisant ce dernier, cela devrait fonctionner aussi (et vous l'avez déjà probablement mis à jour suivant vos besoins).
Vous pouvez en apprendre plus dans la documentation du dépôt GithHub.
## Full Stack FastAPI MongoDB
...viendra surement plus tard, suivant le temps que j'ai. 😅 🎉
## Modèles d'apprentissage automatique avec spaCy et FastAPI
GitHub : <a href="https://github.com/microsoft/cookiecutter-spacy-fastapi" class="external-link" target="_blank">https://github.com/microsoft/cookiecutter-spacy-fastapi</a>
## Modèles d'apprentissage automatique avec spaCy et FastAPI - Fonctionnalités
* Intégration d'un modèle NER **spaCy**.
* Formatage de requête pour **Azure Cognitive Search**.
* Serveur Python web **prêt à utiliser en production** utilisant Uvicorn et Gunicorn.
* Déploiement CI/CD Kubernetes pour **Azure DevOps** (AKS).
* **Multilangues**. Choisissez facilement l'une des langues intégrées à spaCy durant la mise en place du projet.
* **Facilement généralisable** à d'autres bibliothèques similaires (Pytorch, Tensorflow), et non juste spaCy.

View File

@@ -0,0 +1,314 @@
# Introduction aux Types Python
Python supporte des annotations de type (ou *type hints*) optionnelles.
Ces annotations de type constituent une syntaxe spéciale qui permet de déclarer le <abbr title="par exemple : str, int, float, bool">type</abbr> d'une variable.
En déclarant les types de vos variables, cela permet aux différents outils comme les éditeurs de texte d'offrir un meilleur support.
Ce chapitre n'est qu'un **tutoriel rapide / rappel** sur les annotations de type Python.
Seulement le minimum nécessaire pour les utiliser avec **FastAPI** sera couvert... ce qui est en réalité très peu.
**FastAPI** est totalement basé sur ces annotations de type, qui lui donnent de nombreux avantages.
Mais même si vous n'utilisez pas ou n'utiliserez jamais **FastAPI**, vous pourriez bénéficier d'apprendre quelques choses sur ces dernières.
!!! note
Si vous êtes un expert Python, et que vous savez déjà **tout** sur les annotations de type, passez au chapitre suivant.
## Motivations
Prenons un exemple simple :
```Python
{!../../../docs_src/python_types/tutorial001.py!}
```
Exécuter ce programe affiche :
```
John Doe
```
La fonction :
* Prend un `first_name` et un `last_name`.
* Convertit la première lettre de chaque paramètre en majuscules grâce à `title()`.
* Concatène les résultats avec un espace entre les deux.
```Python hl_lines="2"
{!../../../docs_src/python_types/tutorial001.py!}
```
### Limitations
C'est un programme très simple.
Mais maintenant imaginez que vous l'écriviez de zéro.
À un certain point vous auriez commencé la définition de la fonction, vous aviez les paramètres prêts.
Mais vous aviez besoin de "cette méthode qui convertit la première lettre en majuscule".
Était-ce `upper` ? `uppercase` ? `first_uppercase` ? `capitalize` ?
Vous essayez donc d'utiliser le vieil ami du programmeur, l'auto-complétion de l'éditeur.
Vous écrivez le premier paramètre, `first_name`, puis un point (`.`) et appuyez sur `Ctrl+Espace` pour déclencher l'auto-complétion.
Mais malheureusement, rien d'utile n'en résulte :
<img src="/img/python-types/image01.png">
### Ajouter des types
Modifions une seule ligne de la version précédente.
Nous allons changer seulement cet extrait, les paramètres de la fonction, de :
```Python
first_name, last_name
```
à :
```Python
first_name: str, last_name: str
```
C'est tout.
Ce sont des annotations de types :
```Python hl_lines="1"
{!../../../docs_src/python_types/tutorial002.py!}
```
À ne pas confondre avec la déclaration de valeurs par défaut comme ici :
```Python
first_name="john", last_name="doe"
```
C'est une chose différente.
On utilise un deux-points (`:`), et pas un égal (`=`).
Et ajouter des annotations de types ne crée normalement pas de différence avec le comportement qui aurait eu lieu si elles n'étaient pas là.
Maintenant, imaginez que vous êtes en train de créer cette fonction, mais avec des annotations de type cette fois.
Au même moment que durant l'exemple précédent, vous essayez de déclencher l'auto-complétion et vous voyez :
<img src="/img/python-types/image02.png">
Vous pouvez donc dérouler les options jusqu'à trouver la méthode à laquelle vous pensiez.
<img src="/img/python-types/image03.png">
## Plus de motivations
Cette fonction possède déjà des annotations de type :
```Python hl_lines="1"
{!../../../docs_src/python_types/tutorial003.py!}
```
Comme l'éditeur connaît le type des variables, vous n'avez pas seulement l'auto-complétion, mais aussi de la détection d'erreurs :
<img src="/img/python-types/image04.png">
Maintenant que vous avez connaissance du problème, convertissez `age` en <abbr title="string">chaine de caractères</abbr> grâce à `str(age)` :
```Python hl_lines="2"
{!../../../docs_src/python_types/tutorial004.py!}
```
## Déclarer des types
Vous venez de voir là où les types sont généralement déclarés : dans les paramètres de fonctions.
C'est aussi ici que vous les utiliseriez avec **FastAPI**.
### Types simples
Vous pouvez déclarer tous les types de Python, pas seulement `str`.
Comme par exemple :
* `int`
* `float`
* `bool`
* `bytes`
```Python hl_lines="1"
{!../../../docs_src/python_types/tutorial005.py!}
```
### Types génériques avec des paramètres de types
Il existe certaines structures de données qui contiennent d'autres valeurs, comme `dict`, `list`, `set` et `tuple`. Et les valeurs internes peuvent elles aussi avoir leurs propres types.
Pour déclarer ces types et les types internes, on utilise le module standard de Python `typing`.
Il existe spécialement pour supporter ces annotations de types.
#### `List`
Par exemple, définissons une variable comme `list` de `str`.
Importez `List` (avec un `L` majuscule) depuis `typing`.
```Python hl_lines="1"
{!../../../docs_src/python_types/tutorial006.py!}
```
Déclarez la variable, en utilisant la syntaxe des deux-points (`:`).
Et comme type, mettez `List`.
Les listes étant un type contenant des types internes, mettez ces derniers entre crochets (`[`, `]`) :
```Python hl_lines="4"
{!../../../docs_src/python_types/tutorial006.py!}
```
!!! tip "Astuce"
Ces types internes entre crochets sont appelés des "paramètres de type".
Ici, `str` est un paramètre de type passé à `List`.
Ce qui signifie : "la variable `items` est une `list`, et chacun de ses éléments a pour type `str`.
En faisant cela, votre éditeur pourra vous aider, même pendant que vous traitez des éléments de la liste.
<img src="/img/python-types/image05.png">
Sans types, c'est presque impossible à réaliser.
Vous remarquerez que la variable `item` n'est qu'un des éléments de la list `items`.
Et pourtant, l'éditeur sait qu'elle est de type `str` et pourra donc vous aider à l'utiliser.
#### `Tuple` et `Set`
C'est le même fonctionnement pour déclarer un `tuple` ou un `set` :
```Python hl_lines="1 4"
{!../../../docs_src/python_types/tutorial007.py!}
```
Dans cet exemple :
* La variable `items_t` est un `tuple` avec 3 éléments, un `int`, un deuxième `int`, et un `str`.
* La variable `items_s` est un `set`, et chacun de ses éléments est de type `bytes`.
#### `Dict`
Pour définir un `dict`, il faut lui passer 2 paramètres, séparés par une virgule (`,`).
Le premier paramètre de type est pour les clés et le second pour les valeurs du dictionnaire (`dict`).
```Python hl_lines="1 4"
{!../../../docs_src/python_types/tutorial008.py!}
```
Dans cet exemple :
* La variable `prices` est de type `dict` :
* Les clés de ce dictionnaire sont de type `str`.
* Les valeurs de ce dictionnaire sont de type `float`.
#### `Optional`
Vous pouvez aussi utiliser `Optional` pour déclarer qu'une variable a un type, comme `str` mais qu'il est "optionnel" signifiant qu'il pourrait aussi être `None`.
```Python hl_lines="1 4"
{!../../../docs_src/python_types/tutorial009.py!}
```
Utiliser `Optional[str]` plutôt que `str` permettra à l'éditeur de vous aider à détecter les erreurs où vous supposeriez qu'une valeur est toujours de type `str`, alors qu'elle pourrait aussi être `None`.
#### Types génériques
Les types qui peuvent contenir des paramètres de types entre crochets, comme :
* `List`
* `Tuple`
* `Set`
* `Dict`
* `Optional`
* ...et d'autres.
sont appelés des **types génériques** ou **Generics**.
### Classes en tant que types
Vous pouvez aussi déclarer une classe comme type d'une variable.
Disons que vous avez une classe `Person`, avec une variable `name` :
```Python hl_lines="1-3"
{!../../../docs_src/python_types/tutorial010.py!}
```
Vous pouvez ensuite déclarer une variable de type `Person` :
```Python hl_lines="6"
{!../../../docs_src/python_types/tutorial010.py!}
```
Et vous aurez accès, encore une fois, au support complet offert par l'éditeur :
<img src="/img/python-types/image06.png">
## Les modèles Pydantic
<a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> est une bibliothèque Python pour effectuer de la validation de données.
Vous déclarez la forme de la donnée avec des classes et des attributs.
Chaque attribut possède un type.
Puis vous créez une instance de cette classe avec certaines valeurs et **Pydantic** validera les valeurs, les convertira dans le type adéquat (si c'est nécessaire et possible) et vous donnera un objet avec toute la donnée.
Ainsi, votre éditeur vous offrira un support adapté pour l'objet résultant.
Extrait de la documentation officielle de **Pydantic** :
```Python
{!../../../docs_src/python_types/tutorial011.py!}
```
!!! info
Pour en savoir plus à propos de <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic, allez jeter un coup d'oeil à sa documentation</a>.
**FastAPI** est basé entièrement sur **Pydantic**.
Vous verrez bien plus d'exemples de son utilisation dans [Tutoriel - Guide utilisateur](tutorial/index.md){.internal-link target=_blank}.
## Les annotations de type dans **FastAPI**
**FastAPI** utilise ces annotations pour faire différentes choses.
Avec **FastAPI**, vous déclarez des paramètres grâce aux annotations de types et vous obtenez :
* **du support de l'éditeur**
* **de la vérification de types**
...et **FastAPI** utilise ces mêmes déclarations pour :
* **Définir les prérequis** : depuis les paramètres de chemins des requêtes, les entêtes, les corps, les dépendances, etc.
* **Convertir des données** : depuis la requête vers les types requis.
* **Valider des données** : venant de chaque requête :
* Générant automatiquement des **erreurs** renvoyées au client quand la donnée est invalide.
* **Documenter** l'API avec OpenAPI :
* ce qui ensuite utilisé par les interfaces utilisateur automatiques de documentation interactive.
Tout cela peut paraître bien abstrait, mais ne vous inquiétez pas, vous verrez tout ça en pratique dans [Tutoriel - Guide utilisateur](tutorial/index.md){.internal-link target=_blank}.
Ce qu'il faut retenir c'est qu'en utilisant les types standard de Python, à un seul endroit (plutôt que d'ajouter plus de classes, de décorateurs, etc.), **FastAPI** fera une grande partie du travail pour vous.
!!! info
Si vous avez déjà lu le tutoriel et êtes revenus ici pour voir plus sur les types, une bonne ressource est la <a href="https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html" class="external-link" target="_blank">"cheat sheet" de `mypy`</a>.

View File

@@ -0,0 +1,94 @@
# Tâches d'arrière-plan
Vous pouvez définir des tâches d'arrière-plan qui seront exécutées après avoir retourné une réponse.
Ceci est utile pour les opérations qui doivent avoir lieu après une requête, mais où le client n'a pas réellement besoin d'attendre que l'opération soit terminée pour recevoir une réponse.
Cela comprend, par exemple :
* Les notifications par email envoyées après l'exécution d'une action :
* Étant donné que se connecter à un serveur et envoyer un email a tendance à être «lent» (plusieurs secondes), vous pouvez retourner la réponse directement et envoyer la notification en arrière-plan.
* Traiter des données :
* Par exemple, si vous recevez un fichier qui doit passer par un traitement lent, vous pouvez retourner une réponse «Accepted» (HTTP 202) puis faire le traitement en arrière-plan.
## Utiliser `BackgroundTasks`
Pour commencer, importez `BackgroundTasks` et définissez un paramètre dans votre *fonction de chemin* avec `BackgroundTasks` comme type déclaré.
```Python hl_lines="1 13"
{!../../../docs_src/background_tasks/tutorial001.py!}
```
**FastAPI** créera l'objet de type `BackgroundTasks` pour vous et le passera comme paramètre.
## Créer une fonction de tâche
Une fonction à exécuter comme tâche d'arrière-plan est juste une fonction standard qui peut recevoir des paramètres.
Elle peut être une fonction asynchrone (`async def`) ou une fonction normale (`def`), **FastAPI** saura la gérer correctement.
Dans cet exemple, la fonction de tâche écrira dans un fichier (afin de simuler un envoi d'email).
L'opération d'écriture n'utilisant ni `async` ni `await`, on définit la fonction avec un `def` normal.
```Python hl_lines="6-9"
{!../../../docs_src/background_tasks/tutorial001.py!}
```
## Ajouter une tâche d'arrière-plan
Dans votre *fonction de chemin*, passez votre fonction de tâche à l'objet de type `BackgroundTasks` (`background_tasks` ici) grâce à la méthode `.add_task()` :
```Python hl_lines="14"
{!../../../docs_src/background_tasks/tutorial001.py!}
```
`.add_task()` reçoit comme arguments :
* Une fonction de tâche à exécuter en arrière-plan (`write_notification`).
* Les arguments positionnels à passer à la fonction de tâche dans l'ordre (`email`).
* Les arguments nommés à passer à la fonction de tâche (`message="some notification"`).
## Injection de dépendances
Utiliser `BackgroundTasks` fonctionne aussi avec le système d'injection de dépendances. Vous pouvez déclarer un paramètre de type `BackgroundTasks` à différents niveaux : dans une *fonction de chemin*, dans une dépendance, dans une sous-dépendance...
**FastAPI** sait quoi faire dans chaque cas et comment réutiliser le même objet, afin que tous les paramètres de type `BackgroundTasks` soient fusionnés et que les tâches soient exécutées en arrière-plan :
```Python hl_lines="13 15 22 25"
{!../../../docs_src/background_tasks/tutorial002.py!}
```
Dans cet exemple, les messages seront écrits dans le fichier `log.txt` après que la réponse soit envoyée.
S'il y avait une `query` (paramètre nommé `q`) dans la requête, alors elle sera écrite dans `log.txt` via une tâche d'arrière-plan.
Et ensuite une autre tâche d'arrière-plan (générée dans les paramètres de la *la fonction de chemin*) écrira un message dans `log.txt` comprenant le paramètre de chemin `email`.
## Détails techniques
La classe `BackgroundTasks` provient directement de <a href="https://www.starlette.io/background/" class="external-link" target="_blank">`starlette.background`</a>.
Elle est importée/incluse directement dans **FastAPI** pour que vous puissiez l'importer depuis `fastapi` et éviter d'importer accidentellement `BackgroundTask` (sans `s` à la fin) depuis `starlette.background`.
En utilisant seulement `BackgroundTasks` (et non `BackgroundTask`), il est possible de l'utiliser en tant que paramètre de *fonction de chemin* et de laisser **FastAPI** gérer le reste pour vous, comme en utilisant l'objet `Request` directement.
Il est tout de même possible d'utiliser `BackgroundTask` seul dans **FastAPI**, mais dans ce cas il faut créer l'objet dans le code et renvoyer une `Response` Starlette l'incluant.
Plus de détails sont disponibles dans <a href="https://www.starlette.io/background/" class="external-link" target="_blank">la documentation officielle de Starlette sur les tâches d'arrière-plan</a> (via leurs classes `BackgroundTasks`et `BackgroundTask`).
## Avertissement
Si vous avez besoin de réaliser des traitements lourds en tâche d'arrière-plan et que vous n'avez pas besoin que ces traitements aient lieu dans le même process (par exemple, pas besoin de partager la mémoire, les variables, etc.), il peut s'avérer profitable d'utiliser des outils plus importants tels que <a href="https://docs.celeryproject.org" class="external-link" target="_blank">Celery</a>.
Ces outils nécessitent généralement des configurations plus complexes ainsi qu'un gestionnaire de queue de message, comme RabbitMQ ou Redis, mais ils permettent d'exécuter des tâches d'arrière-plan dans différents process, et potentiellement, sur plusieurs serveurs.
Pour voir un exemple, allez voir les [Générateurs de projets](../project-generation.md){.internal-link target=_blank}, ils incluent tous Celery déjà configuré.
Mais si vous avez besoin d'accéder aux variables et objets de la même application **FastAPI**, ou si vous avez besoin d'effectuer de petites tâches d'arrière-plan (comme envoyer des notifications par email), vous pouvez simplement vous contenter d'utiliser `BackgroundTasks`.
## Résumé
Importez et utilisez `BackgroundTasks` grâce aux paramètres de *fonction de chemin* et les dépendances pour ajouter des tâches d'arrière-plan.

View File

@@ -39,17 +39,28 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
- features.md
- fastapi-people.md
- python-types.md
- Tutoriel - Guide utilisateur:
- tutorial/background-tasks.md
- project-generation.md
- alternatives.md
- external-links.md
markdown_extensions:
- toc:
permalink: true
@@ -69,7 +80,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -83,16 +96,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

467
docs/id/docs/index.md Normal file
View File

@@ -0,0 +1,467 @@
{!../../../docs/missing-translation.md!}
<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 framework, high performance, easy to learn, fast to code, ready for production</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>
---
**Documentation**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a>
**Source Code**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
---
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:
* **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. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> 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: <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (previously known as Swagger) and <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>.
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Sponsors
<!-- 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">Other sponsors</a>
## 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._"
<div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
---
"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
<div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div>
---
"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
<div style="text-align: right; margin-right: 10%;">Kevin Glisson, Marc Vilanova, Forest Monsen - <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072" target="_blank"><small>(ref)</small></a></div>
---
"_Im over the moon excited about **FastAPI**. Its so fun!_"
<div style="text-align: right; margin-right: 10%;">Brian Okken - <strong><a href="https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855" target="_blank">Python Bytes</a> podcast host</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div>
---
"_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._"
<div style="text-align: right; margin-right: 10%;">Timothy Crosley - <strong><a href="https://www.hug.rest/" target="_blank">Hug</a> creator</strong> <a href="https://news.ycombinator.com/item?id=19455465" target="_blank"><small>(ref)</small></a></div>
---
"_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 [...]_"
"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
<div style="text-align: right; margin-right: 10%;">Ines Montani - Matthew Honnibal - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> founders - <a href="https://spacy.io" target="_blank">spaCy</a> creators</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**, the FastAPI of CLIs
<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>
If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
## Requirements
Python 3.6+
FastAPI stands on the shoulders of giants:
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
## Installation
<div class="termy">
```console
$ pip install fastapi
---> 100%
```
</div>
You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
## Example
### Create it
* Create a file `main.py` with:
```Python
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
<details markdown="1">
<summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`:
```Python hl_lines="9 14"
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
**Note**:
If you don't know, check the _"In a hurry?"_ section about <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` and `await` in the docs</a>.
</details>
### Run it
Run the server with:
<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>About the command <code>uvicorn main:app --reload</code>...</summary>
The command `uvicorn main:app` refers to:
* `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.
</details>
### Check it
Open your browser at <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>.
You will see the JSON response as:
```JSON
{"item_id": 5, "q": "somequery"}
```
You already created an API that:
* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
* Both _paths_ take `GET` <em>operations</em> (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`.
### Interactive API docs
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Example upgrade
Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Optional[bool] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = 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}
```
The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
### Interactive API docs upgrade
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
* The interactive API documentation will be automatically updated, including the new body:
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
* 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:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
### Alternative API docs upgrade
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
* The alternative documentation will also reflect the new query parameter and body:
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Recap
In summary, you declare **once** the types of parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
Just standard **Python 3.6+**.
For example, for an `int`:
```Python
item_id: int
```
or for a more complex `Item` model:
```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.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of input data: coming from the network to Python data and types. Reading from:
* JSON.
* Path parameters.
* Query parameters.
* Cookies.
* Headers.
* Forms.
* Files.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> 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:
* 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.
---
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:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
**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 **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** 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`
* **CORS**
* **Cookie Sessions**
* ...and more.
## Performance
Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <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">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
## Optional Dependencies
Used by Pydantic:
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - for faster 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> - for email validation.
Used by Starlette:
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://github.com/Tinche/aiofiles" target="_blank"><code>aiofiles</code></a> - Required if you want to use `FileResponse` or `StaticFiles`.
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
* <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
* <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - Required for `GraphQLApp` support.
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
Used by FastAPI / Starlette:
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
You can install all of these with `pip install fastapi[all]`.
## License
This project is licensed under the terms of the MIT license.

125
docs/id/mkdocs.yml Normal file
View File

@@ -0,0 +1,125 @@
site_name: FastAPI
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
site_url: https://fastapi.tiangolo.com/id/
theme:
name: material
custom_dir: overrides
palette:
- scheme: default
primary: teal
accent: amber
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
- scheme: slate
primary: teal
accent: amber
toggle:
icon: material/lightbulb
name: Switch to dark mode
features:
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github-alt
logo: https://fastapi.tiangolo.com/img/icon-white.svg
favicon: https://fastapi.tiangolo.com/img/favicon.png
language: id
repo_name: tiangolo/fastapi
repo_url: https://github.com/tiangolo/fastapi
edit_uri: ''
google_analytics:
- UA-133183413-1
- auto
plugins:
- search
- markdownextradata:
data: data
nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
markdown_extensions:
- toc:
permalink: true
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- extra
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_div_format ''
- pymdownx.tabbed
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/tiangolo
- icon: fontawesome/brands/dev
link: https://dev.to/tiangolo
- icon: fontawesome/brands/medium
link: https://medium.com/@tiangolo
- icon: fontawesome/solid/globe
link: https://tiangolo.com
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/
name: ru - русский язык
- link: /sq/
name: sq - shqip
- link: /tr/
name: tr - Türkçe
- link: /uk/
name: uk - українська мова
- link: /zh/
name: zh - 汉语
extra_css:
- https://fastapi.tiangolo.com/css/termynal.css
- https://fastapi.tiangolo.com/css/custom.css
extra_javascript:
- https://unpkg.com/mermaid@8.4.6/dist/mermaid.min.js
- https://fastapi.tiangolo.com/js/termynal.js
- https://fastapi.tiangolo.com/js/custom.js

View File

@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block announce %}
<a class="announce" href="https://fastapi.tiangolo.com/newsletter/">
<span class="twemoji">
{% include ".icons/material/email.svg" %}
</span> Subscribe to the <strong>FastAPI and friends</strong> newsletter 🎉
</a>
<!-- <a class="announce" href="https://tripetto.app/run/RXZ6OLDBXX?s=dc" target="_blank">
<span class="twemoji">
</span>Fill the first-ever <strong>FastAPI user survey</strong> for a chance to win official <strong>FastAPI and Typer stickers</strong> 🎁
</a> -->
{% endblock %}

View File

@@ -44,13 +44,16 @@ The key features are:
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -69,7 +72,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -83,16 +88,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

View File

@@ -179,7 +179,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
これにはクラウドストレージとの連携や映像処理など、多くのライブラリが含まれています。
```Python hl_lines="2 10-11"
```Python hl_lines="2 10-12 14"
{!../../../docs_src/custom_response/tutorial008.py!}
```

View File

@@ -0,0 +1,52 @@
# Path Operationの高度な設定
## OpenAPI operationId
!!! warning "注意"
あなたがOpenAPIの「エキスパート」でなければ、これは必要ないかもしれません。
*path operation*`operation_id` パラメータを利用することで、OpenAPIの `operationId` を設定できます。
`operation_id` は各オペレーションで一意にする必要があります。
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### *path operation関数* の名前をoperationIdとして使用する
APIの関数名を `operationId` として利用したい場合、すべてのAPIの関数をイテレーションし、各 *path operation* の `operationId` を `APIRoute.name` で上書きすれば可能です。
そうする場合は、すべての *path operation* を追加した後に行う必要があります。
```Python hl_lines="2 12-21 24"
{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
!!! tip "豆知識"
`app.openapi()` を手動でコールする場合、その前に`operationId`を更新する必要があります。
!!! warning "注意"
この方法をとる場合、各 *path operation関数* が一意な名前である必要があります。
それらが異なるモジュール (Pythonファイル) にあるとしてもです。
## OpenAPIから除外する
生成されるOpenAPIスキーマ (つまり、自動ドキュメント生成の仕組み) から *path operation* を除外するには、 `include_in_schema` パラメータを `False` にします。
```Python hl_lines="6"
{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## docstringによる説明の高度な設定
*path operation関数* のdocstringからOpenAPIに使用する行を制限することができます。
`\f` (「書式送り (Form Feed)」のエスケープ文字) を付与することで、**FastAPI** はOpenAPIに使用される出力をその箇所までに制限します。
ドキュメントには表示されませんが、他のツール (例えばSphinx) では残りの部分を利用できるでしょう。
```Python hl_lines="19-29"
{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```

393
docs/ja/docs/async.md Normal file
View File

@@ -0,0 +1,393 @@
# 並行処理と async / await
*path operation 関数*のための `async def` に関する詳細と非同期 (asynchronous) コード、並行処理 (Concurrency)、そして、並列処理 (Parallelism) の背景について。
## 急いでいますか?
<abbr title="too long; didn't read (長すぎて読めない人のための要約という意味のスラング)"><strong>TL;DR:</strong></abbr>
次のような、`await` を使用して呼び出すべきサードパーティライブラリを使用している場合:
```Python
results = await some_library()
```
以下の様に `async def` を使用して*path operation 関数*を宣言します。
```Python hl_lines="2"
@app.get('/')
async def read_results():
results = await some_library()
return results
```
!!! note "備考"
`async def` を使用して作成された関数の内部でしか `await` は使用できません。
---
データベース、API、ファイルシステムなどと通信し、`await` の使用をサポートしていないサードパーティライブラリ (現在のほとんどのデータベースライブラリに当てはまります) を使用している場合、次の様に、単に `def` を使用して通常通り *path operation 関数* を宣言してください:
```Python hl_lines="2"
@app.get('/')
def results():
results = some_library()
return results
```
---
アプリケーションが (どういうわけか) 他の何とも通信せず、応答を待つ必要がない場合は、`async def` を使用して下さい。
---
よく分からない場合は、通常の `def` を使用して下さい。
---
**備考**: *path operation 関数*に必要なだけ `def` と `async def` を混在させ、それぞれに最適なオプションを使用して定義できます。それに応じてFastAPIは正しい処理を行います。
とにかく、上記のいずれの場合でもFastAPIは非同期で動作し、非常に高速です。
しかし、上記のステップに従うことで、パフォーマンスの最適化を行えます。
## 技術詳細
現代版のPythonは「**非同期コード**」を、「**コルーチン**」と称されるものを利用してサポートしています。これは **`async` と `await`** 構文を用います。
次のセクションで、フレーズ内のパーツを順に見ていきましょう:
* **非同期コード**
* **`async` と `await`**
* **コルーチン**
## 非同期コード
非同期コードとは、言語💬がコード内のどこかで、コンピュータ/プログラム🤖に *他の何か* がどこか別の箇所で終了するのを待つように伝える手段を持っていることを意味します。*他の何か* は「遅いファイル📝」と呼ばれているとしましょう.
したがって、コンピュータは「遅いファイル📝」が終了するまで、他の処理ができます。
コンピュータ/プログラム🤖は再び待機する機会があるときや、その時点で行っていたすべての作業が完了するたびに戻ってきます。そして、必要な処理をしながら、コンピュータ/プログラム🤖が待っていた処理のどれかが終わっているかどうか確認します。
次に、それ🤖が最初のタスク (要するに、先程の「遅いファイル📝」)を終わらせて、そのタスクの結果を使う必要がある処理を続けます。
この「他の何かを待つ」とは、通常以下の様なものを待つような (プロセッサとRAMメモリの速度に比べて) 相対的に「遅い」<abbr title="インプットとアウトプット">I/O</abbr> 操作を指します:
* ネットワーク経由でクライアントから送信されるデータ
* ネットワーク経由でクライアントが受信する、プログラムから送信されたデータ
* システムによって読み取られ、プログラムに渡されるディスク内のファイル内容
* プログラムがシステムに渡して、ディスクに書き込む内容
* リモートAPI操作
* データベース操作の完了
* データベースクエリが結果を返すこと
* など。
実行時間のほとんどが<abbr title="インプットとアウトプット">I/O</abbr> 操作の待ち時間が占めるため、このような操作を「I/O バウンド」操作と言います。
コンピュータ/プログラムがこのような遅いタスクと「同期 (タスクの結果を取得して作業を続行するために、何もせずに、タスクが完了する瞬間を正確に待つ)」する必要がないため、「非同期」と呼ばれます。
その代わりに、「非同期」システムであることにより、いったん終了すると、タスクは、コンピュータ/プログラムが既に開始した処理がすべて完了するのをほんの少し (数マイクロ秒) 待って、結果を受け取りに戻ってきます。そして、処理を継続します。
「同期」の場合 (「非同期」とは異なり)、「シーケンシャル」という用語もよく使用されます。これは、コンピュータ/プログラムがすべてのステップを (待機が伴う場合でも別のタスクに切り替えることなく) 順番に実行するためです。
### 並行処理とハンバーガー
上記の**非同期**コードのアイデアは、**「並行処理」**と呼ばれることもあります。 **「並列処理」**とは異なります。
**並行処理**と**並列処理**はどちらも「多かれ少なかれ同時に発生するさまざまなこと」に関連しています。
ただし、*並行処理*と*並列処理*の詳細はまったく異なります。
違いを確認するには、ハンバーガーに関する次の物語を想像してみてください:
### 並行ハンバーガー
ファストフード🍔を食べようと、好きな人😍とレジに並んでおり、レジ係💁があなたの前にいる人達の注文を受けつけています。
それからあなたの番になり、好きな人😍と自分のために、2つの非常に豪華なハンバーガー🍔を注文します。
料金を支払います💸。
レジ係💁はキッチンの男👨‍🍳に向かって、あなたのハンバーガー🍔を準備しなければならないと伝えるために何か言いました (彼は現在、前のお客さんの商品を準備していますが)。
レジ係💁はあなたに番号札を渡します。
待っている間、好きな人😍と一緒にテーブルを選んで座り、好きな人😍と長い間話をします (注文したハンバーガーは非常に豪華で、準備に少し時間がかかるので✨🍔✨)。
ハンバーガー🍔を待ちながら好きな人😍とテーブルに座っている間、あなたの好きな人がなんて素晴らしく、かわいくて頭がいいんだと✨😍✨惚れ惚れしながら時間を費やすことができます。
好きな人😍と話しながら待っている間、ときどき、カウンターに表示されている番号をチェックして、自分の番かどうかを確認します。
その後、ついにあなたの番になりました。カウンターに行き、ハンバーガー🍔を手に入れてテーブルに戻ります。
あなたとあなたの好きな人😍はハンバーガー🍔を食べて、楽しい時間を過ごします✨。
---
上記のストーリーで、あなたがコンピュータ/プログラム🤖だと想像してみてください。
列にいる間、あなたはアイドル状態です😴。何も「生産的」なことをせず、ただ自分の番を待っています。しかし、レジ係💁は注文を受け取るだけなので (商品の準備をしているわけではない)、列は高速です。したがって、何も問題ありません。
それから、あなたの番になったら、実に「生産的な」作業を行います🤓、メニューを確認し、欲しいものを決め、好きな人😍の欲しいものを聞き、料金を支払い💸、現金またはカードを正しく渡したか確認し、正しく清算されたことを確認し、注文が正しく通っているかなどを確認します。
しかし、ハンバーガー🍔をまだできていないので、ハンバーガーの準備ができるまで待機🕙する必要があるため、レジ係💁との作業は「一時停止⏸」になります。
しかし、カウンターから離れて、番号札を持ってテーブルに座っているときは、注意を好きな人😍に切り替えて🔀、その上で「仕事⏯🤓」を行なえます。その後、好きな人😍といちゃつくかのような、非常に「生産的な🤓」ことを再び行います。
次に、レジ係💁は、「ハンバーガーの準備ができました🍔」と言って、カウンターのディスプレイに番号を表示しますが、表示番号があなたの番号に変わっても、すぐに狂ったように飛んで行くようなことはありません。あなたは自分の番号札を持っていって、他の人も自分の番号札があるので、あなたのハンバーガー🍔を盗む人がいないことは知っています。
なので、あなたは好きな人😍が話し終えるのを待って (現在の仕事⏯ / 処理中のタスクを終了します🤓)、優しく微笑んで、ハンバーガーを貰ってくるねと言います⏸。
次に、カウンターへ、いまから完了する最初のタスク⏯へ向かい、ハンバーガー🍔を受け取り、感謝の意を表して、テーブルに持っていきます。これで、カウンターとのやり取りのステップ/タスクが完了しました⏹。これにより、「ハンバーガーを食べる🔀⏯」という新しいタスクが作成されます。しかし、前の「ハンバーガーを取得する」というタスクは終了しました⏹。
### 並列ハンバーガー
これらが「並行ハンバーガー」ではなく、「並列ハンバーガー」であるとしましょう。
あなたは好きな人😍と並列ファストフード🍔を買おうとしています。
列に並んでいますが、何人かの料理人兼、レジ係 (8人としましょう) 👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳があなたの前にいる人達の注文を受けつけています。
8人のレジ係がそれぞれ自分で注文を受けるや否や、次の注文を受ける前にハンバーガーを準備するので、あなたの前の人達はカウンターを離れずに、ハンバーガー🍔ができるのを待っています🕙。
それからいよいよあなたの番になり、好きな人😍と自分のために、2つの非常に豪華なハンバーガー🍔を注文します。
料金を支払います💸。
レジ係はキッチンに行きます👨‍🍳。
あなたはカウンターの前に立って待ちます🕙。番号札がないので誰もあなたよりも先にハンバーガー🍔を取らないようにします。
あなたと好きな人😍は忙しいので、誰もあなたの前に来させませんし、あなたのハンバーガーが到着したとき🕙に誰にも取ることを許しません。あなたは好きな人に注意を払えません😞。
これは「同期」作業であり、レジ係/料理人👨‍🍳と「同期」します。レジ係/料理人👨‍🍳がハンバーガー🍔を完成させてあなたに渡すまで待つ🕙必要があり、ちょうどその完成の瞬間にそこにいる必要があります。そうでなければ、他の誰かに取られるかもしれません。
その後、カウンターの前で長い時間待ってから🕙、ついにレジ係/料理人👨‍🍳がハンバーガー🍔を渡しに戻ってきます。
ハンバーガー🍔を取り、好きな人😍とテーブルに行きます。
ただ食べるだけ、それでおしまいです。🍔⏹。
ほとんどの時間、カウンターの前で待つのに費やされていたので🕙、あまり話したりいちゃつくことはありませんでした😞。
---
この並列ハンバーガーのシナリオでは、あなたは2つのプロセッサを備えたコンピュータ/プログラム🤖 (あなたとあなたの好きな人😍) であり、両方とも待機🕙していて、彼らは「カウンターで待機🕙」することに専念しています⏯。
ファストフード店には8つのプロセッサ (レジ係/料理人) 👨🍳👨🍳👨🍳👨🍳👨🍳👨🍳👨🍳👨🍳があります。一方、並行ハンバーガー店には2人 (レジ係と料理人) 💁👨‍🍳しかいなかったかもしれません。
しかし、それでも、最終的な体験は最高ではありません😞。
---
これは、ハンバーガー🍔の話と同等な話になります。
より「現実的な」例として、銀行を想像してみてください。
最近まで、ほとんどの銀行は複数の窓口👨‍💼👨‍💼👨‍💼👨‍💼に、行列🕙🕙🕙🕙🕙🕙🕙🕙ができていました。
すべての窓口で、次々と、一人の客とすべての作業を行います👨‍💼⏯.
その上、長時間、列に並ばなければいけません🕙。そうしないと、順番が回ってきません。
銀行🏦での用事にあなたの好きな人😍を連れて行きたくはないでしょう。
### ハンバーガーのまとめ
この「好きな人とのファストフードハンバーガー」のシナリオでは、待機🕙が多いため、並行システム⏸🔀⏯を使用する方がはるかに理にかなっています。
これは、ほとんどのWebアプリケーションに当てはまります。
多くのユーザーがいますが、サーバーは、あまり強くない回線でのリクエストの送信を待機🕙しています。
そして、レスポンスが返ってくるのをもう一度待機🕙します。
この「待機🕙」はマイクロ秒単位ですが、それでも、すべて合算すると、最終的にはかなり待機することになります。
これが、Web APIへの非同期⏸🔀⏯コードの利用が理にかなっている理由です。
ほとんどの既存の人気のあるPythonフレームワーク (FlaskやDjangoを含む) は、Pythonの新しい非同期機能ができる前に作成されました。したがって、それらをデプロイする方法は、並列実行と、新機能ほど強力ではない古い形式の非同期実行をサポートします。
しかし、WebSocketのサポートを追加するために、非同期Web Python (ASGI) の主な仕様はDjangoで開発されました。
そのような非同期性がNodeJSを人気にした理由です (NodeJSは並列ではありませんが)。そして、プログラミング言語としてのGoの強みでもあります。
そして、それは**FastAPI**で得られるパフォーマンスと同じレベルです。
また、並列処理と非同期処理を同時に実行できるため、テスト済みのほとんどのNodeJSフレームワークよりも高く、Goと同等のパフォーマンスが得られます。Goは、Cに近いコンパイル言語です <a href="https://www.techempower.com/benchmarks/#section=data-r17&hw=ph&test=query&l=zijmkf-1" class="external-link" target="_blank">(Starletteに感謝します)</a>。
### 並行は並列よりも優れていますか?
いや!それはこの話の教訓ではありません。
並行処理は並列処理とは異なります。多くの待機を伴う**特定の**シナリオに適しています。そのため、一般に、Webアプリケーション開発では並列処理よりもはるかに優れています。しかし、すべてに対してより良いというわけではありません。
なので、バランスをとるために、次の物語を想像して下さい:
> あなたは大きくて汚れた家を掃除する必要があります。
*はい、以上です*。
---
待機🕙せず、家の中の複数の場所でたくさんの仕事をするだけです。
あなたはハンバーガーの例のように、最初はリビングルーム、次にキッチンのように順番にやっていくことができますが、何かを待機🕙しているわけではなく、ただひたすらに掃除をするだけで、順番は何にも影響しません。
順番の有無に関係なく (並行に) 同じ時間がかかり、同じ量の作業が行われることになるでしょう。
しかし、この場合、8人の元レジ係/料理人/現役清掃員👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳👨‍🍳を手配できて、それぞれ (さらにあなたも) が家の別々の場所を掃除できれば、追加の助けを借りて、すべての作業を**並列**に行い、はるかに早く終了できるでしょう。
このシナリオでは、清掃員 (あなたを含む) のそれぞれがプロセッサとなり、それぞれの役割を果たします。
また、実行時間のほとんどは (待機ではなく) 実際の作業に費やされ、コンピュータでの作業は<abbr title="Central Processing Unit">CPU</abbr>によって行われます。これらの問題は「CPUバウンド」と言います。
---
CPUバウンド操作の一般的な例は、複雑な数学処理が必要なものです。
例えば:
* **オーディオ** や **画像処理**。
* **コンピュータビジョン**: 画像は数百万のピクセルで構成され、各ピクセルには3つの値/色があり、通常、これらのピクセルで何かを同時に計算する必要がある処理。
* **機械学習**: 通常、多くの「行列」と「ベクトル」の乗算が必要です。巨大なスプレッドシートに数字を入れて、それを同時に全部掛け合わせることを考えてみてください。
* **ディープラーニング**: これは機械学習のサブフィールドであるため、同じことが当てはまります。乗算する数字がある単一のスプレッドシートではなく、それらの膨大な集合で、多くの場合、それらのモデルを構築および/または使用するために特別なプロセッサを使用します。
### 並行処理 + 並列処理: Web + 機械学習
**FastAPI**を使用すると、Web開発で非常に一般的な並行処理 (NodeJSの主な魅力と同じもの) を利用できます。
ただし、機械学習システムのような **CPUバウンド** ワークロードに対して、並列処理とマルチプロセッシング (複数のプロセスが並列で実行される) の利点を活用することもできます。
さらに、Pythonが**データサイエンス**、機械学習、特にディープラーニングの主要言語であるという単純な事実により、FastAPIはデータサイエンス/機械学習のWeb APIおよびアプリケーション (他の多くのアプリケーションとの) に非常によく適合しています。
本番環境でこの並列処理を実現する方法については、[デプロイ](deployment/index.md){.internal-link target=_blank}に関するセクションを参照してください。
## `async` と `await`
現代的なバージョンのPythonには、非同期コードを定義する非常に直感的な方法があります。これにより、通常の「シーケンシャル」コードのように見え、適切なタイミングで「待機」します。
結果を返す前に待機する必要があり、これらの新しいPython機能をサポートする操作がある場合は、次のようにコーディングできます。
```Python
burgers = await get_burgers(2)
```
カギは `await` です。結果を `burgers`に保存する前に、`get_burgers(2)`の処理🕙の完了を待つ⏸必要があることをPythonに伝えます。これでPythonは、その間に (別のリクエストを受信するなど) 何か他のことができる🔀⏯ことを知ります。
`await` が機能するためには、非同期処理をサポートする関数内にある必要があります。これは、`async def` で関数を宣言するだけでよいです:
```Python hl_lines="1"
async def get_burgers(number: int):
# ハンバーガーを作成するために非同期処理を実行
return burgers
```
...`def` のかわりに:
```Python hl_lines="2"
# 非同期ではない
def get_sequential_burgers(number: int):
# ハンバーガーを作成するためにシーケンシャルな処理を実行
return burgers
```
`async def` を使用すると、Pythonにその関数内で `await` 式 (その関数の実行を「一時停止⏸」し、結果が戻るまで他の何かを実行🔀する) を認識しなければならないと伝えることができます。
`async def` 関数を呼び出すときは、「await」しなければなりません。したがって、これは機能しません:
```Python
# get_burgersはasync defで定義されているので動作しない
burgers = get_burgers(2)
```
---
したがって、 `await` で呼び出すことができるライブラリを使用している場合は、次のように `async def` を使用して、それを使用する*path operation 関数*を作成する必要があります:
```Python hl_lines="2-3"
@app.get('/burgers')
async def read_burgers():
burgers = await get_burgers(2)
return burgers
```
### より発展的な技術詳細
`await` は `async def` で定義された関数内でのみ使用できることがわかったかと思います。
しかし同時に、`async def` で定義された関数は「awaitされる」必要があります。なので、`async def` を持つ関数は、`async def` で定義された関数内でのみ呼び出せます。
では、このニワトリと卵の問題について、最初の `async` 関数をどのように呼び出すのでしょうか?
**FastAPI**を使用している場合、その「最初の」関数が*path operation 関数*であり、FastAPIが正しく実行する方法を知っているので、心配する必要はありません。
しかし、FastAPI以外で `async` / `await` を使用したい場合は、<a href="https://docs.python.org/3/library/asyncio-task.html#coroutine" class="external-link" target="_blank">公式Pythonドキュメントを参照して下さい</a>。
### 非同期コードの他の形式
`async` と `await` を使用するスタイルは、この言語では比較的新しいものです。
非同期コードの操作がはるかに簡単になります。
等価な (またはほとんど同一の) 構文が、最近のバージョンのJavaScript (ブラウザおよびNodeJS) にも最近組み込まれました。
しかし、その前は、非同期コードの処理はかなり複雑で難解でした。
以前のバージョンのPythonでは、スレッドや<a href="https://www.gevent.org/" class="external-link" target="_blank">Gevent</a>が利用できました。しかし、コードは理解、デバック、そして、考察がはるかに複雑です。
以前のバージョンのNodeJS / ブラウザJavaScriptでは、「コールバック」を使用していました。これは、<a href="http://callbackhell.com/" class="external-link" target="_blank">コールバック地獄</a>につながります。
## コルーチン
**コルーチン**は、`async def` 関数によって返されるものを指す非常に洒落た用語です。これは、開始できて、いつか終了する関数のようなものであるが、内部に `await` があるときは内部的に一時停止⏸されることもあるものだとPythonは認識しています。
`async` と `await` を用いた非同期コードを使用するすべての機能は、「コルーチン」を使用するものとして何度もまとめられています。Goの主要機能である「ゴルーチン」に相当します。
## まとめ
上述したフレーズを見てみましょう:
> 現代版のPythonは「**非同期コード**」を、「**コルーチン**」と称されるものを利用してサポートしています。これは **`async` と `await`** 構文を用います。
今では、この意味がより理解できるはずです。✨
(Starletteを介して) FastAPIに力を与えて、印象的なパフォーマンスを実現しているものはこれがすべてです。
## 非常に発展的な技術的詳細
!!! warning "注意"
恐らくスキップしても良いでしょう。
この部分は**FastAPI**の仕組みに関する非常に技術的な詳細です。
かなりの技術知識 (コルーチン、スレッド、ブロッキングなど) があり、FastAPIが `async def` と通常の `def` をどのように処理するか知りたい場合は、先に進んでください。
### Path operation 関数
*path operation 関数*を `async def` の代わりに通常の `def` で宣言すると、(サーバーをブロックするので) 直接呼び出す代わりに外部スレッドプール (awaitされる) で実行されます。
上記の方法と違った方法の別の非同期フレームワークから来ており、小さなパフォーマンス向上 (約100ナ秒) のために通常の `def` を使用して些細な演算のみ行う *path operation 関数* を定義するのに慣れている場合は、**FastAPI**ではまったく逆の効果になることに注意してください。このような場合、*path operation 関数* がブロッキング<abbr title="入力/出力: ディスクの読み取りまたは書き込み、ネットワーク通信。">I/O</abbr>を実行しないのであれば、`async def` の使用をお勧めします。
それでも、どちらの状況でも、**FastAPI**が過去のフレームワークよりも (またはそれに匹敵するほど) [高速になる](/#performance){.internal-link target=_blank}可能性があります。
### 依存関係
依存関係についても同様です。依存関係が `async def` ではなく標準の `def` 関数である場合、外部スレッドプールで実行されます。
### サブ依存関係
(関数定義のパラメーターとして) 相互に必要な複数の依存関係とサブ依存関係を設定できます。一部は `async def` で作成され、他の一部は通常の `def` で作成されます。それでも動作し、通常の `def`で作成されたものは、「awaitされる」代わりに (スレッドプールから) 外部スレッドで呼び出されます。
### その他のユーティリティ関数
あなたが直接呼び出すユーティリティ関数は通常の `def` または `async def` で作成でき、FastAPIは呼び出す方法に影響を与えません。
これは、FastAPIが呼び出す関数と対照的です: *path operation 関数*と依存関係。
ユーティリティ関数が `def` を使用した通常の関数である場合、スレッドプールではなく直接 (コードで記述したとおりに) 呼び出されます。関数が `async def` を使用して作成されている場合は、呼び出す際に `await` する必要があります。
---
繰り返しになりますが、これらは非常に技術的な詳細であり、検索して辿り着いた場合は役立つでしょう。
それ以外の場合は、上記のセクションのガイドラインで問題ないはずです: <a href="#in-a-hurry">急いでいますか?</a>。

View File

@@ -0,0 +1,240 @@
# Deta にデプロイ
このセクションでは、**FastAPI** アプリケーションを <a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> の無料プランを利用して、簡単にデプロイする方法を学習します。🎁
所要時間は約**10分**です。
!!! info "備考"
<a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Deta</a> は **FastAPI** のスポンサーです。🎉
## ベーシックな **FastAPI** アプリ
* アプリのためのディレクトリ (例えば `./fastapideta/`) を作成し、その中に入ってください。
### FastAPI のコード
* 以下の `main.py` ファイルを作成してください:
```Python
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):
return {"item_id": item_id}
```
### Requirements
では、同じディレクトリに以下の `requirements.txt` ファイルを作成してください:
```text
fastapi
```
!!! tip "豆知識"
アプリのローカルテストのために Uvicorn をインストールしたくなるかもしれませんが、Deta へのデプロイには不要です。
### ディレクトリ構造
以下の2つのファイルと1つの `./fastapideta/` ディレクトリがあるはずです:
```
.
└── main.py
└── requirements.txt
```
## Detaの無料アカウントの作成
それでは、<a href="https://www.deta.sh/?ref=fastapi" class="external-link" target="_blank">Detaの無料アカウント</a>を作成しましょう。必要なものはメールアドレスとパスワードだけです。
クレジットカードさえ必要ありません。
## CLIのインストール
アカウントを取得したら、Deta <abbr title="Command Line Interface application">CLI</abbr> をインストールしてください:
=== "Linux, macOS"
<div class="termy">
```console
$ curl -fsSL https://get.deta.dev/cli.sh | sh
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ iwr https://get.deta.dev/cli.ps1 -useb | iex
```
</div>
インストールしたら、インストールした CLI を有効にするために新たなターミナルを開いてください。
新たなターミナル上で、正しくインストールされたか確認します:
<div class="termy">
```console
$ deta --help
Deta command line interface for managing deta micros.
Complete documentation available at https://docs.deta.sh
Usage:
deta [flags]
deta [command]
Available Commands:
auth Change auth settings for a deta micro
...
```
</div>
!!! tip "豆知識"
CLI のインストールに問題が発生した場合は、<a href="https://docs.deta.sh/docs/micros/getting_started?ref=fastapi" class="external-link" target="_blank">Deta 公式ドキュメント</a>を参照してください。
## CLIでログイン
CLI から Deta にログインしてみましょう:
<div class="termy">
```console
$ deta login
Please, log in from the web page. Waiting..
Logged in successfully.
```
</div>
自動的にウェブブラウザが開いて、認証処理が行われます。
## Deta でデプロイ
次に、アプリケーションを Deta CLIでデプロイしましょう:
<div class="termy">
```console
$ deta new
Successfully created a new micro
// Notice the "endpoint" 🔍
{
"name": "fastapideta",
"runtime": "python3.7",
"endpoint": "https://qltnci.deta.dev",
"visor": "enabled",
"http_auth": "enabled"
}
Adding dependencies...
---> 100%
Successfully installed fastapi-0.61.1 pydantic-1.7.2 starlette-0.13.6
```
</div>
次のようなJSONメッセージが表示されます:
```JSON hl_lines="4"
{
"name": "fastapideta",
"runtime": "python3.7",
"endpoint": "https://qltnci.deta.dev",
"visor": "enabled",
"http_auth": "enabled"
}
```
!!! tip "豆知識"
あなたのデプロイでは異なる `"endpoint"` URLが表示されるでしょう。
## 確認
それでは、`endpoint` URLをブラウザで開いてみましょう。上記の例では `https://qltnci.deta.dev` ですが、あなたのURLは異なるはずです。
FastAPIアプリから返ってきたJSONレスポンスが表示されます:
```JSON
{
"Hello": "World"
}
```
そして `/docs` へ移動してください。上記の例では、`https://qltnci.deta.dev/docs` です。
次のようなドキュメントが表示されます:
<img src="/img/deployment/deta/image01.png">
## パブリックアクセスの有効化
デフォルトでは、Deta はクッキーを用いてアカウントの認証を行います。
しかし、準備が整えば、以下の様に公開できます:
<div class="termy">
```console
$ deta auth disable
Successfully disabled http auth
```
</div>
ここで、URLを共有するとAPIにアクセスできるようになります。🚀
## HTTPS
おめでとうございます!あなたの FastAPI アプリが Deta へデプロイされました!🎉 🍰
また、DetaがHTTPSを正しく処理するため、その処理を行う必要がなく、クライアントは暗号化された安全な通信が利用できます。✅ 🔒
## Visor を確認
ドキュメントUI (`https://qltnci.deta.dev/docs` のようなURLにある) は *path operation* `/items/{item_id}` へリクエストを送ることができます。
ID `5` の例を示します。
まず、<a href="https://web.deta.sh/" class="external-link" target="_blank">https://web.deta.sh</a> へアクセスします。
左側に各アプリの <abbr title="it comes from Micro(server)">「Micros」</abbr> というセクションが表示されます。
また、「Details」や「Visor」タブが表示されています。「Visor」タブへ移動してください。
そこでアプリに送られた直近のリクエストが調べられます。
また、それらを編集してリプレイできます。
<img src="/img/deployment/deta/image02.png">
## さらに詳しく知る
様々な箇所で永続的にデータを保存したくなるでしょう。そのためには <a href="https://docs.deta.sh/docs/base/py_tutorial?ref=fastapi" class="external-link" target="_blank">Deta Base</a> を使用できます。惜しみない **無料利用枠** もあります。
詳しくは <a href="https://docs.deta.sh?ref=fastapi" class="external-link" target="_blank">Deta ドキュメント</a>を参照してください。

View File

@@ -0,0 +1,179 @@
# Dockerを使用したデプロイ
このセクションでは以下の使い方の紹介とガイドへのリンクが確認できます:
* **5分**程度で、**FastAPI** のアプリケーションを、パフォーマンスを最大限に発揮するDockerイメージ (コンテナ)にする。
* (オプション) 開発者として必要な範囲でHTTPSを理解する。
* **20分**程度で、自動的なHTTPS生成とともにDockerのSwarmモード クラスタをセットアップする (月5ドルのシンプルなサーバー上で)。
* **10分**程度で、DockerのSwarmモード クラスタを使って、HTTPSなどを使用した完全な**FastAPI** アプリケーションの作成とデプロイ。
デプロイのために、<a href="https://www.docker.com/" class="external-link" target="_blank">**Docker**</a> を利用できます。セキュリティ、再現性、開発のシンプルさなどに利点があります。
Dockerを使う場合、公式のDockerイメージが利用できます:
## <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>
このイメージは「自動チューニング」機構を含んでいます。犠牲を払うことなく、ただコードを加えるだけで自動的に高パフォーマンスを実現できます。
ただし、環境変数や設定ファイルを使って全ての設定の変更や更新を行えます。
!!! tip "豆知識"
全ての設定とオプションを確認するには、Dockerイメージページを開いて下さい: <a href="https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker" class="external-link" target="_blank">tiangolo/uvicorn-gunicorn-fastapi</a>.
## `Dockerfile` の作成
* プロジェクトディレクトリへ移動。
* 以下の`Dockerfile` を作成:
```Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
COPY ./app /app
```
### より大きなアプリケーション
[Bigger Applications with Multiple Files](tutorial/bigger-applications.md){.internal-link target=_blank} セクションに倣う場合は、`Dockerfile` は上記の代わりに、以下の様になるかもしれません:
```Dockerfile
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
COPY ./app /app/app
```
### Raspberry Piなどのアーキテクチャ
Raspberry Pi (ARMプロセッサ搭載)やそれ以外のアーキテクチャでDockerが作動している場合、(マルチアーキテクチャである) Pythonベースイメージを使って、一から`Dockerfile`を作成し、Uvicornを単体で使用できます。
この場合、`Dockerfile` は以下の様になるかもしれません:
```Dockerfile
FROM python:3.7
RUN pip install fastapi uvicorn
EXPOSE 80
COPY ./app /app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
```
## **FastAPI** コードの作成
* `app` ディレクトリを作成し、移動。
* 以下の`main.py` ファイルを作成:
```Python
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
* ここでは、以下の様なディレクトリ構造になっているはずです:
```
.
├── app
│ └── main.py
└── Dockerfile
```
## Dockerイメージをビルド
* プロジェクトディレクトリ (`app` ディレクトリを含んだ、`Dockerfile` のある場所) へ移動
* FastAPIイメージのビルド:
<div class="termy">
```console
$ docker build -t myimage .
---> 100%
```
</div>
## Dockerコンテナを起動
* 用意したイメージを基にしたコンテナの起動:
<div class="termy">
```console
$ docker run -d --name mycontainer -p 80:80 myimage
```
</div>
これで、Dockerコンテナ内に最適化されたFastAPIサーバが動作しています。使用しているサーバ (そしてCPUコア数) に沿った自動チューニングが行われています。
## 確認
DockerコンテナのURLで確認できるはずです。例えば: <a href="http://192.168.99.100/items/5?q=somequery" class="external-link" target="_blank">http://192.168.99.100/items/5?q=somequery</a> や <a href="http://127.0.0.1/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1/items/5?q=somequery</a> (もしくはDockerホストを使用したこれらと同等のもの)。
以下の様なものが返されます:
```JSON
{"item_id": 5, "q": "somequery"}
```
## 対話的APIドキュメント
ここで、<a href="http://192.168.99.100/docs" class="external-link" target="_blank">http://192.168.99.100/docs</a> や <a href="http://127.0.0.1/docs" class="external-link" target="_blank">http://127.0.0.1/docs</a> (もしくはDockerホストを使用したこれらと同等のもの) を開いて下さい。
自動生成された対話的APIドキュメントが確認できます (<a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>によって提供されます):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
## その他のAPIドキュメント
また同様に、<a href="http://192.168.99.100/redoc" class="external-link" target="_blank">http://192.168.99.100/redoc</a> や <a href="http://127.0.0.1/redoc" class="external-link" target="_blank">http://127.0.0.1/redoc</a> (もしくはDockerホストを使用したこれらと同等のもの) を開いて下さい。
他の自動生成された対話的なAPIドキュメントが確認できます (<a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>によって提供されます):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Traefik
<a href="https://traefik.io/" class="external-link" target="_blank">Traefik</a>は、高性能なリバースプロキシ/ロードバランサーです。「TLSターミネーションプロキシ」ジョブを実行できます他の機能と切り離して
Let's Encryptと統合されています。そのため、証明書の取得と更新を含むHTTPSに関するすべての処理を実行できます。
また、Dockerとも統合されています。したがって、各アプリケーション構成でドメインを宣言し、それらの構成を読み取って、HTTPS証明書を生成し、構成に変更を加えることなく、アプリケーションにHTTPSを自動的に提供できます。
---
次のセクションに進み、この情報とツールを使用して、すべてを組み合わせます。
## TraefikとHTTPSを使用したDocker Swarmモードのクラスタ
HTTPSを処理する証明書の取得と更新を含むTraefikを使用して、Docker Swarmモードのクラスタを数分20分程度でセットアップできます。
Docker Swarmモードを使用することで、1台のマシンの「クラスタ」から開始でき1か月あたり5ドルのサーバーでもできます、後から必要なだけサーバーを拡張できます。
TraefikおよびHTTPS処理を備えたDocker Swarm Modeクラスターをセットアップするには、次のガイドに従います:
### <a href="https://medium.com/@tiangolo/docker-swarm-mode-and-traefik-for-a-https-cluster-20328dba6232" class="external-link" target="_blank">Docker Swarm Mode and Traefik for an HTTPS cluster</a>
### FastAPIアプリケーションのデプロイ
すべてを設定するための最も簡単な方法は、[**FastAPI** Project Generators](project-generation.md){.internal-link target=_blank}を使用することでしょう。
上述したTraefikとHTTPSを備えたDocker Swarm クラスタが統合されるように設計されています。
2分程度でプロジェクトが生成されます。
生成されたプロジェクトはデプロイの指示がありますが、それを実行するとさらに2分かかります。

View File

@@ -0,0 +1,7 @@
# デプロイ - イントロ
**FastAPI** 製のアプリケーションは比較的容易にデプロイできます。
ユースケースや使用しているツールによっていくつかの方法に分かれます。
次のセクションでより詳しくそれらの方法について説明します。

View File

@@ -0,0 +1,74 @@
# 手動デプロイ
**FastAPI** を手動でデプロイすることもできます。
以下の様なASGI対応のサーバをインストールする必要があります:
=== "Uvicorn"
* <a href="https://www.uvicorn.org/" class="external-link" target="_blank">Uvicorn</a>, uvloopとhttptoolsを基にした高速なASGIサーバ。
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
!!! tip "豆知識"
`standard` を加えることで、Uvicornがインストールされ、いくつかの推奨される依存関係を利用するようになります。
これには、`asyncio` の高性能な完全互換品である `uvloop` が含まれ、並行処理のパフォーマンスが大幅に向上します。
=== "Hypercorn"
* <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>, HTTP/2にも対応しているASGIサーバ。
<div class="termy">
```console
$ pip install hypercorn
---> 100%
```
</div>
...または、これら以外のASGIサーバ。
そして、チュートリアルと同様な方法でアプリケーションを起動して下さい。ただし、以下の様に`--reload` オプションは使用しないで下さい:
=== "Uvicorn"
<div class="termy">
```console
$ uvicorn main:app --host 0.0.0.0 --port 80
<span style="color: green;">INFO</span>: Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
```
</div>
=== "Hypercorn"
<div class="termy">
```console
$ hypercorn main:app --bind 0.0.0.0:80
Running on 0.0.0.0:8080 over http (CTRL + C to quit)
```
</div>
停止した場合に自動的に再起動させるツールを設定したいかもしれません。
さらに、<a href="https://gunicorn.org/" class="external-link" target="_blank">Gunicorn</a>をインストールして<a href="https://www.uvicorn.org/#running-with-gunicorn" class="external-link" target="_blank">Uvicornのマネージャーとして使用したり</a>、複数のワーカーでHypercornを使用したいかもしれません。
ワーカー数などの微調整も行いたいかもしれません。
しかしこれら全てをやろうとすると、自動的にこれらを行うDockerイメージを使う方が楽かもしれません。

View File

@@ -0,0 +1,87 @@
# FastAPIのバージョンについて
**FastAPI** は既に多くのアプリケーションやシステムに本番環境で使われています。また、100%のテストカバレッジを維持しています。しかし、活発な開発が続いています。
高頻度で新機能が追加され、定期的にバグが修正され、実装は継続的に改善されています。
これが現在のバージョンがいまだに `0.x.x` な理由であり、それぞれのバージョンは破壊的な変更がなされる可能性があります。これは、<a href="https://semver.org/" class="external-link" target="_blank">セマンティック バージョニング</a>の規則に則っています。
**FastAPI** を使用すると本番用アプリケーションをすぐに作成できますが (すでに何度も経験しているかもしれませんが)、残りのコードが正しく動作するバージョンなのか確認しなければいけません。
## `fastapi` のバージョンを固定
最初にすべきことは、アプリケーションが正しく動作する **FastAPI** のバージョンを固定することです。
例えば、バージョン `0.45.0` を使っているとしましょう。
`requirements.txt` を使っているなら、以下の様にバージョンを指定できます:
```txt
fastapi==0.45.0
```
これは、厳密にバージョン `0.45.0` だけを使うことを意味します。
または、以下の様に固定することもできます:
```txt
fastapi>=0.45.0,<0.46.0
```
これは `0.45.0` 以上、`0.46.0` 未満のバージョンを使うことを意味します。例えば、バージョン `0.45.2` は使用可能です。
PoetryやPipenvなど、他のインストール管理ツールを使用している場合でも、それぞれパッケージのバージョンを指定する機能があります。
## 利用可能なバージョン
[Release Notes](../release-notes.md){.internal-link target=_blank}で利用可能なバージョンが確認できます (現在の最新版の確認などのため)。
## バージョンについて
セマンティック バージョニングの規約に従って、`1.0.0` 未満の全てのバージョンは破壊的な変更が加わる可能性があります。
FastAPIでは「パッチ」バージョンはバグ修正と非破壊的な変更に留めるという規約に従っています。
!!! tip "豆知識"
「パッチ」は最後の数字を指します。例えば、`0.2.3` ではパッチバージョンは `3` です。
従って、以下の様なバージョンの固定が望ましいです:
```txt
fastapi>=0.45.0,<0.46.0
```
破壊的な変更と新機能実装は「マイナー」バージョンで加えられます。
!!! tip "豆知識"
「マイナー」は真ん中の数字です。例えば、`0.2.3` ではマイナーバージョンは `2` です。
## FastAPIのバージョンのアップグレード
アプリケーションにテストを加えるべきです。
**FastAPI** では非常に簡単に実現できます (Starletteのおかげで)。ドキュメントを確認して下さい: [テスト](../tutorial/testing.md){.internal-link target=_blank}
テストを加えた後で、**FastAPI** のバージョンをより最新のものにアップグレードし、テストを実行することで全てのコードが正常に動作するか確認できます。
全てが動作するか、修正を行った上で全てのテストを通過した場合、使用している`fastapi` のバージョンをより最新のバージョンに固定できます。
## Starletteについて
`Starlette` のバージョンは固定すべきではありません。
**FastAPI** は、バージョン毎にStarletteのより新しいバージョンを使用します。
よって、最適なStarletteのバージョン選択を**FastAPI** に任せることができます。
## Pydanticについて
Pydanticは自身のテストだけでなく**FastAPI** のためのテストを含んでいます。なので、Pydanticの新たなバージョン ( `1.0.0` 以降) は全てFastAPIと整合性があります。
Pydanticのバージョンを、動作が保証できる`1.0.0`以降のいずれかのバージョンから`2.0.0` 未満の間に固定できます。
例えば:
```txt
pydantic>=1.2.0,<2.0.0
```

View File

@@ -0,0 +1,82 @@
# 外部リンク・記事
**FastAPI**には、絶えず成長している素晴らしいコミュニティがあります。
**FastAPI**に関連する投稿、記事、ツール、およびプロジェクトは多数あります。
それらの不完全なリストを以下に示します。
!!! tip "豆知識"
ここにまだ載っていない**FastAPI**に関連する記事、プロジェクト、ツールなどがある場合は、 <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">プルリクエストして下さい</a>。
## 記事
### 英語
{% if external_links %}
{% for article in external_links.articles.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### 日本語
{% if external_links %}
{% for article in external_links.articles.japanese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### ベトナム語
{% if external_links %}
{% for article in external_links.articles.vietnamese %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### ロシア語
{% if external_links %}
{% for article in external_links.articles.russian %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
### ドイツ語
{% if external_links %}
{% for article in external_links.articles.german %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## ポッドキャスト
{% if external_links %}
{% for article in external_links.podcasts.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## トーク
{% if external_links %}
{% for article in external_links.talks.english %}
* <a href="{{ article.link }}" class="external-link" target="_blank">{{ article.title }}</a> by <a href="{{ article.author_link }}" class="external-link" target="_blank">{{ article.author }}</a>.
{% endfor %}
{% endif %}
## プロジェクト
`fastapi`トピックの最新のGitHubプロジェクト:
<div class="github-topic-projects">
</div>

View File

@@ -0,0 +1,178 @@
# FastAPI People
FastAPIには、様々なバックグラウンドの人々を歓迎する素晴らしいコミュニティがあります。
## Creator - Maintainer
こんにちは! 👋
これが私です:
{% if people %}
<div class="user-list user-list-center">
{% for user in people.maintainers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Answers: {{ user.answers }}</div><div class="count">Pull Requests: {{ user.prs }}</div></div>
{% endfor %}
</div>
{% endif %}
私は **FastAPI** の作成者および Maintainer です。詳しくは [FastAPIを応援 - ヘルプの入手 - 開発者とつながる](help-fastapi.md#開発者とつながる){.internal-link target=_blank} に記載しています。
...ところで、ここではコミュニティを紹介したいと思います。
---
**FastAPI** は、コミュニティから多くのサポートを受けています。そこで、彼らの貢献にスポットライトを当てたいと思います。
紹介するのは次のような人々です:
* [GitHub issuesで他の人を助ける](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank}。
* [プルリクエストをする](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}。
* プルリクエストのレビューをする ([特に翻訳に重要](contributing.md#translations){.internal-link target=_blank})。
彼らに大きな拍手を。👏 🙇
## 先月最もアクティブだったユーザー
彼らは、先月の[GitHub issuesで最も多くの人を助けた](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank}ユーザーです。☕
{% if people %}
<div class="user-list user-list-center">
{% for user in people.last_month_active %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Experts
**FastAPI experts** を紹介します。🤓
彼らは、*これまでに* [GitHub issuesで最も多くの人を助けた](help-fastapi.md#help-others-with-issues-in-github){.internal-link target=_blank}ユーザーです。
多くの人を助けることでexpertsであると示されています。✨
{% if people %}
<div class="user-list user-list-center">
{% for user in people.experts %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Issues replied: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Top Contributors
**Top Contributors** を紹介します。👷
彼らは、*マージされた* [最も多くのプルリクエストを作成した](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}ユーザーです。
ソースコード、ドキュメント、翻訳などに貢献してくれました。📦
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_contributors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Pull Requests: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
他にもたくさん (100人以上) の contributors がいます。<a href="https://github.com/tiangolo/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors ページ</a>ですべての contributors を確認できます。👷
## Top Reviewers
以下のユーザーは **Top Reviewers** です。🕵️
### 翻訳のレビュー
私は少しの言語しか話せません (もしくはあまり上手ではありません😅)。したがって、reviewers は、ドキュメントの[**翻訳を承認する権限**](contributing.md#translations){.internal-link target=_blank}を持っています。それらがなければ、いくつかの言語のドキュメントはなかったでしょう。
---
**Top Reviewers** 🕵️は、他の人からのプルリクエストのほとんどをレビューし、コード、ドキュメント、特に**翻訳**の品質を保証しています。
{% if people %}
<div class="user-list user-list-center">
{% for user in people.top_reviewers %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a> <div class="count">Reviews: {{ user.count }}</div></div>
{% endfor %}
</div>
{% endif %}
## Sponsors
**Sponsors** を紹介します。😎
彼らは、<a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsors</a> を介して私の **FastAPI** などに関する活動を支援してくれています。
### Gold 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 %}
{% endif %}
### Silver Sponsors
{% if sponsors %}
{% 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 %}
### Bronze Sponsors
{% if sponsors %}
{% for sponsor in sponsors.bronze -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}" style="border-radius:15px"></a>
{% endfor %}
{% endif %}
### Individual Sponsors
{% if people %}
{% if people.sponsors_50 %}
<div class="user-list user-list-center">
{% for user in people.sponsors_50 %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% if people %}
<div class="user-list user-list-center">
{% for user in people.sponsors %}
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
{% endfor %}
</div>
{% endif %}
## データについて - 技術詳細
このページの目的は、他の人を助けるためのコミュニティの努力にスポットライトを当てるためです。
特に、他の人の issues を支援したり、翻訳のプルリクエストを確認したりするなど、通常は目立たず、多くの場合、より困難な作業を含みます。
データは毎月集計されます。<a href="https://github.com/tiangolo/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">ソースコードはこちら</a>で確認できます。
ここでは、スポンサーの貢献も強調しています。
アルゴリズム、セクション、閾値などは更新されるかもしれません (念のために 🤷)。

View File

@@ -40,13 +40,16 @@ FastAPI は、Pythonの標準である型ヒントに基づいてPython 3.6 以
<small>\* 本番アプリケーションを構築している開発チームのテストによる見積もり。</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -0,0 +1,99 @@
# ボディ - 更新
## `PUT`による置換での更新
項目を更新するには<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT" class="external-link" target="_blank">HTTPの`PUT`</a>操作を使用することができます。
`jsonable_encoder`を用いて、入力データをJSON形式で保存できるデータに変換することができますNoSQLデータベース。例えば、`datetime``str`に変換します。
```Python hl_lines="30 31 32 33 34 35"
{!../../../docs_src/body_updates/tutorial001.py!}
```
既存のデータを置き換えるべきデータを受け取るために`PUT`は使用されます。
### 置換についての注意
つまり、`PUT`を使用して以下のボディで項目`bar`を更新したい場合は:
```Python
{
"name": "Barz",
"price": 3,
"description": None,
}
```
すでに格納されている属性`"tax": 20.2`を含まないため、入力モデルのデフォルト値は`"tax": 10.5`です。
そして、データはその「新しい」`10.5`の`tax`と共に保存されます。
## `PATCH`による部分的な更新
また、<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH" class="external-link" target="_blank">HTTPの`PATCH`</a>操作でデータを*部分的に*更新することもできます。
つまり、更新したいデータだけを送信して、残りはそのままにしておくことができます。
!!! Note "備考"
`PATCH`は`PUT`よりもあまり使われておらず、知られていません。
また、多くのチームは部分的な更新であっても`PUT`だけを使用しています。
**FastAPI** はどんな制限も課けていないので、それらを使うのは **自由** です。
しかし、このガイドでは、それらがどのように使用されることを意図しているかを多かれ少なかれ、示しています。
### Pydanticの`exclude_unset`パラメータの使用
部分的な更新を受け取りたい場合は、Pydanticモデルの`.dict()`の`exclude_unset`パラメータを使用すると非常に便利です。
`item.dict(exclude_unset=True)`のように。
これにより、`item`モデルの作成時に設定されたデータのみを持つ`dict`が生成され、デフォルト値は除外されます。
これを使うことで、デフォルト値を省略して、設定された(リクエストで送られた)データのみを含む`dict`を生成することができます:
```Python hl_lines="34"
{!../../../docs_src/body_updates/tutorial002.py!}
```
### Pydanticの`update`パラメータ
ここで、`.copy()`を用いて既存のモデルのコピーを作成し、`update`パラメータに更新するデータを含む`dict`を渡すことができます。
`stored_item_model.copy(update=update_data)`のように:
```Python hl_lines="35"
{!../../../docs_src/body_updates/tutorial002.py!}
```
### 部分的更新のまとめ
まとめると、部分的な更新を適用するには、次のようにします:
* (オプションで)`PUT`の代わりに`PATCH`を使用します。
* 保存されているデータを取得します。
* そのデータをPydanticモデルにいれます。
* 入力モデルからデフォルト値を含まない`dict`を生成します(`exclude_unset`を使用します)。
* この方法では、モデル内のデフォルト値ですでに保存されている値を上書きするのではなく、ユーザーが実際に設定した値のみを更新することができます。
* 保存されているモデルのコピーを作成し、受け取った部分的な更新で属性を更新します(`update`パラメータを使用します)。
* コピーしたモデルをDBに保存できるものに変換します例えば、`jsonable_encoder`を使用します)。
* これはモデルの`.dict()`メソッドを再度利用することに匹敵しますが、値をJSONに変換できるデータ型、例えば`datetime`を`str`に変換します。
* データをDBに保存します。
* 更新されたモデルを返します。
```Python hl_lines="30 31 32 33 34 35 36 37"
{!../../../docs_src/body_updates/tutorial002.py!}
```
!!! tip "豆知識"
実際には、HTTPの`PUT`操作でも同じテクニックを使用することができます。
しかし、これらのユースケースのために作成されたので、ここでの例では`PATCH`を使用しています。
!!! note "備考"
入力モデルがまだ検証されていることに注目してください。
そのため、すべての属性を省略できる部分的な変更を受け取りたい場合は、すべての属性をオプションとしてマークしたモデルを用意する必要があります(デフォルト値または`None`を使用して)。
**更新** のためのオプション値がすべて設定されているモデルと、**作成** のための必須値が設定されているモデルを区別するには、[追加モデル](extra-models.md){.internal-link target=_blank}で説明されている考え方を利用することができます。

View File

@@ -0,0 +1,33 @@
# クッキーのパラメータ
クッキーのパラメータは、`Query``Path`のパラメータを定義するのと同じ方法で定義できます。
## `Cookie`をインポート
まず、`Cookie`をインポートします:
```Python hl_lines="3"
{!../../../docs_src/cookie_params/tutorial001.py!}
```
## `Cookie`のパラメータを宣言
次に、`Path`や`Query`と同じ構造を使ってクッキーのパラメータを宣言します。
最初の値がデフォルト値で、追加の検証パラメータや注釈パラメータをすべて渡すことができます:
```Python hl_lines="9"
{!../../../docs_src/cookie_params/tutorial001.py!}
```
!!! note "技術詳細"
`Cookie`は`Path`と`Query`の「姉妹」クラスです。また、同じ共通の`Param`クラスを継承しています。
しかし、`fastapi`から`Query`や`Path`、`Cookie`などをインポートする場合、それらは実際には特殊なクラスを返す関数であることを覚えておいてください。
!!! info "情報"
クッキーを宣言するには、`Cookie`を使う必要があります。なぜなら、そうしないとパラメータがクエリのパラメータとして解釈されてしまうからです。
## まとめ
クッキーは`Cookie`を使って宣言し、`Query`や`Path`と同じパターンを使用する。

View File

@@ -0,0 +1,112 @@
# デバッグ
Visual Studio CodeやPyCharmなどを使用して、エディター上でデバッガーと連携できます。
## `uvicorn` の実行
FastAPIアプリケーション上で、`uvicorn` を直接インポートして実行します:
```Python hl_lines="1 15"
{!../../../docs_src/debugging/tutorial001.py!}
```
### `__name__ == "__main__"` について
`__name__ == "__main__"` の主な目的は、ファイルが次のコマンドで呼び出されたときに実行されるコードを用意することです:
<div class="termy">
```console
$ python myapp.py
```
</div>
ただし、次のように、別のファイルからインポートされるときには呼び出されません:
```Python
from myapp import app
```
#### より詳しい説明
ファイルの名前が `myapp.py` だとします。
以下の様に実行する場合:
<div class="termy">
```console
$ python myapp.py
```
</div>
Pythonによって自動的に作成されたファイル内の内部変数 `__name__` は、値として文字列 `"__main__"` を持ちます。
なので、以下:
```Python
uvicorn.run(app, host="0.0.0.0", port=8000)
```
は実行されます。
---
そのモジュール (ファイル) をインポートした場合は、こうはなりません。
したがって、次のようなもう一つのファイル `importer.py` がある場合:
```Python
from myapp import app
# Some more code
```
`myapp.py` 内の自動変数には、値が `"__main __"` の変数 `__name__` はありません。
したがって、以下の行:
```Python
uvicorn.run(app, host="0.0.0.0", port=8000)
```
は実行されません。
!!! info "情報"
より詳しい情報は、<a href="https://docs.python.org/3/library/__main__.html" class="external-link" target="_blank">公式Pythonドキュメント</a>を参照してください。
## デバッガーでコードを実行
コードから直接Uvicornサーバーを実行しているため、デバッガーから直接Pythonプログラム (FastAPIアプリケーション) を呼び出せます。
---
例えば、Visual Studio Codeでは、次のことが可能です:
* 「デバッグ」パネルに移動。
* 「構成の追加...」
* 「Python」を選択。
* オプション「`Python: Current File (Integrated Terminal)`」を指定してデバッガーを実行。
すると、**FastAPI** コードでサーバーが起動され、ブレークポイントで停止したりするでしょう。
以下の様な画面になります:
<img src="/img/tutorial/debugging/image01.png">
---
Pycharmを使用する場合、次のことが可能です:
* 「実行」メニューをオープン。
* オプション「デバッグ...」を選択。
* 次にコンテキストメニューが表示される。
* デバッグするファイル (ここでは `main.py`) を選択。
すると、**FastAPI** コードでサーバーが起動され、ブレークポイントで停止したりするでしょう。
以下の様な画面になります:
<img src="/img/tutorial/debugging/image02.png">

View File

@@ -0,0 +1,61 @@
# ミドルウェア
**FastAPI** アプリケーションにミドルウェアを追加できます。
「ミドルウェア」は、すべての**リクエスト**に対して、それがあらゆる特定の*path operation*によって処理される前に機能する関数です。また、すべての**レスポンス**に対して、それを返す前に機能します。
* ミドルウェアはアプリケーションに届いたそれぞれの**リクエスト**を受け取ります。
* その後、その**リクエスト**に対して何かを実行したり、必要なコードを実行したりできます。
* 次に、アプリケーションの残りの部分に**リクエスト**を渡して (*path operation* によって) 処理させます。
* 次に、ミドルウェアはアプリケーション (の *path operation*) によって生成された**レスポンス**を受け取ります。
* その**レスポンス**に対して何かを実行したり、必要なコードを実行したりできます。
* そして、**レスポンス**を返します。
!!! note "技術詳細"
`yield` を使った依存関係をもつ場合は、終了コードはミドルウェアの *後に* 実行されます。
バックグラウンドタスク (後述) がある場合は、それらは全てのミドルウェアの *後に* 実行されます。
## ミドルウェアの作成
ミドルウェアを作成するには、関数の上部でデコレータ `@app.middleware("http")` を使用します。
ミドルウェア関数は以下を受け取ります:
* `request`
* パラメータとして `request` を受け取る関数 `call_next`
* この関数は、対応する*path operation*に `request` を渡します。
* 次に、対応する*path operation*によって生成された `response` を返します。
* その後、`response` を返す前にさらに `response` を変更することもできます。
```Python hl_lines="8-9 11 14"
{!../../../docs_src/middleware/tutorial001.py!}
```
!!! tip "豆知識"
<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">'X-'プレフィックスを使用</a>してカスタムの独自ヘッダーを追加できます。
ただし、ブラウザのクライアントに表示させたいカスタムヘッダーがある場合は、<a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">StarletteのCORSドキュメント</a>に記載されているパラメータ `expose_headers` を使用して、それらをCORS設定に追加する必要があります ([CORS (オリジン間リソース共有)](cors.md){.internal-link target=_blank})
!!! note "技術詳細"
`from starlette.requests import Request` を使用することもできます。
**FastAPI**は、開発者の便利のためにこれを提供していますが、Starletteから直接きています。
### `response` の前後
*path operation* が `request` を受け取る前に、 `request` とともに実行されるコードを追加できます。
また `response` が生成された後、それを返す前にも追加できます。
例えば、リクエストの処理とレスポンスの生成にかかった秒数を含むカスタムヘッダー `X-Process-Time` を追加できます:
```Python hl_lines="10 12-13"
{!../../../docs_src/middleware/tutorial001.py!}
```
## その他のミドルウェア
他のミドルウェアの詳細については、[高度なユーザーガイド: 高度なミドルウェア](../advanced/middleware.md){.internal-link target=_blank}を参照してください。
次のセクションでは、ミドルウェアを使用して <abbr title="Cross-Origin Resource Sharing">CORS</abbr> を処理する方法について説明します。

View File

@@ -0,0 +1,58 @@
# フォームデータ
JSONの代わりにフィールドを受け取る場合は、`Form`を使用します。
!!! info "情報"
フォームを使うためには、まず<a href="https://andrew-d.github.io/python-multipart/" class="external-link" target="_blank">`python-multipart`</a>をインストールします。
たとえば、`pip install python-multipart`のように。
## `Form`のインポート
`fastapi`から`Form`をインポートします:
```Python hl_lines="1"
{!../../../docs_src/request_forms/tutorial001.py!}
```
## `Form`のパラメータの定義
`Body`や`Query`の場合と同じようにフォームパラメータを作成します:
```Python hl_lines="7"
{!../../../docs_src/request_forms/tutorial001.py!}
```
例えば、OAuth2仕様が使用できる方法の「パスワードフロー」と呼ばれるでは、フォームフィールドとして`username`と`password`を送信する必要があります。
<abbr title="仕様">仕様</abbr>では、フィールドの名前が`username`と`password`であることと、JSONではなくフォームフィールドとして送信されることを要求しています。
`Form`では`Body`(および`Query`や`Path`、`Cookie`)と同じメタデータとバリデーションを宣言することができます。
!!! info "情報"
`Form`は`Body`を直接継承するクラスです。
!!! tip "豆知識"
フォームのボディを宣言するには、明示的に`Form`を使用する必要があります。なぜなら、これを使わないと、パラメータはクエリパラメータやボディJSONパラメータとして解釈されるからです。
## 「フォームフィールド」について
HTMLフォーム`<form></form>`がサーバにデータを送信する方法は、通常、そのデータに「特別な」エンコーディングを使用していますが、これはJSONとは異なります。
**FastAPI** は、JSONの代わりにそのデータを適切な場所から読み込むようにします。
!!! note "技術詳細"
フォームからのデータは通常、`application/x-www-form-urlencoded`の「media type」を使用してエンコードされます。
しかし、フォームがファイルを含む場合は、`multipart/form-data`としてエンコードされます。ファイルの扱いについては次の章で説明します。
これらのエンコーディングやフォームフィールドの詳細については、<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST" class="external-link" target="_blank"><abbr title="Mozilla Developer Network">MDN</abbr>の<code>POST</code></a>のウェブドキュメントを参照してください。
!!! warning "注意"
*path operation*で複数の`Form`パラメータを宣言することができますが、JSONとして受け取ることを期待している`Body`フィールドを宣言することはできません。なぜなら、リクエストは`application/json`の代わりに`application/x-www-form-urlencoded`を使ってボディをエンコードするからです。
これは **FastAPI**の制限ではなく、HTTPプロトコルの一部です。
## まとめ
フォームデータの入力パラメータを宣言するには、`Form`を使用する。

View File

@@ -0,0 +1,53 @@
# 静的ファイル
`StaticFiles` を使用して、ディレクトリから静的ファイルを自動的に提供できます。
## `aiofiles` をインストール
まず、`aiofiles` をインストールする必要があります:
<div class="termy">
```console
$ pip install aiofiles
---> 100%
```
</div>
## `StaticFiles` の使用
* `StaticFiles` をインポート。
* `StaticFiles()` インスタンスを生成し、特定のパスに「マウント」。
```Python hl_lines="2 6"
{!../../../docs_src/static_files/tutorial001.py!}
```
!!! note "技術詳細"
`from starlette.staticfiles import StaticFiles` も使用できます。
**FastAPI**は、開発者の利便性のために、`starlette.staticfiles` と同じ `fastapi.staticfiles` を提供します。しかし、実際にはStarletteから直接渡されています。
### 「マウント」とは
「マウント」とは、特定のパスに完全な「独立した」アプリケーションを追加することを意味します。これにより、すべてのサブパスの処理がなされます。
これは、マウントされたアプリケーションが完全に独立しているため、`APIRouter` とは異なります。メインアプリケーションのOpenAPIとドキュメントには、マウントされたアプリケーションの内容などは含まれません。
これについて詳しくは、**高度なユーザーガイド** をご覧ください。
## 詳細
最初の `"/static"` は、この「サブアプリケーション」が「マウント」されるサブパスを指します。したがって、`"/static"` から始まるパスはすべてサブアプリケーションによって処理されます。
`directory="static"` は、静的ファイルを含むディレクトリの名前を指します。
`name="static"` は、**FastAPI** が内部で使用できる名前を付けます。
これらのパラメータはすべて「`静的`」とは異なる場合があり、独自のアプリケーションのニーズと詳細に合わせて調整します。
## より詳しい情報
詳細とオプションについては、<a href="https://www.starlette.io/staticfiles/" class="external-link" target="_blank">Starletteの静的ファイルに関するドキュメント</a>を確認してください。

View File

@@ -0,0 +1,144 @@
# テスト
<a href="https://www.starlette.io/testclient/" class="external-link" target="_blank">Starlette</a> のおかげで、**FastAPI** アプリケーションのテストは簡単で楽しいものになっています。
<a href="http://docs.python-requests.org" class="external-link" target="_blank">Requests</a> がベースなので、非常に使いやすく直感的です。
これを使用すると、**FastAPI** と共に <a href="https://docs.pytest.org/" class="external-link" target="_blank">pytest</a> を直接利用できます。
## `TestClient` を使用
`TestClient` をインポートします。
`TestClient` を作成し、**FastAPI** に渡します。
`test_` から始まる名前の関数を作成します (これは `pytest` の標準的なコンベンションです)。
`requests` と同じ様に `TestClient` オブジェクトを使用します。
チェックしたい Python の標準的な式と共に、シンプルに `assert` 文を記述します。
```Python hl_lines="2 12 15-18"
{!../../../docs_src/app_testing/tutorial001.py!}
```
!!! tip "豆知識"
テスト関数は `async def` ではなく、通常の `def` であることに注意してください。
また、クライアントへの呼び出しも通常の呼び出しであり、`await` を使用しません。
これにより、煩雑にならずに、`pytest` を直接使用できます。
!!! note "技術詳細"
`from starlette.testclient import TestClient` も使用できます。
**FastAPI** は開発者の利便性のために `fastapi.testclient` と同じ `starlette.testclient` を提供します。しかし、実際にはStarletteから直接渡されています。
!!! tip "豆知識"
FastAPIアプリケーションへのリクエストの送信とは別に、テストで `async` 関数 (非同期データベース関数など) を呼び出したい場合は、高度なチュートリアルの[Async Tests](../advanced/async-tests.md){.internal-link target=_blank} を参照してください。
## テストの分離
実際のアプリケーションでは、おそらくテストを別のファイルに保存します。
また、**FastAPI** アプリケーションは、複数のファイル/モジュールなどで構成されている場合もあります。
### **FastAPI** アプリファイル
**FastAPI** アプリに `main.py` ファイルがあるとします:
```Python
{!../../../docs_src/app_testing/main.py!}
```
### テストファイル
次に、テストを含む `test_main.py` ファイルを作成し、`main` モジュール (`main.py`) から `app` をインポートします:
```Python
{!../../../docs_src/app_testing/test_main.py!}
```
## テスト: 例の拡張
次に、この例を拡張し、詳細を追加して、さまざまなパーツをテストする方法を確認しましょう。
### 拡張版 **FastAPI** アプリファイル
**FastAPI** アプリに `main_b.py` ファイルがあるとします。
そのファイルには、エラーを返す可能性のある `GET` オペレーションがあります。
また、いくつかのエラーを返す可能性のある `POST` オペレーションもあります。
これらの *path operation* には `X-Token` ヘッダーが必要です。
```Python
{!../../../docs_src/app_testing/main_b.py!}
```
### 拡張版テストファイル
次に、先程のものに拡張版のテストを加えた、`test_main_b.py` を作成します。
```Python
{!../../../docs_src/app_testing/test_main_b.py!}
```
リクエストに情報を渡せるクライアントが必要で、その方法がわからない場合はいつでも、`requests` での実現方法を検索 (Google) できます。
テストでも同じことを行います。
例えば:
* *パス* または *クエリ* パラメータを渡すには、それをURL自体に追加します。
* JSONボディを渡すには、Pythonオブジェクト (例: `dict`) を `json` パラメータに渡します。
* JSONの代わりに *フォームデータ* を送信する必要がある場合は、代わりに `data` パラメータを使用してください。
* *ヘッダー* を渡すには、`headers` パラメータに `dict` を渡します。
* *cookies* の場合、 `cookies` パラメータに `dict` です。
(`requests` または `TestClient` を使用して) バックエンドにデータを渡す方法の詳細は、<a href="http://docs.python-requests.org" class="external-link" target="_blank">Requestsのドキュメント</a>を確認してください。
!!! info "情報"
`TestClient` は、Pydanticモデルではなく、JSONに変換できるデータを受け取ることに注意してください。
テストにPydanticモデルがあり、テスト中にそのデータをアプリケーションに送信したい場合は、[JSON互換エンコーダ](encoder.md){.internal-link target=_blank} で説明されている `jsonable_encoder` が利用できます。
## 実行
後は、`pytest` をインストールするだけです:
<div class="termy">
```console
$ pip install pytest
---> 100%
```
</div>
ファイルを検知し、自動テストを実行し、結果のレポートを返します。
以下でテストを実行します:
<div class="termy">
```console
$ pytest
================ test session starts ================
platform linux -- Python 3.6.9, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /home/user/code/superawesome-cli/app
plugins: forked-1.1.3, xdist-1.31.0, cov-2.8.1
collected 6 items
---> 100%
test_main.py <span style="color: green; white-space: pre;">...... [100%]</span>
<span style="color: green;">================= 1 passed in 0.03s =================</span>
```
</div>

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -51,6 +54,7 @@ nav:
- uk: /uk/
- zh: /zh/
- features.md
- fastapi-people.md
- チュートリアル - ユーザーガイド:
- tutorial/index.md
- tutorial/first-steps.md
@@ -58,17 +62,33 @@ nav:
- tutorial/query-params.md
- tutorial/body.md
- tutorial/query-params-str-validations.md
- tutorial/cookie-params.md
- tutorial/header-params.md
- tutorial/request-forms.md
- tutorial/body-updates.md
- セキュリティ:
- tutorial/security/first-steps.md
- tutorial/middleware.md
- tutorial/cors.md
- tutorial/static-files.md
- tutorial/testing.md
- tutorial/debugging.md
- 高度なユーザーガイド:
- advanced/path-operation-advanced-configuration.md
- advanced/additional-status-codes.md
- advanced/response-directly.md
- advanced/custom-response.md
- async.md
- デプロイ:
- deployment/index.md
- deployment/versions.md
- deployment/deta.md
- deployment/docker.md
- deployment/manually.md
- project-generation.md
- alternatives.md
- history-design-future.md
- external-links.md
- benchmarks.md
- help-fastapi.md
- contributing.md
@@ -91,7 +111,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -105,16 +127,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

View File

@@ -46,7 +46,10 @@ FastAPI는 현대적이고, 빠르며(고성능), 파이썬 표준 타입 힌트
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}
@@ -98,7 +101,7 @@ 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>
웹 API 대신 터미널에서 사용할 <abbr title="Command Line Interface">CLI</abbr> 앱을 만들고 있다면, <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>를 확인해 보세요.
웹 API 대신 터미널에서 사용할 <abbr title="Command Line Interface">CLI</abbr> 앱을 만들고 있다면, <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>를 확인해 보십시오.
**Typer**는 FastAPI의 동생입니다. 그리고 **FastAPI의 CLI**가 되기 위해 생겼습니다. ⌨️ 🚀
@@ -139,7 +142,7 @@ $ pip install uvicorn[standard]
### 만들기
* `main.py` 파일을 만드세요:
* `main.py` 파일을 만드십시오:
```Python
from typing import Optional
@@ -162,7 +165,7 @@ def read_item(item_id: int, q: Optional[str] = None):
<details markdown="1">
<summary>또는 <code>async def</code> 사용하기...</summary>
여러분의 코드가 `async` / `await`을 사용한다면, `async def`를 사용하세요:
여러분의 코드가 `async` / `await`을 사용한다면, `async def`를 사용하십시오.
```Python hl_lines="9 14"
from typing import Optional
@@ -184,7 +187,7 @@ async def read_item(item_id: int, q: Optional[str] = None):
**Note**:
잘 모르겠다면, <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">문서에서 `async`와 `await`</a>에 관한 _"급하세요?"_ 섹션을 확인해 보세요.
잘 모르겠다면, <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">문서에서 `async`와 `await`</a>에 관한 _"급하세요?"_ 섹션을 확인해 보십시오.
</details>
@@ -213,13 +216,13 @@ INFO: Application startup complete.
* `main`: `main.py` 파일 (파이썬 "모듈").
* `app`: the object created inside of `main.py` with the line `app = FastAPI()`.
* `--reload`: 코드가 변경된 후 서버 재시작하기. 개발환경에서만 사용하세요.
* `--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>를 열어보세요.
브라우저로 <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 응답을 볼 수 있습니다:
@@ -244,13 +247,13 @@ INFO: Application startup complete.
### 대안 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="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> 제공):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## 예제 개선
## 예제 심화
이제 `PUT` 요청에 있는 본문(Body)을 받기 위해 `main.py`를 수정해봅시다.
@@ -314,7 +317,7 @@ def update_item(item_id: int, item: Item):
### 요약
요약하면, 여러분은 매개변수의 타입, 본문 등을 함수 매개변수로 **한번에** 선언했습니다.
요약하면, 여러분은 매개변수의 타입, 본문 등을 함수 매개변수로 **한번에** 선언했습니다.
여러분은 현대 표준 파이썬 타입으로 이를 행했습니다.
@@ -375,7 +378,7 @@ item: Item
* `price`을 필수 속성으로 갖고 `float` 형인지 검사.
* 만약 주어진다면, `is_offer`를 선택 속성으로 갖고 `bool` 형인지 검사.
* 이 모든 것은 깊이 중첩된 JSON 객체에도 적용됩니다.
* JSON으로, 그리고 에서부터 자동 변환.
* JSON을 변환하거나 JSON으로 변환하는 것을 자동화.
* 다음에서 사용할 수 있는 모든 것을 OpenAPI로 문서화:
* 대화형 문서 시스템.
* 여러 언어들에 대한 자동 클라이언트 코드 생성 시스템.
@@ -403,11 +406,11 @@ item: Item
... "item_price": item.price ...
```
...그러고 나서 여러분의 편집기가 속성과 타입을 알고 자동 완성하는지 보세요:
...그러고 나서 여러분의 편집기가 속성과 타입을 알고 자동 완성하는지 보십시오:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
더 많은 기능을 포함한 보다 완전한 예제의 경우, <a href="https://fastapi.tiangolo.com/tutorial/">튜토리얼 - 사용자 가이드</a>를 보세요.
더 많은 기능을 포함한 보다 완전한 예제의 경우, <a href="https://fastapi.tiangolo.com/tutorial/">튜토리얼 - 사용자 가이드</a>를 보십시오.
**스포일러 주의**: 튜토리얼 - 사용자 가이드는:
@@ -428,9 +431,9 @@ item: Item
독립된 TechEmpower 벤치마크에서 Uvicorn에서 작동하는 FastAPI 어플리케이션이 <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">벤치마크</a> 섹션을 보세요.
자세한 내용은 <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">벤치마크</a> 섹션을 보십시오.
## 선택가능한 종속사항
## 선택가능한 의존성
Pydantic이 사용하는:

View File

@@ -0,0 +1,333 @@
# 첫걸음
가장 단순한 FastAPI 파일은 다음과 같이 보일 겁니다:
```Python
{!../../../docs_src/first_steps/tutorial001.py!}
```
위를 `main.py`에 복사합니다.
라이브 서버를 실행합니다:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
<span style="color: green;">INFO</span>: Started reloader process [28720]
<span style="color: green;">INFO</span>: Started server process [28722]
<span style="color: green;">INFO</span>: Waiting for application startup.
<span style="color: green;">INFO</span>: Application startup complete.
```
</div>
!!! note "참고"
`uvicorn main:app` 명령은 다음을 의미합니다:
* `main`: 파일 `main.py` (파이썬 "모듈").
* `app`: `main.py` 내부의 `app = FastAPI()` 줄에서 생성한 오브젝트.
* `--reload`: 코드 변경 후 서버 재시작. 개발에만 사용.
출력에 아래와 같은 줄이 있습니다:
```hl_lines="4"
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
해당 줄은 로컬에서 앱이 서비스되는 URL을 보여줍니다.
### 확인하기
브라우저로 <a href="http://127.0.0.1:8000" class="external-link" target="_blank">http://127.0.0.1:8000</a>를 여세요.
아래와 같은 JSON 응답을 볼 수 있습니다:
```JSON
{"message": "Hello World"}
```
### 대화형 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> 제공):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### 대안 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> 제공):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
### OpenAPI
**FastAPI**는 API를 정의하기 위한 **OpenAPI** 표준을 사용하여 여러분의 모든 API를 이용해 "스키마"를 생성합니다.
#### "스키마"
"스키마"는 무언가의 정의 또는 설명입니다. 이를 구현하는 코드가 아니라 추상적인 설명일 뿐입니다.
#### API "스키마"
이 경우, <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a>는 API의 스키마를 어떻게 정의하는지 지시하는 규격입니다.
이 스키마 정의는 API 경로, 가능한 매개변수 등을 포함합니다.
#### 데이터 "스키마"
"스키마"라는 용어는 JSON처럼 어떤 데이터의 형태를 나타낼 수도 있습니다.
이러한 경우 JSON 속성, 가지고 있는 데이터 타입 등을 뜻합니다.
#### OpenAPI와 JSON 스키마
OpenAPI는 API에 대한 API 스키마를 정의합니다. 또한 이 스키마에는 JSON 데이터 스키마의 표준인 **JSON 스키마**를 사용하여 API에서 보내고 받은 데이터의 정의(또는 "스키마")를 포함합니다.
#### `openapi.json` 확인
가공되지 않은 OpenAPI 스키마가 어떻게 생겼는지 궁금하다면, FastAPI는 자동으로 API의 설명과 함께 JSON (스키마)를 생성합니다.
여기에서 직접 볼 수 있습니다: <a href="http://127.0.0.1:8000/openapi.json" class="external-link" target="_blank">http://127.0.0.1:8000/openapi.json</a>.
다음과 같이 시작하는 JSON을 확인할 수 있습니다:
```JSON
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/items/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
...
```
#### OpenAPI의 용도
OpenAPI 스키마는 포함된 두 개의 대화형 문서 시스템을 제공합니다.
그리고 OpenAPI의 모든 것을 기반으로 하는 수십 가지 대안이 있습니다. **FastAPI**로 빌드한 애플리케이션에 이러한 대안을 쉽게 추가 할 수 있습니다.
API와 통신하는 클라이언트를 위해 코드를 자동으로 생성하는 데도 사용할 수 있습니다. 예로 프론트엔드, 모바일, IoT 애플리케이션이 있습니다.
## 단계별 요약
### 1 단계: `FastAPI` 임포트
```Python hl_lines="1"
{!../../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI`는 API에 대한 모든 기능을 제공하는 파이썬 클래스입니다.
!!! note "기술 세부사항"
`FastAPI`는 `Starlette`를 직접 상속하는 클래스입니다.
`FastAPI`로 <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a>의 모든 기능을 사용할 수 있습니다.
### 2 단계: `FastAPI` "인스턴스" 생성
```Python hl_lines="3"
{!../../../docs_src/first_steps/tutorial001.py!}
```
여기 있는 `app` 변수는 `FastAPI` 클래스의 "인스턴스"가 됩니다.
이것은 모든 API를 생성하기 위한 상호작용의 주요 지점이 될 것입니다.
이 `app`은 다음 명령에서 `uvicorn`이 참조하고 것과 동일합니다:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
아래처럼 앱을 만든다면:
```Python hl_lines="3"
{!../../../docs_src/first_steps/tutorial002.py!}
```
이를 `main.py` 파일에 넣고, `uvicorn`을 아래처럼 호출해야 합니다:
<div class="termy">
```console
$ uvicorn main:my_awesome_api --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
### 3 단계: *경로 동작* 생성
#### 경로
여기서 "경로"는 첫 번째 `/`에서 시작하는 URL의 마지막 부분을 나타냅니다.
그러므로 아래와 같은 URL에서:
```
https://example.com/items/foo
```
...경로는 다음과 같습니다:
```
/items/foo
```
!!! info "정보"
"경로"는 일반적으로 "앤드포인트" 또는 "라우트"라고도 불립니다.
API를 빌드하는 동안 "경로"는 "관심사"와 "리소스"를 분리하는 주요 방법입니다.
#### 동작
여기서 "동작(Operation)"은 HTTP "메소드" 중 하나를 나타냅니다.
다음 중 하나이며:
* `POST`
* `GET`
* `PUT`
* `DELETE`
...이국적인 것들도 있습니다:
* `OPTIONS`
* `HEAD`
* `PATCH`
* `TRACE`
HTTP 프로토콜에서는 이러한 "메소드"를 하나(또는 이상) 사용하여 각 경로와 통신할 수 있습니다.
---
API를 빌드하는 동안 일반적으로 특정 행동을 수행하기 위해 특정 HTTP 메소드를 사용합니다.
일반적으로 다음을 사용합니다:
* `POST`: 데이터를 생성하기 위해.
* `GET`: 데이터를 읽기 위해.
* `PUT`: 데이터를 업데이트하기 위해.
* `DELETE`: 데이터를 삭제하기 위해.
그래서 OpenAPI에서는 각 HTTP 메소드들을 "동작"이라 부릅니다.
이제부터 우리는 메소드를 "**동작**"이라고도 부를겁니다.
#### *경로 동작 데코레이터* 정의
```Python hl_lines="6"
{!../../../docs_src/first_steps/tutorial001.py!}
```
`@app.get("/")`은 **FastAPI**에게 바로 아래에 있는 함수가 다음으로 이동하는 요청을 처리한다는 것을 알려줍니다.
* 경로 `/`
* <abbr title="HTTP GET 메소드"><code>get</code> 동작</abbr> 사용
!!! info "`@decorator` 정보"
이 `@something` 문법은 파이썬에서 "데코레이터"라 부릅니다.
함수 맨 위에 놓습니다. 마치 예쁜 장식용(Decorative) 모자처럼(개인적으로 이 용어가 여기서 유래한거 같습니다).
"데코레이터" 아래 있는 함수를 받고 그걸 이용해 무언가 합니다.
우리의 경우, 이 데코레이터는 **FastAPI**에게 아래 함수가 **경로** `/`에 해당하는 `get` **동작**하라고 알려줍니다.
이것이 "**경로 동작 데코레이터**"입니다.
다른 동작도 쓸 수 있습니다:
* `@app.post()`
* `@app.put()`
* `@app.delete()`
이국적인 것들도 있습니다:
* `@app.options()`
* `@app.head()`
* `@app.patch()`
* `@app.trace()`
!!! tip "팁"
각 동작(HTTP 메소드)을 원하는 대로 사용해도 됩니다.
**FastAPI**는 특정 의미를 강제하지 않습니다.
여기서 정보는 지침서일뿐 요구사항이 아닙니다.
예를 들어 GraphQL을 사용할때 일반적으로 `POST` 동작만 사용하여 모든 행동을 수행합니다.
### 4 단계: **경로 동작 함수** 정의
다음은 우리의 "**경로 동작 함수**"입니다:
* **경로**: 는 `/`입니다.
* **동작**: 은 `get`입니다.
* **함수**: 는 "데코레이터" 아래에 있는 함수입니다 (`@app.get("/")` 아래).
```Python hl_lines="7"
{!../../../docs_src/first_steps/tutorial001.py!}
```
이것은 파이썬 함수입니다.
`GET` 동작을 사용하여 URL "`/`"에 대한 요청을 받을 때마다 **FastAPI**에 의해 호출됩니다.
위의 경우 `async` 함수입니다.
---
`async def` 대신 일반 함수로 정의할 수 있습니다:
```Python hl_lines="7"
{!../../../docs_src/first_steps/tutorial003.py!}
```
!!! note 참고
차이점을 모르겠다면 [Async: *"In a hurry?"*](../async.md#in-a-hurry){.internal-link target=_blank}을 확인하세요.
### 5 단계: 콘텐츠 반환
```Python hl_lines="8"
{!../../../docs_src/first_steps/tutorial001.py!}
```
`dict`, `list`, 단일값을 가진 `str`, `int` 등을 반환할 수 있습니다.
Pydantic 모델을 반환할 수도 있습니다(나중에 더 자세히 살펴봅니다).
JSON으로 자동 변환되는 객체들과 모델들이 많이 있습니다(ORM 등을 포함해서요). 가장 마음에 드는 것을 사용하세요, 이미 지원되고 있을 겁니다.
## 요약
* `FastAPI` 임포트.
* `app` 인스턴스 생성.
* (`@app.get("/")`처럼) **경로 동작 데코레이터** 작성.
* (위에 있는 `def root(): ...`처럼) **경로 동작 함수** 작성.
* (`uvicorn main:app --reload`처럼) 개발 서버 실행.

View File

@@ -0,0 +1,90 @@
# 헤더 매개변수
헤더 매개변수를 `Query`, `Path` 그리고 `Cookie` 매개변수들과 같은 방식으로 정의할 수 있습니다.
## `Header` 임포트
먼저 `Header`를 임포트합니다:
```Python hl_lines="3"
{!../../../docs_src/header_params/tutorial001.py!}
```
## `Header` 매개변수 선언
`Path`, `Query` 그리고 `Cookie`를 사용한 동일한 구조를 이용하여 헤더 매개변수를 선언합니다.
첫 번째 값은 기본값이며, 추가 검증이나 어노테이션 매개변수 모두 전달할 수 있습니다:
```Python hl_lines="9"
{!../../../docs_src/header_params/tutorial001.py!}
```
!!! note "기술 세부사항"
`Header`는 `Path`, `Query` 및 `Cookie`의 "자매"클래스입니다. 이 역시 동일한 공통 `Param` 클래스를 상속합니다.
`Query`, `Path`, `Header` 그리고 다른 것들을 `fastapi`에서 임포트 할 때, 이들은 실제로 특별한 클래스를 반환하는 함수임을 기억하세요.
!!! info "정보"
헤더를 선언하기 위해서 `Header`를 사용해야 합니다. 그렇지 않으면 해당 매개변수를 쿼리 매개변수로 해석하기 때문입니다.
## 자동 변환
`Header`는 `Path`, `Query` 그리고 `Cookie`가 제공하는 것 외에 기능이 조금 더 있습니다.
대부분의 표준 헤더는 "마이너스 기호" (`-`)라고도 하는 "하이픈" 문자로 구분됩니다.
그러나 파이썬에서 `user-agent`와 같은 형태의 변수는 유효하지 않습니다.
따라서 `Header`는 기본적으로 매개변수 이름을 언더스코어(`_`)에서 하이픈(`-`)으로 변환하여 헤더를 추출하고 기록합니다.
또한 HTTP 헤더는 대소문자를 구분하지 않으므로 "snake_case"로 알려진 표준 파이썬 스타일로 선언할 수 있습니다.
따라서, `User_Agent` 등과 같이 첫 문자를 대문자화할 필요없이 파이썬 코드에서처럼 `user_agent`로 사용합니다.
만약 언더스코어를 하이픈으로 자동 변환을 비활성화해야 할 어떤 이유가 있다면, `Header`의 `convert_underscores` 매개변수를 `False`로 설정하십시오:
```Python hl_lines="10"
{!../../../docs_src/header_params/tutorial002.py!}
```
!!! warning "경고"
`convert_underscore`를 `False`로 설정하기 전에, 어떤 HTTP 프록시들과 서버들은 언더스코어가 포함된 헤더 사용을 허락하지 않는다는 것을 명심하십시오.
## 중복 헤더
중복 헤더들을 수신할 수 있습니다. 즉, 다중값을 갖는 동일한 헤더를 뜻합니다.
타입 정의에서 리스트를 사용하여 이러한 케이스를 정의할 수 있습니다.
중복 헤더의 모든 값을 파이썬 `list`로 수신합니다.
예를 들어, 두 번 이상 나타날 수 있는 `X-Token`헤더를 선언하려면, 다음과 같이 작성합니다:
```Python hl_lines="9"
{!../../../docs_src/header_params/tutorial003.py!}
```
다음과 같은 두 개의 HTTP 헤더를 전송하여 해당 *경로* 와 통신할 경우:
```
X-Token: foo
X-Token: bar
```
응답은 다음과 같습니다:
```JSON
{
"X-Token values": [
"bar",
"foo"
]
}
```
## 요약
`Header`는 `Query`, `Path`, `Cookie`와 동일한 패턴을 사용하여 선언합니다.
변수의 언더스코어를 걱정하지 마십시오, **FastAPI**가 변수를 변환할 것입니다.

View File

@@ -0,0 +1,80 @@
# 자습서 - 사용자 안내서 - 도입부
이 자습서는 **FastAPI**의 대부분의 기능을 단계별로 사용하는 방법을 보여줍니다.
각 섹션은 이전 섹션을 기반해서 점진적으로 만들어 졌지만, 주제를 구분하여 구성 되었기 때문에 특정 API 요구사항을 해결하기 위해 어떤 특정 항목이던지 직접 이동할 수 있습니다.
또한 향후 참조가 될 수 있도록 만들어졌습니다.
그러므로 다시 돌아와서 정확히 필요한 것을 볼 수 있습니다.
## 코드 실행하기
모든 코드 블록은 복사하고 직접 사용할 수 있습니다(실제로 테스트한 파이썬 파일입니다).
예제를 실행하려면 코드를 `main.py` 파일에 복사하고 다음을 사용하여 `uvicorn`을 시작합니다:
<div class="termy">
```console
$ uvicorn main:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
<span style="color: green;">INFO</span>: Started reloader process [28720]
<span style="color: green;">INFO</span>: Started server process [28722]
<span style="color: green;">INFO</span>: Waiting for application startup.
<span style="color: green;">INFO</span>: Application startup complete.
```
</div>
코드를 작성하거나 복사, 편집할 때, 로컬에서 실행하는 것을 **강력히 장려**합니다.
편집기에서 이렇게 사용하면, 모든 타입 검사, 자동완성 등 작성해야 하는 코드가 얼마나 적은지 보면서 FastAPI의 장점을 실제로 확인할 수 있습니다.
---
## FastAPI 설치
첫 번째 단계는 FastAPI 설치입니다.
자습시에는 모든 선택적인 의존성 및 기능을 사용하여 설치할 수 있습니다:
<div class="termy">
```console
$ pip install fastapi[all]
---> 100%
```
</div>
...코드를 실행하는 서버로 사용할 수 있는 `uvicorn` 역시 포함하고 있습니다.
!!! note "참고"
부분적으로 설치할 수도 있습니다.
애플리케이션을 운영 환경에 배포하려는 경우 다음과 같이 합니다:
```
pip install fastapi
```
추가로 서버 역할을 하는 `uvicorn`을 설치합니다:
```
pip install uvicorn
```
사용하려는 각 선택적인 의존성에 대해서도 동일합니다.
## 고급 사용자 안내서
**자습서 - 사용자 안내서** 다음에 읽을 수 있는 **고급 사용자 안내서**도 있습니다.
**고급 사용자 안내서**는 현재 문서를 기반으로 하고, 동일한 개념을 사용하며, 추가 기능들을 알려줍니다.
하지만 (지금 읽고 있는) **자습서 - 사용자 안내서**를 먼저 읽는게 좋습니다.
**자습서 - 사용자 안내서**만으로 완전한 애플리케이션을 구축한 다음, **고급 사용자 안내서**의 몇 가지 추가 아이디어를 사용하여 필요에 따라 다양한 방식으로 확장할 수 있도록 설계되었습니다.

View File

@@ -0,0 +1,244 @@
# 경로 매개변수
파이썬 포맷 문자열이 사용하는 동일한 문법으로 "매개변수" 또는 "변수"를 경로에 선언할 수 있습니다:
```Python hl_lines="6-7"
{!../../../docs_src/path_params/tutorial001.py!}
```
경로 매개변수 `item_id`의 값은 함수의 `item_id` 인자로 전달됩니다.
그래서 이 예제를 실행하고 <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a>로 이동하면, 다음 응답을 볼 수 있습니다:
```JSON
{"item_id":"foo"}
```
## 타입이 있는 매개변수
파이썬 표준 타입 어노테이션을 사용하여 함수에 있는 경로 매개변수의 타입을 선언할 수 있습니다:
```Python hl_lines="7"
{!../../../docs_src/path_params/tutorial002.py!}
```
지금과 같은 경우, `item_id`는 `int`로 선언 되었습니다.
!!! check "확인"
이 기능은 함수 내에서 오류 검사, 자동완성 등을 편집기를 지원합니다
## 데이터 <abbr title="다음으로도 알려져 있습니다: 직렬화, 파싱, 마샬링">변환</abbr>
이 예제를 실행하고 <a href="http://127.0.0.1:8000/items/3" class="external-link" target="_blank">http://127.0.0.1:8000/items/3</a>을 열면, 다음 응답을 볼 수 있습니다:
```JSON
{"item_id":3}
```
!!! check "확인"
함수가 받은(반환도 하는) 값은 문자열 `"3"`이 아니라 파이썬 `int` 형인 `3`입니다.
즉, 타입 선언을 하면 **FastAPI**는 자동으로 요청을 <abbr title="HTTP 요청에서 전달되는 문자열을 파이썬 데이터로 변환">"파싱"</abbr>합니다.
## 데이터 검증
하지만 브라우저에서 <a href="http://127.0.0.1:8000/items/foo" class="external-link" target="_blank">http://127.0.0.1:8000/items/foo</a>로 이동하면, 멋진 HTTP 오류를 볼 수 있습니다:
```JSON
{
"detail": [
{
"loc": [
"path",
"item_id"
],
"msg": "value is not a valid integer",
"type": "type_error.integer"
}
]
}
```
경로 매개변수 `item_id`는 `int`가 아닌 `"foo"` 값이기 때문입니다.
`int` 대신 `float`을 전달하면 동일한 오류가 나타납니다: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2</a>
!!! check "확인"
즉, 파이썬 타입 선언을 하면 **FastAPI**는 데이터 검증을 합니다.
오류는 검증을 통과하지 못한 지점도 정확하게 명시합니다.
이는 API와 상호 작용하는 코드를 개발하고 디버깅하는 데 매우 유용합니다.
## 문서화
그리고 브라우저에서 <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>를 열면, 다음과 같이 자동 대화식 API 문서를 볼 수 있습니다:
<img src="/img/tutorial/path-params/image01.png">
!!! check "확인"
다시 한번, 그저 파이썬 타입 선언을 하기만 하면 **FastAPI**는 자동 대화식 API 문서(Swagger UI 통합)를 제공합니다.
경로 매개변수는 정수형으로 선언됐음을 주목하세요.
## 표준 기반의 이점, 대체 문서화
그리고 생성된 스키마는 <a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md" class="external-link" target="_blank">OpenAPI</a> 표준에서 나온 것이기 때문에 호환되는 도구가 많이 있습니다.
이 덕분에 **FastAPI**는 <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>로 접속할 수 있는 (ReDoc을 사용하는) 대체 API 문서를 제공합니다:
<img src="/img/tutorial/path-params/image02.png">
이와 마찬가지로 호환되는 도구가 많이 있습니다. 다양한 언어에 대한 코드 생성 도구를 포함합니다.
## Pydantic
모든 데이터 검증은 <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>에 의해 내부적으로 수행되므로 이로 인한 모든 이점을 얻을 수 있습니다. 여러분은 관리를 잘 받고 있음을 느낄 수 있습니다.
`str`, `float`, `bool`과 다른 복잡한 데이터 타입 선언을 할 수 있습니다.
이 중 몇 가지는 자습서의 다음 장에서 살펴봅니다.
## 순서 문제
*경로 동작*을 만들때 고정 경로를 갖고 있는 상황들을 맞닦뜨릴 수 있습니다.
`/users/me`처럼, 현재 사용자의 데이터를 가져온다고 합시다.
사용자 ID를 이용해 특정 사용자의 정보를 가져오는 경로 `/users/{user_id}`도 있습니다.
*경로 동작*은 순차적으로 평가되기 때문에 `/users/{user_id}` 이전에 `/users/me`를 먼저 선언해야 합니다:
```Python hl_lines="6 11"
{!../../../docs_src/path_params/tutorial003.py!}
```
그렇지 않으면 `/users/{user_id}`는 매개변수 `user_id`의 값을 `"me"`라고 "생각하여" `/users/me`도 연결합니다.
## 사전정의 값
만약 *경로 매개변수*를 받는 *경로 동작*이 있지만, 유효하고 미리 정의할 수 있는 *경로 매개변수* 값을 원한다면 파이썬 표준 <abbr title="열거형(Enumeration)">`Enum`</abbr>을 사용할 수 있습니다.
### `Enum` 클래스 생성
`Enum`을 임포트하고 `str`과 `Enum`을 상속하는 서브 클래스를 만듭니다.
`str`을 상속함으로써 API 문서는 값이 `string` 형이어야 하는 것을 알게 되고 제대로 렌더링 할 수 있게 됩니다.
고정값으로 사용할 수 있는 유효한 클래스 어트리뷰트를 만듭니다:
```Python hl_lines="1 6-9"
{!../../../docs_src/path_params/tutorial005.py!}
```
!!! info "정보"
<a href="https://docs.python.org/3/library/enum.html" class="external-link" target="_blank">열거형(또는 enums)</a>은 파이썬 버전 3.4 이후로 사용가능합니다.
!!! tip "팁"
혹시 헷갈린다면, "AlexNet", "ResNet", 그리고 "LeNet"은 그저 기계 학습 <abbr title="기술적으로 정확히는 딥 러닝 모델 구조">모델</abbr>들의 이름입니다.
### *경로 매개변수* 선언
생성한 열거형 클래스(`ModelName`)를 사용하는 타입 어노테이션으로 *경로 매개변수*를 만듭니다:
```Python hl_lines="16"
{!../../../docs_src/path_params/tutorial005.py!}
```
### 문서 확인
*경로 매개변수*에 사용할 수 있는 값은 미리 정의되어 있으므로 대화형 문서에서 멋지게 표시됩니다:
<img src="/img/tutorial/path-params/image03.png">
### 파이썬 *열거형*으로 작업하기
*경로 매개변수*의 값은 *열거형 멤버*가 됩니다.
#### *열거형 멤버* 비교
열거체 `ModelName`의 *열거형 멤버*를 비교할 수 있습니다:
```Python hl_lines="17"
{!../../../docs_src/path_params/tutorial005.py!}
```
#### *열거형 값* 가져오기
`model_name.value` 또는 일반적으로 `your_enum_member.value`를 이용하여 실제값(지금의 경우 `str`)을 가져올 수 있습니다:
```Python hl_lines="20"
{!../../../docs_src/path_params/tutorial005.py!}
```
!!! tip "팁"
`ModelName.lenet.value`로도 값 `"lenet"`에 접근할 수 있습니다.
#### *열거형 멤버* 반환
*경로 동작*에서 중첩 JSON 본문(예: `dict`) 역시 *열거형 멤버*를 반환할 수 있습니다.
클라이언트에 반환하기 전에 해당 값(이 경우 문자열)으로 변환됩니다:
```Python hl_lines="18 21 23"
{!../../../docs_src/path_params/tutorial005.py!}
```
클라이언트는 아래의 JSON 응답을 얻습니다:
```JSON
{
"model_name": "alexnet",
"message": "Deep Learning FTW!"
}
```
## 경로를 포함하는 경로 매개변수
`/files/{file_path}`가 있는 *경로 동작*이 있다고 해봅시다.
그런데 여러분은 `home/johndoe/myfile.txt`처럼 *path*에 들어있는 `file_path` 자체가 필요합니다.
따라서 해당 파일의 URL은 다음처럼 됩니다: `/files/home/johndoe/myfile.txt`.
### OpenAPI 지원
테스트와 정의가 어려운 시나리오로 이어질 수 있으므로 OpenAPI는 *경로*를 포함하는 *경로 매개변수*를 내부에 선언하는 방법을 지원하지 않습니다.
그럼에도 Starlette의 내부 도구중 하나를 사용하여 **FastAPI**에서는 할 수 있습니다.
매개변수에 경로가 포함되어야 한다는 문서를 추가하지 않아도 문서는 계속 작동합니다.
### 경로 변환기
Starlette에서 직접 옵션을 사용하면 다음과 같은 URL을 사용하여 *path*를 포함하는 *경로 매개변수*를 선언 할 수 있습니다:
```
/files/{file_path:path}
```
이러한 경우 매개변수의 이름은 `file_path`이고 마지막 부분 `:path`는 매개변수가 *경로*와 일치해야함을 알려줍니다.
그러므로 다음과 같이 사용할 수 있습니다:
```Python hl_lines="6"
{!../../../docs_src/path_params/tutorial004.py!}
```
!!! tip "팁"
매개변수가 `/home/johndoe/myfile.txt`를 갖고 있어 슬래시로 시작(`/`)해야 할 수 있습니다.
이 경우 URL은: `/files//home/johndoe/myfile.txt`이며 `files`과 `home` 사이에 이중 슬래시(`//`)가 생깁니다.
## 요약
**FastAPI**과 함께라면 짧고 직관적인 표준 파이썬 타입 선언을 사용하여 다음을 얻을 수 있습니다:
* 편집기 지원: 오류 검사, 자동완성 등
* 데이터 "<abbr title="HTTP 요청에서 전달되는 문자열을 파이썬 데이터로 변환">파싱</abbr>"
* 데이터 검증
* API 주석(Annotation)과 자동 문서
위 사항들을 그저 한번에 선언하면 됩니다.
이는 (원래 성능과는 별개로) 대체 프레임워크와 비교했을 때 **FastAPI**의 주요 가시적 장점일 것입니다.

View File

@@ -0,0 +1,198 @@
# 쿼리 매개변수
경로 매개변수의 일부가 아닌 다른 함수 매개변수를 선언할 때, "쿼리" 매개변수로 자동 해석합니다.
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial001.py!}
```
쿼리는 URL에서 `?` 후에 나오고 `&`으로 구분되는 키-값 쌍의 집합입니다.
예를 들어, URL에서:
```
http://127.0.0.1:8000/items/?skip=0&limit=10
```
...쿼리 매개변수는:
* `skip`: 값 `0`을 가집니다.
* `limit`: 값 `10`을 가집니다.
URL의 일부이므로 "자연스럽게" 문자열입니다.
하지만 파이썬 타입과 함께 선언할 경우(위 예에서 `int`), 해당 타입으로 변환되고 이에 대해 검증합니다.
경로 매개변수에 적용된 동일한 프로세스가 쿼리 매개변수에도 적용됩니다:
* (당연히) 편집기 지원
* 데이터 <abbr title="HTTP 요청에서 전달되는 문자열을 파이썬 데이터로 변환">"파싱"</abbr>
* 데이터 검증
* 자동 문서화
## 기본값
쿼리 매개변수는 경로에서 고정된 부분이 아니기 때문에 선택적일 수 있고 기본값을 가질 수 있습니다.
위 예에서 `skip=0`과 `limit=10`은 기본값을 갖고 있습니다.
그러므로 URL로 이동하면:
```
http://127.0.0.1:8000/items/
```
아래로 이동한 것과 같습니다:
```
http://127.0.0.1:8000/items/?skip=0&limit=10
```
하지만 가령 아래로 이동한 경우:
```
http://127.0.0.1:8000/items/?skip=20
```
함수의 매개변수 값은 아래가 됩니다:
* `skip=20`: URL에서 지정했기 때문입니다
* `limit=10`: 기본값이기 때문입니다
## 선택적 매개변수
같은 방법으로 기본값을 `None`으로 설정하여 선택적 매개변수를 선언할 수 있습니다:
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial002.py!}
```
이 경우 함수 매개변수 `q`는 선택적이며 기본값으로 `None` 값이 됩니다.
!!! check "확인"
**FastAPI**는 `item_id`가 경로 매개변수이고 `q`는 경로 매개변수가 아닌 쿼리 매개변수라는 것을 알 정도로 충분히 똑똑합니다.
!!! note "참고"
FastAPI는 `q`가 `= None`이므로 선택적이라는 것을 인지합니다.
`Optional[str]`에 있는 `Optional`은 FastAPI(FastAPI는 `str` 부분만 사용합니다)가 사용하는게 아니지만, `Optional[str]`은 편집기에게 코드에서 오류를 찾아낼 수 있게 도와줍니다.
## 쿼리 매개변수 형변환
`bool` 형으로 선언할 수도 있고, 아래처럼 변환됩니다:
```Python hl_lines="9"
{!../../../docs_src/query_params/tutorial003.py!}
```
이 경우, 아래로 이동하면:
```
http://127.0.0.1:8000/items/foo?short=1
```
또는
```
http://127.0.0.1:8000/items/foo?short=True
```
또는
```
http://127.0.0.1:8000/items/foo?short=true
```
또는
```
http://127.0.0.1:8000/items/foo?short=on
```
또는
```
http://127.0.0.1:8000/items/foo?short=yes
```
또는 다른 어떤 변형(대문자, 첫글자만 대문자 등)이더라도 함수는 매개변수 `bool`형을 가진 `short`의 값이 `True`임을 압니다. 그렇지 않은 경우 `False`입니다.
## 여러 경로/쿼리 매개변수
여러 경로 매개변수와 쿼리 매개변수를 동시에 선언할 수 있으며 **FastAPI**는 어느 것이 무엇인지 알고 있습니다.
그리고 특정 순서로 선언할 필요가 없습니다.
매개변수들은 이름으로 감지됩니다:
```Python hl_lines="8 10"
{!../../../docs_src/query_params/tutorial004.py!}
```
## 필수 쿼리 매개변수
경로가 아닌 매개변수에 대한 기본값을 선언할 때(지금은 쿼리 매개변수만 보았습니다), 해당 매개변수는 필수적(Required)이지 않았습니다.
특정값을 추가하지 않고 선택적으로 만들기 위해선 기본값을 `None`으로 설정하면 됩니다.
그러나 쿼리 매개변수를 필수로 만들려면 기본값을 선언할 수 없습니다:
```Python hl_lines="6-7"
{!../../../docs_src/query_params/tutorial005.py!}
```
여기 쿼리 매개변수 `needy`는 `str`형인 필수 쿼리 매개변수입니다.
브라우저에서 URL을 아래처럼 연다면:
```
http://127.0.0.1:8000/items/foo-item
```
...필수 매개변수 `needy`를 넣지 않았기 때문에 아래와 같은 오류를 보게 됩니다:
```JSON
{
"detail": [
{
"loc": [
"query",
"needy"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}
```
`needy`는 필수 매개변수이므로 URL에 반드시 설정해줘야 합니다:
```
http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
```
...아래처럼 작동합니다:
```JSON
{
"item_id": "foo-item",
"needy": "sooooneedy"
}
```
그리고 물론, 일부 매개변수는 필수로, 다른 일부는 기본값을, 또 다른 일부는 선택적으로 선언할 수 있습니다:
```Python hl_lines="10"
{!../../../docs_src/query_params/tutorial006.py!}
```
이 경우 3가지 쿼리 매개변수가 있습니다:
* `needy`, 필수적인 `str`.
* `skip`, 기본값이 `0`인 `int`.
* `limit`, 선택적인 `int`.
!!! tip "팁"
[경로 매개변수](path-params.md#predefined-values){.internal-link target=_blank}와 마찬가지로 `Enum`을 사용할 수 있습니다.

View File

@@ -39,17 +39,26 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
- 자습서 - 사용자 안내서:
- tutorial/index.md
- tutorial/first-steps.md
- tutorial/path-params.md
- tutorial/query-params.md
- tutorial/header-params.md
markdown_extensions:
- toc:
permalink: true
@@ -69,7 +78,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -83,16 +94,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

467
docs/pl/docs/index.md Normal file
View File

@@ -0,0 +1,467 @@
{!../../../docs/missing-translation.md!}
<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 framework, high performance, easy to learn, fast to code, ready for production</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>
---
**Documentation**: <a href="https://fastapi.tiangolo.com" target="_blank">https://fastapi.tiangolo.com</a>
**Source Code**: <a href="https://github.com/tiangolo/fastapi" target="_blank">https://github.com/tiangolo/fastapi</a>
---
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:
* **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. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> 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: <a href="https://github.com/OAI/OpenAPI-Specification" class="external-link" target="_blank">OpenAPI</a> (previously known as Swagger) and <a href="https://json-schema.org/" class="external-link" target="_blank">JSON Schema</a>.
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Sponsors
<!-- 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">Other sponsors</a>
## 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._"
<div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
---
"_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
<div style="text-align: right; margin-right: 10%;">Piero Molino, Yaroslav Dudin, and Sai Sumanth Miryala - <strong>Uber</strong> <a href="https://eng.uber.com/ludwig-v0-2/" target="_blank"><small>(ref)</small></a></div>
---
"_**Netflix** is pleased to announce the open-source release of our **crisis management** orchestration framework: **Dispatch**! [built with **FastAPI**]_"
<div style="text-align: right; margin-right: 10%;">Kevin Glisson, Marc Vilanova, Forest Monsen - <strong>Netflix</strong> <a href="https://netflixtechblog.com/introducing-dispatch-da4b8a2a8072" target="_blank"><small>(ref)</small></a></div>
---
"_Im over the moon excited about **FastAPI**. Its so fun!_"
<div style="text-align: right; margin-right: 10%;">Brian Okken - <strong><a href="https://pythonbytes.fm/episodes/show/123/time-to-right-the-py-wrongs?time_in_sec=855" target="_blank">Python Bytes</a> podcast host</strong> <a href="https://twitter.com/brianokken/status/1112220079972728832" target="_blank"><small>(ref)</small></a></div>
---
"_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._"
<div style="text-align: right; margin-right: 10%;">Timothy Crosley - <strong><a href="https://www.hug.rest/" target="_blank">Hug</a> creator</strong> <a href="https://news.ycombinator.com/item?id=19455465" target="_blank"><small>(ref)</small></a></div>
---
"_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 [...]_"
"_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
<div style="text-align: right; margin-right: 10%;">Ines Montani - Matthew Honnibal - <strong><a href="https://explosion.ai" target="_blank">Explosion AI</a> founders - <a href="https://spacy.io" target="_blank">spaCy</a> creators</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**, the FastAPI of CLIs
<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>
If you are building a <abbr title="Command Line Interface">CLI</abbr> app to be used in the terminal instead of a web API, check out <a href="https://typer.tiangolo.com/" class="external-link" target="_blank">**Typer**</a>.
**Typer** is FastAPI's little sibling. And it's intended to be the **FastAPI of CLIs**. ⌨️ 🚀
## Requirements
Python 3.6+
FastAPI stands on the shoulders of giants:
* <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> for the web parts.
* <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a> for the data parts.
## Installation
<div class="termy">
```console
$ pip install fastapi
---> 100%
```
</div>
You will also need an ASGI server, for production such as <a href="https://www.uvicorn.org" class="external-link" target="_blank">Uvicorn</a> or <a href="https://gitlab.com/pgjones/hypercorn" class="external-link" target="_blank">Hypercorn</a>.
<div class="termy">
```console
$ pip install uvicorn[standard]
---> 100%
```
</div>
## Example
### Create it
* Create a file `main.py` with:
```Python
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
<details markdown="1">
<summary>Or use <code>async def</code>...</summary>
If your code uses `async` / `await`, use `async def`:
```Python hl_lines="9 14"
from typing import Optional
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: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
**Note**:
If you don't know, check the _"In a hurry?"_ section about <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank">`async` and `await` in the docs</a>.
</details>
### Run it
Run the server with:
<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>About the command <code>uvicorn main:app --reload</code>...</summary>
The command `uvicorn main:app` refers to:
* `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.
</details>
### Check it
Open your browser at <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>.
You will see the JSON response as:
```JSON
{"item_id": 5, "q": "somequery"}
```
You already created an API that:
* Receives HTTP requests in the _paths_ `/` and `/items/{item_id}`.
* Both _paths_ take `GET` <em>operations</em> (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`.
### Interactive API docs
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" class="external-link" target="_blank">Swagger UI</a>):
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-01-swagger-ui-simple.png)
### Alternative API docs
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
You will see the alternative automatic documentation (provided by <a href="https://github.com/Rebilly/ReDoc" class="external-link" target="_blank">ReDoc</a>):
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png)
## Example upgrade
Now modify the file `main.py` to receive a body from a `PUT` request.
Declare the body using standard Python types, thanks to Pydantic.
```Python hl_lines="4 9-12 25-27"
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Optional[bool] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = 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}
```
The server should reload automatically (because you added `--reload` to the `uvicorn` command above).
### Interactive API docs upgrade
Now go to <a href="http://127.0.0.1:8000/docs" class="external-link" target="_blank">http://127.0.0.1:8000/docs</a>.
* The interactive API documentation will be automatically updated, including the new body:
![Swagger UI](https://fastapi.tiangolo.com/img/index/index-03-swagger-02.png)
* Click on the button "Try it out", it allows you to fill the parameters and directly interact with the API:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-04-swagger-03.png)
* 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:
![Swagger UI interaction](https://fastapi.tiangolo.com/img/index/index-05-swagger-04.png)
### Alternative API docs upgrade
And now, go to <a href="http://127.0.0.1:8000/redoc" class="external-link" target="_blank">http://127.0.0.1:8000/redoc</a>.
* The alternative documentation will also reflect the new query parameter and body:
![ReDoc](https://fastapi.tiangolo.com/img/index/index-06-redoc-02.png)
### Recap
In summary, you declare **once** the types of parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods or classes of a specific library, etc.
Just standard **Python 3.6+**.
For example, for an `int`:
```Python
item_id: int
```
or for a more complex `Item` model:
```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.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> of input data: coming from the network to Python data and types. Reading from:
* JSON.
* Path parameters.
* Query parameters.
* Cookies.
* Headers.
* Forms.
* Files.
* <abbr title="also known as: serialization, parsing, marshalling">Conversion</abbr> 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:
* 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.
---
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:
![editor support](https://fastapi.tiangolo.com/img/vscode-completion.png)
For a more complete example including more features, see the <a href="https://fastapi.tiangolo.com/tutorial/">Tutorial - User Guide</a>.
**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 **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** 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`
* **CORS**
* **Cookie Sessions**
* ...and more.
## Performance
Independent TechEmpower benchmarks show **FastAPI** applications running under Uvicorn as <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">one of the fastest Python frameworks available</a>, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
To understand more about it, see the section <a href="https://fastapi.tiangolo.com/benchmarks/" class="internal-link" target="_blank">Benchmarks</a>.
## Optional Dependencies
Used by Pydantic:
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - for faster 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> - for email validation.
Used by Starlette:
* <a href="https://requests.readthedocs.io" target="_blank"><code>requests</code></a> - Required if you want to use the `TestClient`.
* <a href="https://github.com/Tinche/aiofiles" target="_blank"><code>aiofiles</code></a> - Required if you want to use `FileResponse` or `StaticFiles`.
* <a href="https://jinja.palletsprojects.com" target="_blank"><code>jinja2</code></a> - Required if you want to use the default template configuration.
* <a href="https://andrew-d.github.io/python-multipart/" target="_blank"><code>python-multipart</code></a> - Required if you want to support form <abbr title="converting the string that comes from an HTTP request into Python data">"parsing"</abbr>, with `request.form()`.
* <a href="https://pythonhosted.org/itsdangerous/" target="_blank"><code>itsdangerous</code></a> - Required for `SessionMiddleware` support.
* <a href="https://pyyaml.org/wiki/PyYAMLDocumentation" target="_blank"><code>pyyaml</code></a> - Required for Starlette's `SchemaGenerator` support (you probably don't need it with FastAPI).
* <a href="https://graphene-python.org/" target="_blank"><code>graphene</code></a> - Required for `GraphQLApp` support.
* <a href="https://github.com/esnme/ultrajson" target="_blank"><code>ujson</code></a> - Required if you want to use `UJSONResponse`.
Used by FastAPI / Starlette:
* <a href="https://www.uvicorn.org" target="_blank"><code>uvicorn</code></a> - for the server that loads and serves your application.
* <a href="https://github.com/ijl/orjson" target="_blank"><code>orjson</code></a> - Required if you want to use `ORJSONResponse`.
You can install all of these with `pip install fastapi[all]`.
## License
This project is licensed under the terms of the MIT license.

125
docs/pl/mkdocs.yml Normal file
View File

@@ -0,0 +1,125 @@
site_name: FastAPI
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
site_url: https://fastapi.tiangolo.com/pl/
theme:
name: material
custom_dir: overrides
palette:
- scheme: default
primary: teal
accent: amber
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
- scheme: slate
primary: teal
accent: amber
toggle:
icon: material/lightbulb
name: Switch to dark mode
features:
- search.suggest
- search.highlight
icon:
repo: fontawesome/brands/github-alt
logo: https://fastapi.tiangolo.com/img/icon-white.svg
favicon: https://fastapi.tiangolo.com/img/favicon.png
language: pl
repo_name: tiangolo/fastapi
repo_url: https://github.com/tiangolo/fastapi
edit_uri: ''
google_analytics:
- UA-133183413-1
- auto
plugins:
- search
- markdownextradata:
data: data
nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
- tr: /tr/
- uk: /uk/
- zh: /zh/
markdown_extensions:
- toc:
permalink: true
- markdown.extensions.codehilite:
guess_lang: false
- markdown_include.include:
base_path: docs
- admonition
- codehilite
- extra
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_div_format ''
- pymdownx.tabbed
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
link: https://www.linkedin.com/in/tiangolo
- icon: fontawesome/brands/dev
link: https://dev.to/tiangolo
- icon: fontawesome/brands/medium
link: https://medium.com/@tiangolo
- icon: fontawesome/solid/globe
link: https://tiangolo.com
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/
name: ru - русский язык
- link: /sq/
name: sq - shqip
- link: /tr/
name: tr - Türkçe
- link: /uk/
name: uk - українська мова
- link: /zh/
name: zh - 汉语
extra_css:
- https://fastapi.tiangolo.com/css/termynal.css
- https://fastapi.tiangolo.com/css/custom.css
extra_javascript:
- https://unpkg.com/mermaid@8.4.6/dist/mermaid.min.js
- https://fastapi.tiangolo.com/js/termynal.js
- https://fastapi.tiangolo.com/js/custom.js

0
docs/pl/overrides/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,511 @@
# Desenvolvimento - Contribuindo
Primeiramente, você deveria ver os meios básicos para [ajudar FastAPI e pedir ajuda](help-fastapi.md){.internal-link target=_blank}.
## Desenvolvendo
Se você já clonou o repositório e precisa mergulhar no código, aqui estão algumas orientações para configurar seu ambiente.
### Ambiente virtual com `venv`
Você pode criar um ambiente virtual em um diretório utilizando o módulo `venv` do Python:
<div class="termy">
```console
$ python -m venv env
```
</div>
Isso criará o diretório `./env/` com os binários Python e então você será capaz de instalar pacotes nesse ambiente isolado.
### Ativar o ambiente
Ative o novo ambiente com:
=== "Linux, macOS"
<div class="termy">
```console
$ source ./env/bin/activate
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ .\env\Scripts\Activate.ps1
```
</div>
=== "Windows Bash"
Ou se você usa Bash para Windows (por exemplo <a href="https://gitforwindows.org/" class="external-link" target="_blank">Git Bash</a>):
<div class="termy">
```console
$ source ./env/Scripts/activate
```
</div>
Para verificar se funcionou, use:
=== "Linux, macOS, Windows Bash"
<div class="termy">
```console
$ which pip
some/directory/fastapi/env/bin/pip
```
</div>
=== "Windows PowerShell"
<div class="termy">
```console
$ Get-Command pip
some/directory/fastapi/env/bin/pip
```
</div>
Se ele exibir o binário `pip` em `env/bin/pip` então funcionou. 🎉
!!! tip
Toda vez que você instalar um novo pacote com `pip` nesse ambiente, ative o ambiente novamente.
Isso garante que se você usar um programa instalado por aquele pacote (como `flit`), você utilizará aquele de seu ambiente local e não outro que possa estar instalado globalmente.
### Flit
**FastAPI** utiliza <a href="https://flit.readthedocs.io/en/latest/index.html" class="external-link" target="_blank">Flit</a> para construir, empacotar e publicar o projeto.
Após ativar o ambiente como descrito acima, instale o `flit`:
<div class="termy">
```console
$ pip install flit
---> 100%
```
</div>
Ative novamente o ambiente para ter certeza que você esteja utilizando o `flit` que você acabou de instalar (e não um global).
E agora use `flit` para instalar as dependências de desenvolvimento:
=== "Linux, macOS"
<div class="termy">
```console
$ flit install --deps develop --symlink
---> 100%
```
</div>
=== "Windows"
Se você está no Windows, use `--pth-file` ao invés de `--symlink`:
<div class="termy">
```console
$ flit install --deps develop --pth-file
---> 100%
```
</div>
Isso irá instalar todas as dependências e seu FastAPI local em seu ambiente local.
#### Usando seu FastAPI local
Se você cria um arquivo Python que importa e usa FastAPI, e roda com Python de seu ambiente local, ele irá utilizar o código fonte de seu FastAPI local.
E se você atualizar o código fonte do FastAPI local, como ele é instalado com `--symlink` (ou `--pth-file` no Windows), quando você rodar aquele arquivo Python novamente, ele irá utilizar a nova versão do FastAPI que você acabou de editar.
Desse modo, você não tem que "instalar" sua versão local para ser capaz de testar cada mudança.
### Formato
Tem um arquivo que você pode rodar que irá formatar e limpar todo o seu código:
<div class="termy">
```console
$ bash scripts/format.sh
```
</div>
Ele irá organizar também todos os seus imports.
Para que ele organize os imports corretamente, você precisa ter o FastAPI instalado localmente em seu ambiente, com o comando na seção acima usando `--symlink` (ou `--pth-file` no Windows).
### Formato dos imports
Tem outro _script_ que formata todos os imports e garante que você não tenha imports não utilizados:
<div class="termy">
```console
$ bash scripts/format-imports.sh
```
</div>
Como ele roda um comando após o outro, modificando e revertendo muitos arquivos, ele demora um pouco para concluir, então pode ser um pouco mais fácil utilizar `scripts/format.sh` frequentemente e `scripts/format-imports.sh` somente após "commitar uma branch".
## Documentação
Primeiro, tenha certeza de configurar seu ambiente como descrito acima, isso irá instalar todas as requisições.
A documentação usa <a href="https://www.mkdocs.org/" class="external-link" target="_blank">MkDocs</a>.
E existem ferramentas/_scripts_ extras para controlar as traduções em `./scripts/docs.py`.
!!! tip
Você não precisa ver o código em `./scripts/docs.py`, você apenas o utiliza na linha de comando.
Toda a documentação está no formato Markdown no diretório `./docs/pt/`.
Muitos dos tutoriais tem blocos de código.
Na maioria dos casos, esse blocos de código são aplicações completas que podem ser rodadas do jeito que estão apresentados.
De fato, esses blocos de código não estão escritos dentro do Markdown, eles são arquivos Python dentro do diretório `./docs_src/`.
E esses arquivos Python são incluídos/injetados na documentação quando se gera o site.
### Testes para Documentação
A maioria dos testes na verdade rodam encima dos arquivos fonte na documentação.
Isso ajuda a garantir:
* Que a documentação esteja atualizada.
* Que os exemplos da documentação possam ser rodadas do jeito que estão apresentadas.
* A maior parte dos recursos é coberta pela documentação, garantida por cobertura de testes.
Durante o desenvolvimento local, existe um _script_ que constrói o site e procura por quaisquer mudanças, carregando na hora:
<div class="termy">
```console
$ python ./scripts/docs.py live
<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes
```
</div>
Isso irá servir a documentação em `http://127.0.0.1:8008`.
Desse jeito, você poderá editar a documentação/arquivos fonte e ver as mudanças na hora.
#### Typer CLI (opcional)
As instruções aqui mostram como utilizar _scripts_ em `./scripts/docs.py` com o programa `python` diretamente.
Mas você pode usar também <a href="https://typer.tiangolo.com/typer-cli/" class="external-link" target="_blank">Typer CLI</a>, e você terá auto-completação para comandos no seu terminal após instalar o _completion_.
Se você instalou Typer CLI, você pode instalar _completion_ com:
<div class="termy">
```console
$ typer --install-completion
zsh completion installed in /home/user/.bashrc.
Completion will take effect once you restart the terminal.
```
</div>
### Aplicações e documentação ao mesmo tempo
Se você rodar os exemplos com, por exemplo:
<div class="termy">
```console
$ uvicorn tutorial001:app --reload
<span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
</div>
como Uvicorn utiliza por padrão a porta `8000`, a documentação na porta `8008` não dará conflito.
### Traduções
Ajuda com traduções É MUITO apreciada! E essa tarefa não pode ser concluída sem a ajuda da comunidade. 🌎 🚀
Aqui estão os passos para ajudar com as traduções.
#### Dicas e orientações
* Verifique sempre os <a href="https://github.com/tiangolo/fastapi/pulls" class="external-link" target="_blank">_pull requests_ existentes</a> para a sua linguagem e faça revisões das alterações e aprove elas.
!!! tip
Você pode <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request" class="external-link" target="_blank">adicionar comentários com sugestões de alterações</a> para _pull requests_ existentes.
Verifique as documentações sobre <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews" class="external-link" target="_blank">adicionar revisão ao _pull request_</a> para aprovação ou solicitação de alterações.
* Verifique em <a href="https://github.com/tiangolo/fastapi/issues" class="external-link" target="_blank">_issues_</a> para ver se existe alguém coordenando traduções para a sua linguagem.
* Adicione um único _pull request_ por página traduzida. Isso tornará muito mais fácil a revisão para as outras pessoas.
Para as linguagens que eu não falo, vou esperar por várias pessoas revisarem a tradução antes de _mergear_.
* Você pode verificar também se há traduções para sua linguagem e adicionar revisão para elas, isso irá me ajudar a saber que a tradução está correta e eu possa _mergear_.
* Utilize os mesmos exemplos Python e somente traduza o texto na documentação. Você não tem que alterar nada no código para que funcione.
* Utilize as mesmas imagens, nomes de arquivo e links. Você não tem que alterar nada disso para que funcione.
* Para verificar o código de duas letras para a linguagem que você quer traduzir, você pode usar a <a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes" class="external-link" target="_blank">Lista de códigos ISO 639-1</a>.
#### Linguagem existente
Vamos dizer que você queira traduzir uma página para uma linguagem que já tenha traduções para algumas páginas, como o Espanhol.
No caso do Espanhol, o código de duas letras é `es`. Então, o diretório para traduções em Espanhol está localizada em `docs/es/`.
!!! tip
A principal ("oficial") linguagem é o Inglês, localizado em `docs/en/`.
Agora rode o _servidor ao vivo_ para as documentações em Espanhol:
<div class="termy">
```console
// Use o comando "live" e passe o código da linguagem como um argumento de linha de comando
$ python ./scripts/docs.py live es
<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
<span style="color: green;">[INFO]</span> Start watching changes
<span style="color: green;">[INFO]</span> Start detecting changes
```
</div>
Agora você pode ir em <a href="http://127.0.0.1:8008" class="external-link" target="_blank">http://127.0.0.1:8008</a> e ver suas mudanças ao vivo.
Se você procurar no site da documentação do FastAPI, você verá que toda linguagem tem todas as páginas. Mas algumas páginas não estão traduzidas e tem notificação sobre a falta da tradução.
Mas quando você rodar localmente como descrito acima, você somente verá as páginas que já estão traduzidas.
Agora vamos dizer que você queira adicionar uma tradução para a seção [Recursos](features.md){.internal-link target=_blank}.
* Copie o arquivo em:
```
docs/en/docs/features.md
```
* Cole ele exatamente no mesmo local mas para a linguagem que você quer traduzir, por exemplo:
```
docs/es/docs/features.md
```
!!! tip
Observe que a única mudança na rota é o código da linguagem, de `en` para `es`.
* Agora abra o arquivo de configuração MkDocs para Inglês em:
```
docs/en/docs/mkdocs.yml
```
* Procure o lugar onde `docs/features.md` está localizado no arquivo de configuração. Algum lugar como:
```YAML hl_lines="8"
site_name: FastAPI
# Mais coisas
nav:
- FastAPI: index.md
- Languages:
- en: /
- es: /es/
- features.md
```
* Abra o arquivo de configuração MkDocs para a linguagem que você está editando, por exemplo:
```
docs/es/docs/mkdocs.yml
```
* Adicione no mesmo local que está no arquivo em Inglês, por exemplo:
```YAML hl_lines="8"
site_name: FastAPI
# Mais coisas
nav:
- FastAPI: index.md
- Languages:
- en: /
- es: /es/
- features.md
```
Tenha certeza que se existem outras entradas, a nova entrada com sua tradução esteja exatamente na mesma ordem como na versão em Inglês.
Se você for no seu navegador verá que agora a documentação mostra sua nova seção. 🎉
Agora você poderá traduzir tudo e ver como está toda vez que salva o arquivo.
#### Nova linguagem
Vamos dizer que você queira adicionar traduções para uma linguagem que ainda não foi traduzida, nem sequer uma página.
Vamos dizer que você queira adicionar tradução para Haitiano, e ainda não tenha na documentação.
Verificando o link acima, o código para "Haitiano" é `ht`.
O próximo passo é rodar o _script_ para gerar um novo diretório de tradução:
<div class="termy">
```console
// Use o comando new-lang, passe o código da linguagem como um argumento de linha de comando
$ python ./scripts/docs.py new-lang ht
Successfully initialized: docs/ht
Updating ht
Updating en
```
</div>
Agora você pode verificar em seu editor de código o mais novo diretório criado `docs/ht/`.
!!! tip
Crie um primeiro _pull request_ com apenas isso, para iniciar a configuração da nova linguagem, antes de adicionar traduções.
Desse modo outros poderão ajudar com outras páginas enquanto você trabalha na primeira. 🚀
Inicie traduzindo a página principal, `docs/ht/index.md`.
Então você pode continuar com as instruções anteriores, para uma "Linguagem Existente".
##### Nova linguagem não suportada
Se quando rodar o _script_ do _servidor ao vivo_ você pega um erro sobre linguagem não suportada, alguma coisa como:
```
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: partials/language/xx.html
```
Isso significa que o tema não suporta essa linguagem (nesse caso, com um código falso de duas letras `xx`).
Mas não se preocupe, você pode configurar o tema de linguagem para Inglês e então traduzir o conteúdo da documentação.
Se você precisar fazer isso, edite o `mkdocs.yml` para sua nova linguagem, teremos algo como:
```YAML hl_lines="5"
site_name: FastAPI
# Mais coisas
theme:
# Mais coisas
language: xx
```
Altere essa linguagem de `xx` (do seu código de linguagem) para `en`.
Então você poderá iniciar novamente o _servidor ao vivo_.
#### Pré-visualize o resultado
Quando você usa o _script_ em `./scripts/docs.py` com o comando `live` ele somente exibe os arquivos e traduções disponíveis para a linguagem atual.
Mas uma vez que você tenha concluído, você poderá testar tudo como se parecesse _online_.
Para fazer isso, primeiro construa toda a documentação:
<div class="termy">
```console
// Use o comando "build-all", isso leverá um tempinho
$ python ./scripts/docs.py build-all
Updating es
Updating en
Building docs for: en
Building docs for: es
Successfully built docs for: es
Copying en index.md to README.md
```
</div>
Isso gera toda a documentação em `./docs_build/` para cada linguagem. Isso inclui a adição de quaisquer arquivos com tradução faltando, com uma nota dizendo que "esse arquivo ainda não tem tradução". Mas você não tem que fazer nada com esse diretório.
Então ele constrói todos aqueles _sites_ independentes MkDocs para cada linguagem, combina eles, e gera a saída final em `./site/`.
Então você poderá "servir" eles com o comando `serve`:
<div class="termy">
```console
// Use o comando "serve" após rodar "build-all"
$ python ./scripts/docs.py serve
Warning: this is a very simple server. For development, use mkdocs serve instead.
This is here only to preview a site with translations already built.
Make sure you run the build-all command first.
Serving at: http://127.0.0.1:8008
```
</div>
## Testes
Tem um _script_ que você pode rodar localmente para testar todo o código e gerar relatórios de cobertura em HTML:
<div class="termy">
```console
$ bash scripts/test-cov-html.sh
```
</div>
Esse comando gera um diretório `./htmlcov/`, se você abrir o arquivo `./htmlcov/index.html` no seu navegador, poderá explorar interativamente as regiões de código que estão cobertas pelos testes, e observar se existe alguma região faltando.
### Testes no seu editor
Se você quer usar os testes integrados em seu editor adicione `./docs_src` na sua variável `PYTHONPATH`.
Por exemplo, no VS Code você pode criar um arquivo `.env` com:
```env
PYTHONPATH=./docs_src
```

View File

@@ -0,0 +1,7 @@
# Implantação - Introdução
A implantação de uma aplicação **FastAPI** é relativamente simples.
Existem várias maneiras para fazer isso, dependendo do seu caso específico e das ferramentas que você utiliza.
Você verá mais detalhes para se ter em mente e algumas das técnicas para a implantação nas próximas seções.

View File

@@ -39,13 +39,16 @@ Os recursos chave são:
<small>* estimativas baseadas em testes realizados com equipe interna de desenvolvimento, construindo aplicações em produção.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -0,0 +1,48 @@
# Corpo - Campos
Da mesma forma que você pode declarar validações adicionais e metadados nos parâmetros de *funções de operações de rota* com `Query`, `Path` e `Body`, você pode declarar validações e metadados dentro de modelos do Pydantic usando `Field` do Pydantic.
## Importe `Field`
Primeiro, você tem que importá-lo:
```Python hl_lines="4"
{!../../../docs_src/body_fields/tutorial001.py!}
```
!!! warning "Aviso"
Note que `Field` é importado diretamente do `pydantic`, não do `fastapi` como todo o resto (`Query`, `Path`, `Body`, etc).
## Declare atributos do modelo
Você pode então utilizar `Field` com atributos do modelo:
```Python hl_lines="11-14"
{!../../../docs_src/body_fields/tutorial001.py!}
```
`Field` funciona da mesma forma que `Query`, `Path` e `Body`, ele possui todos os mesmos parâmetros, etc.
!!! note "Detalhes técnicos"
Na realidade, `Query`, `Path` e outros que você verá em seguida, criam objetos de subclasses de uma classe `Param` comum, que é ela mesma uma subclasse da classe `FieldInfo` do Pydantic.
E `Field` do Pydantic retorna uma instância de `FieldInfo` também.
`Body` também retorna objetos de uma subclasse de `FieldInfo` diretamente. E tem outras que você verá mais tarde que são subclasses da classe `Body`.
Lembre-se que quando você importa `Query`, `Path`, e outros de `fastapi`, esse são na realidade funções que retornam classes especiais.
!!! tip "Dica"
Note como cada atributo do modelo com um tipo, valor padrão e `Field` possuem a mesma estrutura que parâmetros de *funções de operações de rota*, com `Field` ao invés de `Path`, `Query` e `Body`.
## Adicione informações extras
Você pode declarar informação extra em `Field`, `Query`, `Body`, etc. E isso será incluído no JSON Schema gerado.
Você irá aprender mais sobre adicionar informações extras posteriormente nessa documentação, quando estiver aprendendo a declarar exemplos.
## Recapitulando
Você pode usar `Field` do Pydantic para declarar validações extras e metadados para atributos do modelo.
Você também pode usar os argumentos de palavras-chave extras para passar metadados do JSON Schema adicionais.

View File

@@ -0,0 +1,101 @@
# Introdução à segurança
Há várias formas de lidar segurança, autenticação e autorização.
E isso normalmente é um tópico “difícil” e complexo.
Em muitos frameworks e sistemas, apenas lidar com segurança e autenticação exige muito esforço e código (em muitos casos isso pode ser 50% ou mais de todo o código escrito).
**FastAPI** tem muitas ferramentas para ajudar você com a parte de **Segurança** facilmente, rapidamente, de uma forma padrão, sem ter que estudar e aprender tudo sobre especificações de segurança.
Mas primeiro, vamos verificar alguns pequenos conceitos.
## Está com pressa?
Se você não se importa com qualquer um desses termos e só precisa adicionar segurança com autenticação baseada em usuário e senha _agora_, pule para os próximos capítulos.
## OAuth2
OAuth2 é uma especificação que define várias formas para lidar com autenticação e autorização.
Ela é bastante extensiva na especificação e cobre casos de uso muito complexos.
Ela inclui uma forma para autenticação usando “third party”/aplicações de terceiros.
Isso é o que todos os sistemas com “Login with Facebook, Google, Twitter, GitHub” usam por baixo.
### OAuth 1
Havia um OAuth 1, que é bem diferente do OAuth2, e mais complexo, isso incluía diretamente as especificações de como criptografar a comunicação.
Não é muito popular ou usado nos dias atuais.
OAuth2 não especifica como criptografar a comunicação, ele espera que você tenha sua aplicação em um servidor HTTPS.
!!! tip "Dica"
Na seção sobre **deployment** você irá ver como configurar HTTPS de modo gratuito, usando Traefik e Lets Encrypt.
## OpenID Connect
OpenID Connect é outra especificação, baseada em **OAuth2**.
Ela é apenas uma extensão do OAuth2 especificando algumas coisas que são relativamente ambíguas no OAuth2, para tentar torná-lo mais interoperável.
Por exemplo, o login do Google usa OpenID Connect (que por baixo dos panos usa OAuth2).
Mas o login do Facebook não tem suporte para OpenID Connect. Ele tem a própria implementação do OAuth2.
### OpenID (não "OpenID Connect")
Houve também uma especificação “OpenID”. Ela tentou resolver a mesma coisa que a **OpenID Connect**, mas não baseada em OAuth2.
Então, ela foi um sistema adicional completo.
Ela não é muito popular ou usada nos dias de hoje.
## OpenAPI
OpenAPI (anteriormente conhecido como Swagger) é a especificação aberta para a criação de APIs (agora parte da Linux Foundation).
**FastAPI** é baseado no **OpenAPI**.
Isso é o que torna possível ter múltiplas automações interativas de interfaces de documentação, geração de código, etc.
OpenAPI tem uma forma para definir múltiplos “esquemas” de segurança.
Por usá-los, você pode ter vantagens de todas essas ferramentas baseadas nos padrões, incluindo os sistemas de documentação interativa.
OpenAPI define os seguintes esquemas de segurança:
* `apiKey`: uma chave específica de aplicação que pode vir de:
* Um parâmetro query.
* Um header.
* Um cookie.
* `http`: padrão HTTP de sistemas autenticação, incluindo:
* `bearer`: um header de `Authorization` com valor de `Bearer` adicionado de um token. Isso é herança do OAuth2.
* HTTP Basic authentication.
* HTTP Digest, etc.
* `oauth2`: todas as formas do OAuth2 para lidar com segurança (chamados "fluxos").
* Vários desses fluxos são apropriados para construir um provedor de autenticação OAuth2 (como Google, Facebook, Twitter, GitHub, etc):
* `implicit`
* `clientCredentials`
* `authorizationCode`
* Mas existe um “fluxo” específico que pode ser perfeitamente usado para resolver autenticação diretamente na mesma aplicação:
* `password`: alguns dos próximos capítulos tratarão disso.
* `openIdConnect`: tem uma forma para definir como descobrir automaticamente o dado da autenticação OAuth2.
* Essa descoberta automática é o que é definido na especificação OpenID Connect.
!!! tip "Dica"
Integração com outros provedores de autenticação/autorização como Google, Facebook, Twitter, GitHub, etc. é bem possível e relativamente fácil.
O problema mais complexo é criar um provedor de autenticação/autorização como eles, mas o FastAPI dá a você ferramentas para fazer isso facilmente, enquanto faz o trabalho pesado para você.
## **FastAPI** utilitários
**FastAPI** fornece várias ferramentas para cada um desses esquemas de segurança no módulo `fastapi.security` que simplesmente usa esses mecanismos de segurança.
Nos próximos capítulos você irá ver como adicionar segurança à sua API usando essas ferramentas disponibilizadas pelo **FastAPI**.
E você irá ver também como isso é automaticamente integrado dentro do sistema de documentação interativo.

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -54,6 +57,11 @@ nav:
- Tutorial - Guia de Usuário:
- tutorial/index.md
- tutorial/first-steps.md
- tutorial/body-fields.md
- Segurança:
- tutorial/security/index.md
- Implantação:
- deployment/index.md
- alternatives.md
- history-design-future.md
- external-links.md
@@ -77,7 +85,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -91,16 +101,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

View File

@@ -44,13 +44,16 @@ The key features are:
<small>* estimation based on tests on an internal development team, building production applications.</small>
## Gold Sponsors
## Sponsors
<!-- sponsors -->
{% if sponsors %}
{% for sponsor in sponsors.gold -%}
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a>
<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 %}

View File

@@ -39,11 +39,14 @@ nav:
- FastAPI: index.md
- Languages:
- en: /
- de: /de/
- es: /es/
- fr: /fr/
- id: /id/
- it: /it/
- ja: /ja/
- ko: /ko/
- pl: /pl/
- pt: /pt/
- ru: /ru/
- sq: /sq/
@@ -69,7 +72,9 @@ markdown_extensions:
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/tiangolo/typer
link: https://github.com/tiangolo/fastapi
- icon: fontawesome/brands/discord
link: https://discord.gg/VQjSZaeJmf
- icon: fontawesome/brands/twitter
link: https://twitter.com/tiangolo
- icon: fontawesome/brands/linkedin
@@ -83,16 +88,22 @@ extra:
alternate:
- link: /
name: en - English
- link: /de/
name: de
- link: /es/
name: es - español
- link: /fr/
name: fr - français
- link: /id/
name: id
- link: /it/
name: it - italiano
- link: /ja/
name: ja - 日本語
- link: /ko/
name: ko - 한국어
- link: /pl/
name: pl
- link: /pt/
name: pt - português
- link: /ru/

Some files were not shown because too many files have changed in this diff Show More