Compare commits

...

20 Commits

Author SHA1 Message Date
Sebastián Ramírez
2aaac141dd 🔖 Release version 0.77.1 2022-05-09 23:19:32 -05:00
Sebastián Ramírez
03cbdd4f74 📝 Update release notes 2022-05-09 23:18:03 -05:00
github-actions
a7e659e472 📝 Update release notes 2022-05-10 04:12:55 +00:00
Maciej Kaczkowski
350745c545 🌐 Add Polish translation for docs/pl/docs/tutorial/index.md (#4516)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 04:12:18 +00:00
github-actions
d0e4015034 📝 Update release notes 2022-05-10 04:08:22 +00:00
Mohammad Raisul ISlam
b1e691091d ✏ Fix typo in deployment (#4629)
Co-authored-by: raisul1234 <raisul.islam@myalice.ai>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 04:07:45 +00:00
github-actions
9b4e6751bb 📝 Update release notes 2022-05-10 04:06:19 +00:00
github-actions
8082b45f24 📝 Update release notes 2022-05-10 04:05:48 +00:00
Mateus José
86c459d1e8 🌐 Add Portuguese translation for docs/pt/docs/help-fastapi.md (#4583)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 04:05:45 +00:00
Felix Schürmeyer
2a91ee945d 📝 Add link to german article: REST-API Programmieren mittels Python und dem FastAPI Modul (#4624)
A beginner article in German to get started with the FastAPI with a small Todo API as an example.

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 04:05:10 +00:00
github-actions
764703cc56 📝 Update release notes 2022-05-10 04:03:35 +00:00
Sebastián Ramírez
71ea5883cd 🔧 Add notifications in issue for Uzbek translations (#4884) 2022-05-10 04:02:55 +00:00
github-actions
cc51b251dd 📝 Update release notes 2022-05-10 03:35:53 +00:00
Kiko Ilievski
6337186ff4 ✏ Fix small typo in docs/en/docs/tutorial/security/first-steps.md (#4515)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 03:35:21 +00:00
github-actions
88606940f5 📝 Update release notes 2022-05-10 03:34:23 +00:00
Mukul Mantosh
98bb5480a5 📝 Add external link: PyCharm Guide to FastAPI (#4512)
Co-authored-by: Mukul Mantosh <Mukul.Mantosh@in.bosch.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 03:33:51 +00:00
github-actions
170123a41f 📝 Update release notes 2022-05-10 03:32:54 +00:00
Yashasvi Singh
9262a699f2 📝 Add external link to article: Building an API with FastAPI and Supabase and Deploying on Deta (#4440)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 03:32:21 +00:00
github-actions
9a87c6d8d2 📝 Update release notes 2022-05-10 03:23:03 +00:00
Marcelo Trylesinski
f396912043 ⬆ Upgrade Starlette from 0.19.0 to 0.19.1 (#4819)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-05-10 03:22:26 +00:00
14 changed files with 292 additions and 18 deletions

View File

@@ -14,3 +14,4 @@ de: 3716
id: 3717
az: 3994
nl: 4701
uz: 4883

View File

@@ -32,6 +32,10 @@ articles:
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: Yashasvi Singh
author_link: https://hashnode.com/@aUnicornDev
link: https://aunicorndev.hashnode.dev/series/supafast-api
title: "Building an API with FastAPI and Supabase and Deploying on Deta"
- 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/
@@ -200,11 +204,19 @@ articles:
author_link: https://medium.com/@williamhayes
link: https://medium.com/@williamhayes/fastapi-starlette-debug-vs-prod-5f7561db3a59
title: FastAPI/Starlette debug vs prod
- author: Mukul Mantosh
author_link: https://twitter.com/MantoshMukul
link: https://www.jetbrains.com/pycharm/guide/tutorials/fastapi-aws-kubernetes/
title: Developing FastAPI Application using K8s & AWS
german:
- 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
- author: Felix Schürmeyer
author_link: https://hellocoding.de/autor/felix-schuermeyer/
link: https://hellocoding.de/blog/coding-language/python/fastapi
title: REST-API Programmieren mittels Python und dem FastAPI Modul
japanese:
- author: '@bee2'
author_link: https://qiita.com/bee2

View File

@@ -59,7 +59,7 @@ You can install an ASGI compatible server with:
## Run the Server Program
You can then your application the same way you have done in the tutorials, but without the `--reload` option, e.g.:
You can then run your application the same way you have done in the tutorials, but without the `--reload` option, e.g.:
=== "Uvicorn"

View File

@@ -3,6 +3,29 @@
## Latest Changes
## 0.77.1
### Upgrades
* ⬆ Upgrade Starlette from 0.19.0 to 0.19.1. PR [#4819](https://github.com/tiangolo/fastapi/pull/4819) by [@Kludex](https://github.com/Kludex).
### Docs
* 📝 Add link to german article: REST-API Programmieren mittels Python und dem FastAPI Modul. PR [#4624](https://github.com/tiangolo/fastapi/pull/4624) by [@fschuermeyer](https://github.com/fschuermeyer).
* 📝 Add external link: PyCharm Guide to FastAPI. PR [#4512](https://github.com/tiangolo/fastapi/pull/4512) by [@mukulmantosh](https://github.com/mukulmantosh).
* 📝 Add external link to article: Building an API with FastAPI and Supabase and Deploying on Deta. PR [#4440](https://github.com/tiangolo/fastapi/pull/4440) by [@aUnicornDev](https://github.com/aUnicornDev).
* ✏ Fix small typo in `docs/en/docs/tutorial/security/first-steps.md`. PR [#4515](https://github.com/tiangolo/fastapi/pull/4515) by [@KikoIlievski](https://github.com/KikoIlievski).
### Translations
* 🌐 Add Polish translation for `docs/pl/docs/tutorial/index.md`. PR [#4516](https://github.com/tiangolo/fastapi/pull/4516) by [@MKaczkow](https://github.com/MKaczkow).
* ✏ Fix typo in deployment. PR [#4629](https://github.com/tiangolo/fastapi/pull/4629) by [@raisulislam541](https://github.com/raisulislam541).
* 🌐 Add Portuguese translation for `docs/pt/docs/help-fastapi.md`. PR [#4583](https://github.com/tiangolo/fastapi/pull/4583) by [@mateusjs](https://github.com/mateusjs).
### Internal
* 🔧 Add notifications in issue for Uzbek translations. PR [#4884](https://github.com/tiangolo/fastapi/pull/4884) by [@tiangolo](https://github.com/tiangolo).
## 0.77.0
### Upgrades

View File

@@ -121,7 +121,7 @@ When we create an instance of the `OAuth2PasswordBearer` class we pass in the `t
```
!!! tip
here `tokenUrl="token"` refers to a relative URL `token` that we haven't created yet. As it's a relative URL, it's equivalent to `./token`.
Here `tokenUrl="token"` refers to a relative URL `token` that we haven't created yet. As it's a relative URL, it's equivalent to `./token`.
Because we are using a relative URL, if your API was located at `https://example.com/`, then it would refer to `https://example.com/token`. But if your API was located at `https://example.com/api/v1/`, then it would refer to `https://example.com/api/v1/token`.

View File

@@ -0,0 +1,81 @@
# Samouczek - Wprowadzenie
Ten samouczek pokaże Ci, krok po kroku, jak używać większości funkcji **FastAPI**.
Każda część korzysta z poprzednich, ale jest jednocześnie osobnym tematem. Możesz przejść bezpośrednio do każdego rozdziału, jeśli szukasz rozwiązania konkretnego problemu.
Samouczek jest tak zbudowany, żeby służył jako punkt odniesienia w przyszłości.
Możesz wracać i sprawdzać dokładnie to czego potrzebujesz.
## Wykonywanie kodu
Wszystkie fragmenty kodu mogą być skopiowane bezpośrednio i użyte (są poprawnymi i przetestowanymi plikami).
Żeby wykonać każdy przykład skopiuj kod to pliku `main.py` i uruchom `uvicorn` za pomocą:
<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>
**BARDZO zalecamy** pisanie bądź kopiowanie kodu, edycję, a następnie wykonywanie go lokalnie.
Użycie w Twoim edytorze jest tym, co pokazuje prawdziwe korzyści z FastAPI, pozwala zobaczyć jak mało kodu musisz napisać, wszystkie funkcje, takie jak kontrola typów, <abbr title="auto-complete, autocompletion, IntelliSense">automatyczne uzupełnianie</abbr>, itd.
---
## Instalacja FastAPI
Jako pierwszy krok zainstaluj FastAPI.
Na potrzeby samouczka możesz zainstalować również wszystkie opcjonalne biblioteki:
<div class="termy">
```console
$ pip install "fastapi[all]"
---> 100%
```
</div>
...wliczając w to `uvicorn`, który będzie służył jako serwer wykonujacy Twój kod.
!!! note
Możesz również wykonać instalację "krok po kroku".
Prawdopodobnie zechcesz to zrobić, kiedy będziesz wdrażać swoją aplikację w środowisku produkcyjnym:
```
pip install fastapi
```
Zainstaluj też `uvicorn`, który będzie służył jako serwer:
```
pip install "uvicorn[standard]"
```
Tak samo możesz zainstalować wszystkie dodatkowe biblioteki, których chcesz użyć.
## Zaawansowany poradnik
Jest też **Zaawansowany poradnik**, który możesz przeczytać po lekturze tego **Samouczka**.
**Zaawansowany poradnik** opiera się na tym samouczku, używa tych samych pojęć, żeby pokazać Ci kilka dodatkowych funkcji.
Najpierw jednak powinieneś przeczytać **Samouczek** (czytasz go teraz).
Ten rozdział jest zaprojektowany tak, że możesz stworzyć kompletną aplikację używając tylko informacji tutaj zawartych, a następnie rozszerzać ją na różne sposoby, w zależności od potrzeb, używając kilku dodatkowych pomysłów z **Zaawansowanego poradnika**.

View File

@@ -54,6 +54,8 @@ nav:
- tr: /tr/
- uk: /uk/
- zh: /zh/
- Samouczek:
- tutorial/index.md
markdown_extensions:
- toc:
permalink: true

View File

@@ -0,0 +1,148 @@
# Ajuda FastAPI - Obter Ajuda
Você gosta do **FastAPI**?
Você gostaria de ajudar o FastAPI, outros usários, e o autor?
Ou você gostaria de obter ajuda relacionada ao **FastAPI**??
Existem métodos muito simples de ajudar (A maioria das ajudas podem ser feitas com um ou dois cliques).
E também existem vários modos de se conseguir ajuda.
## Inscreva-se na newsletter
Você pode se inscrever (pouco frequente) [**FastAPI e amigos** newsletter](/newsletter/){.internal-link target=_blank} para receber atualizações:
* Notícias sobre FastAPI e amigos 🚀
* Tutoriais 📝
* Recursos ✨
* Mudanças de última hora 🚨
* Truques e dicas ✅
## Siga o FastAPI no twitter
<a href="https://twitter.com/fastapi" class="external-link" target="_blank">Siga @fastapi no **Twitter**</a> para receber as últimas notícias sobre o **FastAPI**. 🐦
## Favorite o **FastAPI** no GitHub
Você pode "favoritar" o FastAPI no GitHub (clicando na estrela no canto superior direito): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. ⭐️
Favoritando, outros usuários poderão encontrar mais facilmente e verão que já foi útil para muita gente.
## Acompanhe novos updates no repositorio do GitHub
Você pode "acompanhar" (watch) o FastAPI no GitHub (clicando no botão com um "olho" no canto superior direito): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. 👀
Podendo selecionar apenas "Novos Updates".
Fazendo isto, serão enviadas notificações (em seu email) sempre que tiver novos updates (uma nova versão) com correções de bugs e novos recursos no **FastAPI**
## Conect-se com o autor
Você pode se conectar <a href="https://tiangolo.com" class="external-link" target="_blank">comigo (Sebastián Ramírez / `tiangolo`)</a>, o autor.
Você pode:
* <a href="https://github.com/tiangolo" class="external-link" target="_blank">Me siga no **GitHub**</a>.
* Ver também outros projetos Open Source criados por mim que podem te ajudar.
* Me seguir para saber quando um novo projeto Open Source for criado.
* <a href="https://twitter.com/tiangolo" class="external-link" target="_blank">Me siga no **Twitter**</a>.
* Me dizer o motivo pelo o qual você está usando o FastAPI(Adoro ouvir esse tipo de comentário).
* Saber quando eu soltar novos anúncios ou novas ferramentas.
* Também é possivel <a href="https://twitter.com/fastapi" class="external-link" target="_blank">seguir o @fastapi no Twitter</a> (uma conta aparte).
* <a href="https://www.linkedin.com/in/tiangolo/" class="external-link" target="_blank">Conect-se comigo no **Linkedin**</a>.
* Saber quando eu fizer novos anúncios ou novas ferramentas (apesar de que uso o twitter com mais frequência 🤷‍♂).
* Ler meus artigos (ou me seguir) no <a href="https://dev.to/tiangolo" class="external-link" target="_blank">**Dev.to**</a> ou no <a href="https://medium.com/@tiangolo" class="external-link" target="_blank">**Medium**</a>.
* Ficar por dentro de novas ideias, artigos, e ferramentas criadas por mim.
* Me siga para saber quando eu publicar algo novo.
## Tweete sobre **FastAPI**
<a href="https://twitter.com/compose/tweet?text=I'm loving @fastapi because... https://github.com/tiangolo/fastapi" class="external-link" target="_blank">Tweete sobre o **FastAPI**</a> e compartilhe comigo e com os outros o porque de gostar do FastAPI. 🎉
Adoro ouvir sobre como o **FastAPI** é usado, o que você gosta nele, em qual projeto/empresa está sendo usado, etc.
## Vote no FastAPI
* <a href="https://www.slant.co/options/34241/~fastapi-review" class="external-link" target="_blank">Vote no **FastAPI** no Slant</a>.
* <a href="https://alternativeto.net/software/fastapi/" class="external-link" target="_blank">Vote no **FastAPI** no AlternativeTo</a>.
## Responda perguntas no GitHub
Você pode acompanhar as <a href="https://github.com/tiangolo/fastapi/issues" class="external-link" target="_blank">perguntas existentes</a> e tentar ajudar outros, . 🤓
Ajudando a responder as questões de varias pessoas, você pode se tornar um [Expert em FastAPI](fastapi-people.md#experts){.internal-link target=_blank} oficial. 🎉
## Acompanhe o repositório do GitHub
Você pode "acompanhar" (watch) o FastAPI no GitHub (clicando no "olho" no canto superior direito): <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">https://github.com/tiangolo/fastapi</a>. 👀
Se você selecionar "Acompanhando" (Watching) em vez de "Apenas Lançamentos" (Releases only) você receberá notificações quando alguém tiver uma nova pergunta.
Assim podendo tentar ajudar a resolver essas questões.
## Faça perguntas
É possível <a href="https://github.com/tiangolo/fastapi/issues/new/choose" class="external-link" target="_blank">criar uma nova pergunta</a> no repositório do GitHub, por exemplo:
* Faça uma **pergunta** ou pergunte sobre um **problema**.
* Sugira novos **recursos**.
**Nota**: Se você fizer uma pergunta, então eu gostaria de pedir que você também ajude os outros com suas respectivas perguntas. 😉
## Crie um Pull Request
É possível [contribuir](contributing.md){.internal-link target=_blank} no código fonte fazendo Pull Requests, por exemplo:
* Para corrigir um erro de digitação que você encontrou na documentação.
* Para compartilhar um artigo, video, ou podcast criados por você sobre o FastAPI <a href="https://github.com/tiangolo/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">editando este arquivo</a>.
* Não se esqueça de adicionar o link no começo da seção correspondente.
* Para ajudar [traduzir a documentação](contributing.md#translations){.internal-link target=_blank} para sua lingua.
* Também é possivel revisar as traduções já existentes.
* Para propor novas seções na documentação.
* Para corrigir um bug/questão.
* Para adicionar um novo recurso.
## Entre no chat
Entre no 👥 <a href="https://discord.gg/VQjSZaeJmf" class="external-link" target="_blank">server de conversa do Discord</a> 👥 e conheça novas pessoas da comunidade
do FastAPI.
!!! dica
Para perguntas, pergunte nas <a href="https://github.com/tiangolo/fastapi/issues/new/choose" class="external-link" target="_blank">questões do GitHub</a>, lá tem um chance maior de você ser ajudado sobre o FastAPI [FastAPI Experts](fastapi-people.md#experts){.internal-link target=_blank}.
Use o chat apenas para outro tipo de assunto.
Também existe o <a href="https://gitter.im/tiangolo/fastapi" class="external-link" target="_blank">chat do Gitter</a>, porém ele não possuí canais e recursos avançados, conversas são mais engessadas, por isso o Discord é mais recomendado.
### Não faça perguntas no chat
Tenha em mente que os chats permitem uma "conversa mais livre", dessa forma é muito fácil fazer perguntas que são muito genéricas e dificeís de responder, assim você pode acabar não sendo respondido.
Nas questões do GitHub o template irá te guiar para que você faça a sua pergunta de um jeito mais correto, fazendo com que você receba respostas mais completas, e até mesmo que você mesmo resolva o problema antes de perguntar. E no GitHub eu garanto que sempre irei responder todas as perguntas, mesmo que leve um tempo. Eu pessoalmente não consigo fazer isso via chat. 😅
Conversas no chat não são tão fáceis de serem encontrados quanto no GitHub, então questões e respostas podem se perder dentro da conversa. E apenas as que estão nas questões do GitHub contam para você se tornar um [Expert em FastAPI](fastapi-people.md#experts){.internal-link target=_blank}, então você receberá mais atenção nas questões do GitHub.
Por outro lado, existem milhares de usuários no chat, então tem uma grande chance de você encontrar alguém para trocar uma idéia por lá em qualquer horário. 😄
## Patrocine o autor
Você também pode ajudar o autor financeiramente (eu) através do <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub sponsors</a>.
Lá você pode me pagar um cafézinho ☕️ como agradecimento. 😄
E você também pode se tornar um patrocinador Prata ou Ouro do FastAPI. 🏅🎉
## Patrocine as ferramente que potencializam o FastAPI
Como você viu na documentação, o FastAPI se apoia em nos gigantes, Starlette e Pydantic.
Patrocine também:
* <a href="https://github.com/sponsors/samuelcolvin" class="external-link" target="_blank">Samuel Colvin (Pydantic)</a>
* <a href="https://github.com/sponsors/encode" class="external-link" target="_blank">Encode (Starlette, Uvicorn)</a>
---
Muito Obrigado! 🚀

View File

@@ -78,6 +78,7 @@ nav:
- history-design-future.md
- external-links.md
- benchmarks.md
- help-fastapi.md
markdown_extensions:
- toc:
permalink: true

View File

@@ -1,6 +1,6 @@
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.77.0"
__version__ = "0.77.1"
from starlette import status as status

View File

@@ -1,5 +1,16 @@
from enum import Enum
from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Type, Union
from typing import (
Any,
Awaitable,
Callable,
Coroutine,
Dict,
List,
Optional,
Sequence,
Type,
Union,
)
from fastapi import routing
from fastapi.datastructures import Default, DefaultPlaceholder
@@ -121,11 +132,8 @@ class FastAPI(Starlette):
generate_unique_id_function=generate_unique_id_function,
)
self.exception_handlers: Dict[
Union[int, Type[Exception]],
Callable[[Request, Any], Coroutine[Any, Any, Response]],
] = (
{} if exception_handlers is None else dict(exception_handlers)
)
Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]]
] = ({} if exception_handlers is None else dict(exception_handlers))
self.exception_handlers.setdefault(HTTPException, http_exception_handler)
self.exception_handlers.setdefault(
RequestValidationError, request_validation_exception_handler

View File

@@ -12,9 +12,7 @@ class HTTPException(StarletteHTTPException):
detail: Any = None,
headers: Optional[Dict[str, Any]] = None,
) -> None:
super().__init__(
status_code=status_code, detail=detail, headers=headers # type: ignore
)
super().__init__(status_code=status_code, detail=detail, headers=headers)
RequestErrorModel: Type[BaseModel] = create_model("Request")

View File

@@ -478,11 +478,11 @@ class APIRouter(routing.Router):
),
) -> None:
super().__init__(
routes=routes, # type: ignore # in Starlette
routes=routes,
redirect_slashes=redirect_slashes,
default=default, # type: ignore # in Starlette
on_startup=on_startup, # type: ignore # in Starlette
on_shutdown=on_shutdown, # type: ignore # in Starlette
default=default,
on_startup=on_startup,
on_shutdown=on_shutdown,
)
if prefix:
assert prefix.startswith("/"), "A path prefix must start with '/'"
@@ -757,7 +757,7 @@ class APIRouter(routing.Router):
generate_unique_id_function=current_generate_unique_id,
)
elif isinstance(route, routing.Route):
methods = list(route.methods or []) # type: ignore # in Starlette
methods = list(route.methods or [])
self.add_route(
prefix + route.path,
route.endpoint,

View File

@@ -35,7 +35,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
requires = [
"starlette==0.19.0",
"starlette==0.19.1",
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
]
description-file = "README.md"