committed by
GitHub
205 changed files with 3473 additions and 4548 deletions
@ -0,0 +1,34 @@ |
|||
docs: |
|||
- all: |
|||
- changed-files: |
|||
- any-glob-to-any-file: |
|||
- docs/en/docs/** |
|||
- docs_src/** |
|||
- all-globs-to-all-files: |
|||
- '!fastapi/**' |
|||
- '!pyproject.toml' |
|||
|
|||
lang-all: |
|||
- all: |
|||
- changed-files: |
|||
- any-glob-to-any-file: |
|||
- docs/*/docs/** |
|||
- all-globs-to-all-files: |
|||
- '!docs/en/docs/**' |
|||
- '!fastapi/**' |
|||
- '!pyproject.toml' |
|||
|
|||
internal: |
|||
- all: |
|||
- changed-files: |
|||
- any-glob-to-any-file: |
|||
- .github/** |
|||
- scripts/** |
|||
- .gitignore |
|||
- .pre-commit-config.yaml |
|||
- pdm_build.py |
|||
- requirements*.txt |
|||
- all-globs-to-all-files: |
|||
- '!docs/*/docs/**' |
|||
- '!fastapi/**' |
|||
- '!pyproject.toml' |
@ -0,0 +1,18 @@ |
|||
name: Add to Project |
|||
|
|||
on: |
|||
pull_request_target: |
|||
issues: |
|||
types: |
|||
- opened |
|||
- reopened |
|||
|
|||
jobs: |
|||
add-to-project: |
|||
name: Add to project |
|||
runs-on: ubuntu-latest |
|||
steps: |
|||
- uses: actions/add-to-project@v1.0.2 |
|||
with: |
|||
project-url: https://github.com/orgs/fastapi/projects/2 |
|||
github-token: ${{ secrets.PROJECTS_TOKEN }} |
@ -0,0 +1,31 @@ |
|||
name: Labels |
|||
on: |
|||
pull_request_target: |
|||
types: |
|||
- opened |
|||
- synchronize |
|||
- reopened |
|||
# For label-checker |
|||
- labeled |
|||
- unlabeled |
|||
|
|||
jobs: |
|||
labeler: |
|||
permissions: |
|||
contents: read |
|||
pull-requests: write |
|||
runs-on: ubuntu-latest |
|||
steps: |
|||
- uses: actions/labeler@v5 |
|||
# Run this after labeler applied labels |
|||
check-labels: |
|||
needs: |
|||
- labeler |
|||
permissions: |
|||
pull-requests: read |
|||
runs-on: ubuntu-latest |
|||
steps: |
|||
- uses: docker://agilepathway/pull-request-label-checker:latest |
|||
with: |
|||
one_of: breaking,security,feature,bug,refactor,upgrade,docs,lang-all,internal |
|||
repo_token: ${{ secrets.GITHUB_TOKEN }} |
@ -1,185 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI İnsanlar |
|||
|
|||
FastAPI-ın bütün mənşəli insanları qəbul edən heyrətamiz icması var. |
|||
|
|||
|
|||
|
|||
## Yaradıcı - İcraçı |
|||
|
|||
Salam! 👋 |
|||
|
|||
Bu mənəm: |
|||
|
|||
{% 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">Cavablar: {{ user.answers }}</div><div class="count">Pull Request-lər: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Mən **FastAPI**-ın yaradıcısı və icraçısıyam. Əlavə məlumat almaq üçün [Yardım FastAPI - Yardım alın - Müəlliflə əlaqə qurun](help-fastapi.md#connect-with-the-author){.internal-link target=_blank} səhifəsinə baxa bilərsiniz. |
|||
|
|||
...Burada isə sizə icmanı göstərmək istəyirəm. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** icmadan çoxlu dəstək alır və mən onların əməyini vurğulamaq istəyirəm. |
|||
|
|||
Bu insanlar: |
|||
|
|||
* [GitHub-da başqalarının suallarına kömək edirlər](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank}. |
|||
* [Pull Request-lər yaradırlar](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
* Pull Request-ləri ([xüsusilə tərcümələr üçün vacib olan](contributing.md#translations){.internal-link target=_blank}.) nəzərdən keçirirlər. |
|||
|
|||
Bu insanlara təşəkkür edirəm. 👏 🙇 |
|||
|
|||
## Keçən ayın ən fəal istifadəçiləri |
|||
|
|||
Bu istifadəçilər keçən ay [GitHub-da başqalarının suallarına](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} ən çox kömək edənlərdir. ☕ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">Cavablandırılmış suallar: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Mütəxəssislər |
|||
|
|||
Burada **FastAPI Mütəxəssisləri** var. 🤓 |
|||
|
|||
Bu istifadəçilər indiyə qədər [GitHub-da başqalarının suallarına](help-fastapi.md#help-others-with-questions-in-github){.internal-link target=_blank} ən çox kömək edənlərdir. |
|||
|
|||
Onlar bir çox insanlara kömək edərək mütəxəssis olduqlarını sübut ediblər. ✨ |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">Cavablandırılmış suallar: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Ən yaxşı əməkdaşlar |
|||
|
|||
Burada **Ən yaxşı əməkdaşlar** var. 👷 |
|||
|
|||
Bu istifadəçilərin ən çox *birləşdirilmiş* [Pull Request-ləri var](help-fastapi.md#create-a-pull-request){.internal-link target=_blank}. |
|||
|
|||
Onlar mənbə kodu, sənədləmə, tərcümələr və s. barədə əmək göstərmişlər. 📦 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">Pull Request-lər: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
Bundan başqa bir neçə (yüzdən çox) əməkdaş var ki, onları <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Əməkdaşlar səhifəsində</a> görə bilərsiniz. 👷 |
|||
|
|||
## Ən çox rəy verənlər |
|||
|
|||
Bu istifadəçilər **ən çox rəy verənlər**dir. |
|||
|
|||
### Tərcümələr üçün rəylər |
|||
|
|||
Mən yalnız bir neçə dildə danışıram (və çox da yaxşı deyil 😅). Bu səbəbdən, rəy verənlər sənədlərin [**tərcümələrini təsdiqləmək üçün gücə malik olanlar**](contributing.md#translations){.internal-link target=_blank}dır. Onlar olmadan, bir çox dilə tərcümə olunmuş sənədlər olmazdı. |
|||
|
|||
--- |
|||
|
|||
Başqalarının Pull Request-lərinə **Ən çox rəy verənlər** 🕵️ kodun, sənədlərin və xüsusilə də **tərcümələrin** keyfiyyətini təmin edirlər. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">Rəylər: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Sponsorlar |
|||
|
|||
Bunlar **Sponsorlar**dır. 😎 |
|||
|
|||
Onlar mənim **FastAPI** (və digər) işlərimi əsasən <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub Sponsorlar</a> vasitəsilə dəstəkləyirlər. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### Qızıl Sponsorlar |
|||
|
|||
{% 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 %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### Gümüş Sponsorlar |
|||
|
|||
{% 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 %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### Bürünc Sponsorlar |
|||
|
|||
{% 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 %} |
|||
|
|||
{% endif %} |
|||
|
|||
### Fərdi Sponsorlar |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## Məlumatlar haqqında - texniki detallar |
|||
|
|||
Bu səhifənin əsas məqsədi, icmanın başqalarına kömək etmək üçün göstərdiyi əməyi vurğulamaqdır. |
|||
|
|||
Xüsusilə də normalda daha az görünən və bir çox hallarda daha çətin olan, başqalarının suallarına kömək etmək və tərcümələrlə bağlı Pull Request-lərə rəy vermək kimi səy göstərmək. |
|||
|
|||
Bu səhifənin məlumatları hər ay hesablanır və siz <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">buradan mənbə kodunu</a> oxuya bilərsiniz. |
|||
|
|||
Burada sponsorların əməyini də vurğulamaq istəyirəm. |
|||
|
|||
Mən həmçinin alqoritmi, bölmələri, eşikləri və s. yeniləmək hüququnu da qoruyuram (hər ehtimala qarşı 🤷). |
@ -1,42 +0,0 @@ |
|||
# Externe Links und Artikel |
|||
|
|||
**FastAPI** hat eine großartige Community, die ständig wächst. |
|||
|
|||
Es gibt viele Beiträge, Artikel, Tools und Projekte zum Thema **FastAPI**. |
|||
|
|||
Hier ist eine unvollständige Liste einiger davon. |
|||
|
|||
/// tip | "Tipp" |
|||
|
|||
Wenn Sie einen Artikel, ein Projekt, ein Tool oder irgendetwas im Zusammenhang mit **FastAPI** haben, was hier noch nicht aufgeführt ist, erstellen Sie einen <a href="https://github.com/fastapi/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">Pull Request und fügen Sie es hinzu</a>. |
|||
|
|||
/// |
|||
|
|||
/// note | "Hinweis Deutsche Übersetzung" |
|||
|
|||
Die folgenden Überschriften und Links werden aus einer <a href="https://github.com/fastapi/fastapi/blob/master/docs/en/data/external_links.yml" class="external-link" target="_blank">anderen Datei</a> gelesen und sind daher nicht ins Deutsche übersetzt. |
|||
|
|||
/// |
|||
|
|||
{% for section_name, section_content in external_links.items() %} |
|||
|
|||
## {{ section_name }} |
|||
|
|||
{% for lang_name, lang_content in section_content.items() %} |
|||
|
|||
### {{ lang_name }} |
|||
|
|||
{% for item in lang_content %} |
|||
|
|||
* <a href="{{ item.link }}" class="external-link" target="_blank">{{ item.title }}</a> by <a href="{{ item.author_link }}" class="external-link" target="_blank">{{ item.author }}</a>. |
|||
|
|||
{% endfor %} |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
## Projekte |
|||
|
|||
Die neuesten GitHub-Projekte zum Thema `fastapi`: |
|||
|
|||
<div class="github-topic-projects"> |
|||
</div> |
@ -1,176 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI Leute |
|||
|
|||
FastAPI hat eine großartige Gemeinschaft, die Menschen mit unterschiedlichstem Hintergrund willkommen heißt. |
|||
|
|||
## Erfinder - Betreuer |
|||
|
|||
Hey! 👋 |
|||
|
|||
Das bin ich: |
|||
|
|||
{% 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 %} |
|||
|
|||
Ich bin der Erfinder und Betreuer von **FastAPI**. Sie können mehr darüber in [FastAPI helfen – Hilfe erhalten – Mit dem Autor vernetzen](help-fastapi.md#mit-dem-autor-vernetzen){.internal-link target=_blank} erfahren. |
|||
|
|||
... Aber hier möchte ich Ihnen die Gemeinschaft vorstellen. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** erhält eine Menge Unterstützung aus der Gemeinschaft. Und ich möchte ihre Beiträge hervorheben. |
|||
|
|||
Das sind die Menschen, die: |
|||
|
|||
* [Anderen bei Fragen auf GitHub helfen](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank}. |
|||
* [<abbr title='Pull Request – „Zieh-Anfrage“: Geänderten Quellcode senden, mit dem Vorschlag, ihn mit dem aktuellen Quellcode zu verschmelzen'>Pull Requests</abbr> erstellen](help-fastapi.md#einen-pull-request-erstellen){.internal-link target=_blank}. |
|||
* Pull Requests überprüfen (Review), [besonders wichtig für Übersetzungen](contributing.md#ubersetzungen){.internal-link target=_blank}. |
|||
|
|||
Eine Runde Applaus für sie. 👏 🙇 |
|||
|
|||
## Aktivste Benutzer im letzten Monat |
|||
|
|||
Hier die Benutzer, die im letzten Monat am meisten [anderen mit Fragen auf Github](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank} geholfen haben. ☕ |
|||
|
|||
{% 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">Fragen beantwortet: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Experten |
|||
|
|||
Hier die **FastAPI-Experten**. 🤓 |
|||
|
|||
Das sind die Benutzer, die *insgesamt* [anderen am meisten mit Fragen auf GitHub geholfen haben](help-fastapi.md#anderen-bei-fragen-auf-github-helfen){.internal-link target=_blank}. |
|||
|
|||
Sie haben bewiesen, dass sie Experten sind, weil sie vielen anderen geholfen haben. ✨ |
|||
|
|||
{% 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">Fragen beantwortet: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## Top-Mitwirkende |
|||
|
|||
Hier sind die **Top-Mitwirkenden**. 👷 |
|||
|
|||
Diese Benutzer haben [die meisten Pull Requests erstellt](help-fastapi.md#einen-pull-request-erstellen){.internal-link target=_blank} welche *<abbr title="Mergen – Zusammenführen: Unterschiedliche Versionen eines Quellcodes zusammenführen">gemerged</abbr>* wurden. |
|||
|
|||
Sie haben Quellcode, Dokumentation, Übersetzungen, usw. beigesteuert. 📦 |
|||
|
|||
{% 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 %} |
|||
|
|||
Es gibt viele andere Mitwirkende (mehr als hundert), Sie können sie alle auf der <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI GitHub Contributors-Seite</a> sehen. 👷 |
|||
|
|||
## Top-Rezensenten |
|||
|
|||
Diese Benutzer sind die **Top-Rezensenten**. 🕵️ |
|||
|
|||
### Rezensionen für Übersetzungen |
|||
|
|||
Ich spreche nur ein paar Sprachen (und nicht sehr gut 😅). Daher bestätigen Reviewer [**Übersetzungen der Dokumentation**](contributing.md#ubersetzungen){.internal-link target=_blank}. Ohne sie gäbe es keine Dokumentation in mehreren anderen Sprachen. |
|||
|
|||
--- |
|||
|
|||
Die **Top-Reviewer** 🕵️ haben die meisten Pull Requests von anderen überprüft und stellen die Qualität des Codes, der Dokumentation und insbesondere der **Übersetzungen** sicher. |
|||
|
|||
{% 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 %} |
|||
|
|||
## Sponsoren |
|||
|
|||
Dies sind die **Sponsoren**. 😎 |
|||
|
|||
Sie unterstützen meine Arbeit an **FastAPI** (und andere), hauptsächlich durch <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">GitHub-Sponsoren</a>. |
|||
|
|||
### Gold Sponsoren |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.gold -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
### Silber Sponsoren |
|||
|
|||
{% if sponsors %} |
|||
{% for sponsor in sponsors.silver -%} |
|||
<a href="{{ sponsor.url }}" target="_blank" title="{{ sponsor.title }}"><img src="{{ sponsor.img }}"></a> |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
{% if people %} |
|||
{% if people.sponsors_50 %} |
|||
|
|||
### Bronze Sponsoren |
|||
|
|||
<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 %} |
|||
|
|||
### Individuelle Sponsoren |
|||
|
|||
{% 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 %} |
|||
|
|||
## Über diese Daten - technische Details |
|||
|
|||
Der Hauptzweck dieser Seite ist es zu zeigen, wie die Gemeinschaft anderen hilft. |
|||
|
|||
Das beinhaltet auch Hilfe, die normalerweise weniger sichtbar und in vielen Fällen mühsamer ist, wie, anderen bei Problemen zu helfen und Pull Requests mit Übersetzungen zu überprüfen. |
|||
|
|||
Diese Daten werden jeden Monat berechnet, Sie können den <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">Quellcode hier lesen</a>. |
|||
|
|||
Hier weise ich auch auf Beiträge von Sponsoren hin. |
|||
|
|||
Ich behalte mir auch das Recht vor, den Algorithmus, die Abschnitte, die Schwellenwerte usw. zu aktualisieren (nur für den Fall 🤷). |
@ -1,5 +0,0 @@ |
|||
# FastAPI und Freunde Newsletter |
|||
|
|||
<iframe data-w-type="embedded" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://xr4n4.mjt.lu/wgt/xr4n4/hj5/form?c=40a44fa4" width="100%" style="height: 0;"></iframe> |
|||
|
|||
<script type="text/javascript" src="https://app.mailjet.com/pas-nc-embedded-v1.js"></script> |
@ -1,24 +0,0 @@ |
|||
# `APIRouter`-Klasse |
|||
|
|||
Hier sind die Referenzinformationen für die Klasse `APIRouter` mit all ihren Parametern, Attributen und Methoden. |
|||
|
|||
Sie können die `APIRouter`-Klasse direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import APIRouter |
|||
``` |
|||
|
|||
::: fastapi.APIRouter |
|||
options: |
|||
members: |
|||
- websocket |
|||
- include_router |
|||
- get |
|||
- put |
|||
- post |
|||
- delete |
|||
- options |
|||
- head |
|||
- patch |
|||
- trace |
|||
- on_event |
@ -1,11 +0,0 @@ |
|||
# Hintergrundtasks – `BackgroundTasks` |
|||
|
|||
Sie können einen Parameter in einer *Pfadoperation-Funktion* oder einer Abhängigkeitsfunktion mit dem Typ `BackgroundTasks` deklarieren und diesen danach verwenden, um die Ausführung von Hintergrundtasks nach dem Senden der Response zu definieren. |
|||
|
|||
Sie können `BackgroundTasks` direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import BackgroundTasks |
|||
``` |
|||
|
|||
::: fastapi.BackgroundTasks |
@ -1,29 +0,0 @@ |
|||
# Abhängigkeiten – `Depends()` und `Security()` |
|||
|
|||
## `Depends()` |
|||
|
|||
Abhängigkeiten werden hauptsächlich mit der speziellen Funktion `Depends()` behandelt, die ein Callable entgegennimmt. |
|||
|
|||
Hier finden Sie deren Referenz und Parameter. |
|||
|
|||
Sie können sie direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import Depends |
|||
``` |
|||
|
|||
::: fastapi.Depends |
|||
|
|||
## `Security()` |
|||
|
|||
In vielen Szenarien können Sie die Sicherheit (Autorisierung, Authentifizierung usw.) mit Abhängigkeiten handhaben, indem Sie `Depends()` verwenden. |
|||
|
|||
Wenn Sie jedoch auch OAuth2-Scopes deklarieren möchten, können Sie `Security()` anstelle von `Depends()` verwenden. |
|||
|
|||
Sie können `Security()` direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import Security |
|||
``` |
|||
|
|||
::: fastapi.Security |
@ -1,3 +0,0 @@ |
|||
# Encoder – `jsonable_encoder` |
|||
|
|||
::: fastapi.encoders.jsonable_encoder |
@ -1,20 +0,0 @@ |
|||
# Exceptions – `HTTPException` und `WebSocketException` |
|||
|
|||
Dies sind die <abbr title="Exception – Ausnahme, Fehler: Python-Objekt, das einen Fehler nebst Metadaten repräsentiert">Exceptions</abbr>, die Sie auslösen können, um dem Client Fehler zu berichten. |
|||
|
|||
Wenn Sie eine Exception auslösen, wird, wie es bei normalem Python der Fall wäre, der Rest der Ausführung abgebrochen. Auf diese Weise können Sie diese Exceptions von überall im Code werfen, um einen Request abzubrechen und den Fehler dem Client anzuzeigen. |
|||
|
|||
Sie können Folgendes verwenden: |
|||
|
|||
* `HTTPException` |
|||
* `WebSocketException` |
|||
|
|||
Diese Exceptions können direkt von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi import HTTPException, WebSocketException |
|||
``` |
|||
|
|||
::: fastapi.HTTPException |
|||
|
|||
::: fastapi.WebSocketException |
@ -1,31 +0,0 @@ |
|||
# `FastAPI`-Klasse |
|||
|
|||
Hier sind die Referenzinformationen für die Klasse `FastAPI` mit all ihren Parametern, Attributen und Methoden. |
|||
|
|||
Sie können die `FastAPI`-Klasse direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import FastAPI |
|||
``` |
|||
|
|||
::: fastapi.FastAPI |
|||
options: |
|||
members: |
|||
- openapi_version |
|||
- webhooks |
|||
- state |
|||
- dependency_overrides |
|||
- openapi |
|||
- websocket |
|||
- include_router |
|||
- get |
|||
- put |
|||
- post |
|||
- delete |
|||
- options |
|||
- head |
|||
- patch |
|||
- trace |
|||
- on_event |
|||
- middleware |
|||
- exception_handler |
@ -1,11 +0,0 @@ |
|||
# `HTTPConnection`-Klasse |
|||
|
|||
Wenn Sie Abhängigkeiten definieren möchten, die sowohl mit HTTP als auch mit WebSockets kompatibel sein sollen, können Sie einen Parameter definieren, der eine `HTTPConnection` anstelle eines `Request` oder eines `WebSocket` akzeptiert. |
|||
|
|||
Sie können diese von `fastapi.requests` importieren: |
|||
|
|||
```python |
|||
from fastapi.requests import HTTPConnection |
|||
``` |
|||
|
|||
::: fastapi.requests.HTTPConnection |
@ -1,11 +0,0 @@ |
|||
# Referenz – Code-API |
|||
|
|||
Hier ist die Referenz oder Code-API, die Klassen, Funktionen, Parameter, Attribute und alle FastAPI-Teile, die Sie in Ihren Anwendungen verwenden können. |
|||
|
|||
Wenn Sie **FastAPI** lernen möchten, ist es viel besser, das [FastAPI-Tutorial](https://fastapi.tiangolo.com/tutorial/) zu lesen. |
|||
|
|||
/// note | "Hinweis Deutsche Übersetzung" |
|||
|
|||
Die nachfolgende API wird aus der Quelltext-Dokumentation erstellt, daher sind nur die Einleitungen auf Deutsch. |
|||
|
|||
/// |
@ -1,45 +0,0 @@ |
|||
# Middleware |
|||
|
|||
Es gibt mehrere Middlewares, die direkt von Starlette bereitgestellt werden. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation über Middleware](../advanced/middleware.md). |
|||
|
|||
::: fastapi.middleware.cors.CORSMiddleware |
|||
|
|||
Kann von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi.middleware.cors import CORSMiddleware |
|||
``` |
|||
|
|||
::: fastapi.middleware.gzip.GZipMiddleware |
|||
|
|||
Kann von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi.middleware.gzip import GZipMiddleware |
|||
``` |
|||
|
|||
::: fastapi.middleware.httpsredirect.HTTPSRedirectMiddleware |
|||
|
|||
Kann von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware |
|||
``` |
|||
|
|||
::: fastapi.middleware.trustedhost.TrustedHostMiddleware |
|||
|
|||
Kann von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi.middleware.trustedhost import TrustedHostMiddleware |
|||
``` |
|||
|
|||
::: fastapi.middleware.wsgi.WSGIMiddleware |
|||
|
|||
Kann von `fastapi` importiert werden: |
|||
|
|||
```python |
|||
from fastapi.middleware.wsgi import WSGIMiddleware |
|||
``` |
@ -1,11 +0,0 @@ |
|||
# OpenAPI `docs` |
|||
|
|||
Werkzeuge zur Verwaltung der automatischen OpenAPI-UI-Dokumentation, einschließlich Swagger UI (standardmäßig unter `/docs`) und ReDoc (standardmäßig unter `/redoc`). |
|||
|
|||
::: fastapi.openapi.docs.get_swagger_ui_html |
|||
|
|||
::: fastapi.openapi.docs.get_redoc_html |
|||
|
|||
::: fastapi.openapi.docs.get_swagger_ui_oauth2_redirect_html |
|||
|
|||
::: fastapi.openapi.docs.swagger_ui_default_parameters |
@ -1,5 +0,0 @@ |
|||
# OpenAPI |
|||
|
|||
Es gibt mehrere Werkzeuge zur Handhabung von OpenAPI. |
|||
|
|||
Normalerweise müssen Sie diese nicht verwenden, es sei denn, Sie haben einen bestimmten fortgeschrittenen Anwendungsfall, welcher das erfordert. |
@ -1,5 +0,0 @@ |
|||
# OpenAPI-`models` |
|||
|
|||
OpenAPI Pydantic-Modelle, werden zum Generieren und Validieren der generierten OpenAPI verwendet. |
|||
|
|||
::: fastapi.openapi.models |
@ -1,35 +0,0 @@ |
|||
# Request-Parameter |
|||
|
|||
Hier die Referenzinformationen für die Request-Parameter. |
|||
|
|||
Dies sind die Sonderfunktionen, die Sie mittels `Annotated` in *Pfadoperation-Funktion*-Parameter oder Abhängigkeitsfunktionen einfügen können, um Daten aus dem Request abzurufen. |
|||
|
|||
Dies beinhaltet: |
|||
|
|||
* `Query()` |
|||
* `Path()` |
|||
* `Body()` |
|||
* `Cookie()` |
|||
* `Header()` |
|||
* `Form()` |
|||
* `File()` |
|||
|
|||
Sie können diese alle direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import Body, Cookie, File, Form, Header, Path, Query |
|||
``` |
|||
|
|||
::: fastapi.Query |
|||
|
|||
::: fastapi.Path |
|||
|
|||
::: fastapi.Body |
|||
|
|||
::: fastapi.Cookie |
|||
|
|||
::: fastapi.Header |
|||
|
|||
::: fastapi.Form |
|||
|
|||
::: fastapi.File |
@ -1,17 +0,0 @@ |
|||
# `Request`-Klasse |
|||
|
|||
Sie können einen Parameter in einer *Pfadoperation-Funktion* oder einer Abhängigkeit als vom Typ `Request` deklarieren und dann direkt auf das Requestobjekt zugreifen, ohne jegliche Validierung, usw. |
|||
|
|||
Sie können es direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import Request |
|||
``` |
|||
|
|||
/// tip | "Tipp" |
|||
|
|||
Wenn Sie Abhängigkeiten definieren möchten, die sowohl mit HTTP als auch mit WebSockets kompatibel sein sollen, können Sie einen Parameter definieren, der eine `HTTPConnection` anstelle eines `Request` oder eines `WebSocket` akzeptiert. |
|||
|
|||
/// |
|||
|
|||
::: fastapi.Request |
@ -1,13 +0,0 @@ |
|||
# `Response`-Klasse |
|||
|
|||
Sie können einen Parameter in einer *Pfadoperation-Funktion* oder einer Abhängigkeit als `Response` deklarieren und dann Daten für die Response wie Header oder Cookies festlegen. |
|||
|
|||
Diese können Sie auch direkt verwenden, um eine Instanz davon zu erstellen und diese von Ihren *Pfadoperationen* zurückzugeben. |
|||
|
|||
Sie können sie direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import Response |
|||
``` |
|||
|
|||
::: fastapi.Response |
@ -1,164 +0,0 @@ |
|||
# Benutzerdefinierte Responseklassen – File, HTML, Redirect, Streaming, usw. |
|||
|
|||
Es gibt mehrere benutzerdefinierte Responseklassen, von denen Sie eine Instanz erstellen und diese direkt von Ihren *Pfadoperationen* zurückgeben können. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation zu benutzerdefinierten Responses – HTML, Stream, Datei, andere](../advanced/custom-response.md). |
|||
|
|||
Sie können diese direkt von `fastapi.responses` importieren: |
|||
|
|||
```python |
|||
from fastapi.responses import ( |
|||
FileResponse, |
|||
HTMLResponse, |
|||
JSONResponse, |
|||
ORJSONResponse, |
|||
PlainTextResponse, |
|||
RedirectResponse, |
|||
Response, |
|||
StreamingResponse, |
|||
UJSONResponse, |
|||
) |
|||
``` |
|||
|
|||
## FastAPI-Responses |
|||
|
|||
Es gibt einige benutzerdefinierte FastAPI-Responseklassen, welche Sie verwenden können, um die JSON-Performanz zu optimieren. |
|||
|
|||
::: fastapi.responses.UJSONResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.ORJSONResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
## Starlette-Responses |
|||
|
|||
::: fastapi.responses.FileResponse |
|||
options: |
|||
members: |
|||
- chunk_size |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.HTMLResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.JSONResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.PlainTextResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.RedirectResponse |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.Response |
|||
options: |
|||
members: |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
|||
|
|||
::: fastapi.responses.StreamingResponse |
|||
options: |
|||
members: |
|||
- body_iterator |
|||
- charset |
|||
- status_code |
|||
- media_type |
|||
- body |
|||
- background |
|||
- raw_headers |
|||
- render |
|||
- init_headers |
|||
- headers |
|||
- set_cookie |
|||
- delete_cookie |
@ -1,73 +0,0 @@ |
|||
# Sicherheitstools |
|||
|
|||
Wenn Sie Abhängigkeiten mit OAuth2-Scopes deklarieren müssen, verwenden Sie `Security()`. |
|||
|
|||
Aber Sie müssen immer noch definieren, was das <abbr title="Das von dem abhängt, die zu verwendende Abhängigkeit">Dependable</abbr>, das Callable ist, welches Sie als Parameter an `Depends()` oder `Security()` übergeben. |
|||
|
|||
Es gibt mehrere Tools, mit denen Sie diese Dependables erstellen können, und sie werden in OpenAPI integriert, sodass sie in der Oberfläche der automatischen Dokumentation angezeigt werden und von automatisch generierten Clients und SDKs, usw., verwendet werden können. |
|||
|
|||
Sie können sie von `fastapi.security` importieren: |
|||
|
|||
```python |
|||
from fastapi.security import ( |
|||
APIKeyCookie, |
|||
APIKeyHeader, |
|||
APIKeyQuery, |
|||
HTTPAuthorizationCredentials, |
|||
HTTPBasic, |
|||
HTTPBasicCredentials, |
|||
HTTPBearer, |
|||
HTTPDigest, |
|||
OAuth2, |
|||
OAuth2AuthorizationCodeBearer, |
|||
OAuth2PasswordBearer, |
|||
OAuth2PasswordRequestForm, |
|||
OAuth2PasswordRequestFormStrict, |
|||
OpenIdConnect, |
|||
SecurityScopes, |
|||
) |
|||
``` |
|||
|
|||
## API-Schlüssel-Sicherheitsschemas |
|||
|
|||
::: fastapi.security.APIKeyCookie |
|||
|
|||
::: fastapi.security.APIKeyHeader |
|||
|
|||
::: fastapi.security.APIKeyQuery |
|||
|
|||
## HTTP-Authentifizierungsschemas |
|||
|
|||
::: fastapi.security.HTTPBasic |
|||
|
|||
::: fastapi.security.HTTPBearer |
|||
|
|||
::: fastapi.security.HTTPDigest |
|||
|
|||
## HTTP-Anmeldeinformationen |
|||
|
|||
::: fastapi.security.HTTPAuthorizationCredentials |
|||
|
|||
::: fastapi.security.HTTPBasicCredentials |
|||
|
|||
## OAuth2-Authentifizierung |
|||
|
|||
::: fastapi.security.OAuth2 |
|||
|
|||
::: fastapi.security.OAuth2AuthorizationCodeBearer |
|||
|
|||
::: fastapi.security.OAuth2PasswordBearer |
|||
|
|||
## OAuth2-Passwortformulare |
|||
|
|||
::: fastapi.security.OAuth2PasswordRequestForm |
|||
|
|||
::: fastapi.security.OAuth2PasswordRequestFormStrict |
|||
|
|||
## OAuth2-Sicherheitsscopes in Abhängigkeiten |
|||
|
|||
::: fastapi.security.SecurityScopes |
|||
|
|||
## OpenID Connect |
|||
|
|||
::: fastapi.security.OpenIdConnect |
@ -1,13 +0,0 @@ |
|||
# Statische Dateien – `StaticFiles` |
|||
|
|||
Sie können die `StaticFiles`-Klasse verwenden, um statische Dateien wie JavaScript, CSS, Bilder, usw. bereitzustellen. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation zu statischen Dateien](../tutorial/static-files.md). |
|||
|
|||
Sie können sie direkt von `fastapi.staticfiles` importieren: |
|||
|
|||
```python |
|||
from fastapi.staticfiles import StaticFiles |
|||
``` |
|||
|
|||
::: fastapi.staticfiles.StaticFiles |
@ -1,36 +0,0 @@ |
|||
# Statuscodes |
|||
|
|||
Sie können das Modul `status` von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import status |
|||
``` |
|||
|
|||
`status` wird direkt von Starlette bereitgestellt. |
|||
|
|||
Es enthält eine Gruppe benannter Konstanten (Variablen) mit ganzzahligen Statuscodes. |
|||
|
|||
Zum Beispiel: |
|||
|
|||
* 200: `status.HTTP_200_OK` |
|||
* 403: `status.HTTP_403_FORBIDDEN` |
|||
* usw. |
|||
|
|||
Es kann praktisch sein, schnell auf HTTP- (und WebSocket-)Statuscodes in Ihrer Anwendung zuzugreifen, indem Sie die automatische Vervollständigung für den Namen verwenden, ohne sich die Zahlen für die Statuscodes merken zu müssen. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation zu Response-Statuscodes](../tutorial/response-status-code.md). |
|||
|
|||
## Beispiel |
|||
|
|||
```python |
|||
from fastapi import FastAPI, status |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
@app.get("/items/", status_code=status.HTTP_418_IM_A_TEAPOT) |
|||
def read_items(): |
|||
return [{"name": "Plumbus"}, {"name": "Portal Gun"}] |
|||
``` |
|||
|
|||
::: fastapi.status |
@ -1,13 +0,0 @@ |
|||
# Templating – `Jinja2Templates` |
|||
|
|||
Sie können die `Jinja2Templates`-Klasse verwenden, um Jinja-Templates zu rendern. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation zu Templates](../advanced/templates.md). |
|||
|
|||
Sie können die Klasse direkt von `fastapi.templating` importieren: |
|||
|
|||
```python |
|||
from fastapi.templating import Jinja2Templates |
|||
``` |
|||
|
|||
::: fastapi.templating.Jinja2Templates |
@ -1,13 +0,0 @@ |
|||
# Testclient – `TestClient` |
|||
|
|||
Sie können die `TestClient`-Klasse verwenden, um FastAPI-Anwendungen zu testen, ohne eine tatsächliche HTTP- und Socket-Verbindung zu erstellen, Sie kommunizieren einfach direkt mit dem FastAPI-Code. |
|||
|
|||
Lesen Sie mehr darüber in der [FastAPI-Dokumentation über Testen](../tutorial/testing.md). |
|||
|
|||
Sie können sie direkt von `fastapi.testclient` importieren: |
|||
|
|||
```python |
|||
from fastapi.testclient import TestClient |
|||
``` |
|||
|
|||
::: fastapi.testclient.TestClient |
@ -1,22 +0,0 @@ |
|||
# `UploadFile`-Klasse |
|||
|
|||
Sie können *Pfadoperation-Funktionsparameter* als Parameter vom Typ `UploadFile` definieren, um Dateien aus dem Request zu erhalten. |
|||
|
|||
Sie können es direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import UploadFile |
|||
``` |
|||
|
|||
::: fastapi.UploadFile |
|||
options: |
|||
members: |
|||
- file |
|||
- filename |
|||
- size |
|||
- headers |
|||
- content_type |
|||
- read |
|||
- write |
|||
- seek |
|||
- close |
@ -1,67 +0,0 @@ |
|||
# WebSockets |
|||
|
|||
Bei der Definition von WebSockets deklarieren Sie normalerweise einen Parameter vom Typ `WebSocket` und können damit Daten vom Client lesen und an ihn senden. Er wird direkt von Starlette bereitgestellt, Sie können ihn aber von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import WebSocket |
|||
``` |
|||
|
|||
/// tip | "Tipp" |
|||
|
|||
Wenn Sie Abhängigkeiten definieren möchten, die sowohl mit HTTP als auch mit WebSockets kompatibel sein sollen, können Sie einen Parameter definieren, der eine `HTTPConnection` anstelle eines `Request` oder eines `WebSocket` akzeptiert. |
|||
|
|||
/// |
|||
|
|||
::: fastapi.WebSocket |
|||
options: |
|||
members: |
|||
- scope |
|||
- app |
|||
- url |
|||
- base_url |
|||
- headers |
|||
- query_params |
|||
- path_params |
|||
- cookies |
|||
- client |
|||
- state |
|||
- url_for |
|||
- client_state |
|||
- application_state |
|||
- receive |
|||
- send |
|||
- accept |
|||
- receive_text |
|||
- receive_bytes |
|||
- receive_json |
|||
- iter_text |
|||
- iter_bytes |
|||
- iter_json |
|||
- send_text |
|||
- send_bytes |
|||
- send_json |
|||
- close |
|||
|
|||
Wenn ein Client die Verbindung trennt, wird eine `WebSocketDisconnect`-Exception ausgelöst, die Sie abfangen können. |
|||
|
|||
Sie können diese direkt von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi import WebSocketDisconnect |
|||
``` |
|||
|
|||
::: fastapi.WebSocketDisconnect |
|||
|
|||
## WebSockets – zusätzliche Klassen |
|||
|
|||
Zusätzliche Klassen für die Handhabung von WebSockets. |
|||
|
|||
Werden direkt von Starlette bereitgestellt, Sie können sie jedoch von `fastapi` importieren: |
|||
|
|||
```python |
|||
from fastapi.websockets import WebSocketDisconnect, WebSocketState |
|||
``` |
|||
|
|||
::: fastapi.websockets.WebSocketDisconnect |
|||
|
|||
::: fastapi.websockets.WebSocketState |
@ -1,38 +0,0 @@ |
|||
# 🔢 🔗 & 📄 |
|||
|
|||
**FastAPI** ✔️ 👑 👪 🕧 💗. |
|||
|
|||
📤 📚 🏤, 📄, 🧰, & 🏗, 🔗 **FastAPI**. |
|||
|
|||
📥 ❌ 📇 👫. |
|||
|
|||
/// tip |
|||
|
|||
🚥 👆 ✔️ 📄, 🏗, 🧰, ⚖️ 🕳 🔗 **FastAPI** 👈 🚫 📇 📥, ✍ <a href="https://github.com/fastapi/fastapi/edit/master/docs/en/data/external_links.yml" class="external-link" target="_blank">🚲 📨 ❎ ⚫️</a>. |
|||
|
|||
/// |
|||
|
|||
## 📄 |
|||
|
|||
{% for section_name, section_content in external_links.items() %} |
|||
|
|||
## {{ section_name }} |
|||
|
|||
{% for lang_name, lang_content in section_content.items() %} |
|||
|
|||
### {{ lang_name }} |
|||
|
|||
{% for item in lang_content %} |
|||
|
|||
* <a href="{{ item.link }}" class="external-link" target="_blank">{{ item.title }}</a> by <a href="{{ item.author_link }}" class="external-link" target="_blank">{{ item.author }}</a>. |
|||
|
|||
{% endfor %} |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
## 🏗 |
|||
|
|||
⏪ 📂 🏗 ⏮️ ❔ `fastapi`: |
|||
|
|||
<div class="github-topic-projects"> |
|||
</div> |
@ -1,183 +0,0 @@ |
|||
--- |
|||
hide: |
|||
- navigation |
|||
--- |
|||
|
|||
# FastAPI 👫👫 |
|||
|
|||
FastAPI ✔️ 🎆 👪 👈 🙋 👫👫 ⚪️➡️ 🌐 🖥. |
|||
|
|||
## 👼 - 🐛 |
|||
|
|||
🙋 ❗ 👶 |
|||
|
|||
👉 👤: |
|||
|
|||
{% 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">❔: {{ user.answers }}</div><div class="count">🚲 📨: {{ user.prs }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
👤 👼 & 🐛 **FastAPI**. 👆 💪 ✍ 🌅 🔃 👈 [ℹ FastAPI - 🤚 ℹ - 🔗 ⏮️ 📕](help-fastapi.md#_3){.internal-link target=_blank}. |
|||
|
|||
...✋️ 📥 👤 💚 🎦 👆 👪. |
|||
|
|||
--- |
|||
|
|||
**FastAPI** 📨 📚 🐕🦺 ⚪️➡️ 👪. & 👤 💚 🎦 👫 💰. |
|||
|
|||
👫 👫👫 👈: |
|||
|
|||
* [ℹ 🎏 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank}. |
|||
* [✍ 🚲 📨](help-fastapi.md#_15){.internal-link target=_blank}. |
|||
* 📄 🚲 📨, [✴️ ⚠ ✍](contributing.md#_9){.internal-link target=_blank}. |
|||
|
|||
👏 👫. 👶 👶 |
|||
|
|||
## 🌅 🦁 👩💻 🏁 🗓️ |
|||
|
|||
👫 👩💻 👈 ✔️ [🤝 🎏 🏆 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank} ⏮️ 🏁 🗓️. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.last_month_experts[:10] %} |
|||
|
|||
<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">❔ 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 🕴 |
|||
|
|||
📥 **FastAPI 🕴**. 👶 |
|||
|
|||
👫 👩💻 👈 ✔️ [ℹ 🎏 🏆 ⏮️ ❔ 📂](help-fastapi.md#i){.internal-link target=_blank} 🔘 *🌐 🕰*. |
|||
|
|||
👫 ✔️ 🎦 🕴 🤝 📚 🎏. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.experts[: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 class="count">❔ 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 🔝 👨🔬 |
|||
|
|||
📥 **🔝 👨🔬**. 👶 |
|||
|
|||
👉 👩💻 ✔️ [✍ 🏆 🚲 📨](help-fastapi.md#_15){.internal-link target=_blank} 👈 ✔️ *🔗*. |
|||
|
|||
👫 ✔️ 📉 ℹ 📟, 🧾, ✍, ♒️. 👶 |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_contributors[: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 class="count">🚲 📨: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
📤 📚 🎏 👨🔬 (🌅 🌘 💯), 👆 💪 👀 👫 🌐 <a href="https://github.com/fastapi/fastapi/graphs/contributors" class="external-link" target="_blank">FastAPI 📂 👨🔬 📃</a>. 👶 |
|||
|
|||
## 🔝 👨🔬 |
|||
|
|||
👫 👩💻 **🔝 👨🔬**. 👶 👶 |
|||
|
|||
### 📄 ✍ |
|||
|
|||
👤 🕴 💬 👩❤👨 🇪🇸 (& 🚫 📶 👍 👶). , 👨🔬 🕐 👈 ✔️ [**🏋️ ✔ ✍**](contributing.md#_9){.internal-link target=_blank} 🧾. 🍵 👫, 📤 🚫🔜 🧾 📚 🎏 🇪🇸. |
|||
|
|||
--- |
|||
|
|||
**🔝 👨🔬** 👶 👶 ✔️ 📄 🏆 🚲 📨 ⚪️➡️ 🎏, 🚚 🔆 📟, 🧾, & ✴️, **✍**. |
|||
|
|||
{% if people %} |
|||
<div class="user-list user-list-center"> |
|||
{% for user in people.top_translations_reviewers[: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 class="count">📄: {{ user.count }}</div></div> |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
{% endif %} |
|||
|
|||
## 💰 |
|||
|
|||
👫 **💰**. 👶 |
|||
|
|||
👫 🔗 👇 👷 ⏮️ **FastAPI** (& 🎏), ✴️ 🔘 <a href="https://github.com/sponsors/tiangolo" class="external-link" target="_blank">📂 💰</a>. |
|||
|
|||
{% if sponsors %} |
|||
|
|||
{% if sponsors.gold %} |
|||
|
|||
### 🌟 💰 |
|||
|
|||
{% 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 %} |
|||
|
|||
{% if sponsors.silver %} |
|||
|
|||
### 🥇1st 💰 |
|||
|
|||
{% 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 %} |
|||
|
|||
{% if sponsors.bronze %} |
|||
|
|||
### 🥈2nd 💰 |
|||
|
|||
{% 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 %} |
|||
|
|||
{% endif %} |
|||
|
|||
### 🎯 💰 |
|||
|
|||
{% if github_sponsors %} |
|||
{% for group in github_sponsors.sponsors %} |
|||
|
|||
<div class="user-list user-list-center"> |
|||
|
|||
{% for user in group %} |
|||
{% if user.login not in sponsors_badge.logins %} |
|||
|
|||
<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> |
|||
|
|||
{% endif %} |
|||
{% endfor %} |
|||
|
|||
</div> |
|||
|
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
## 🔃 📊 - 📡 ℹ |
|||
|
|||
👑 🎯 👉 📃 🎦 🎯 👪 ℹ 🎏. |
|||
|
|||
✴️ ✅ 🎯 👈 🛎 🌘 ⭐, & 📚 💼 🌅 😩, 💖 🤝 🎏 ⏮️ ❔ & ⚖ 🚲 📨 ⏮️ ✍. |
|||
|
|||
💽 ⚖ 🔠 🗓️, 👆 💪 ✍ <a href="https://github.com/fastapi/fastapi/blob/master/.github/actions/people/app/main.py" class="external-link" target="_blank">ℹ 📟 📥</a>. |
|||
|
|||
📥 👤 🎦 💰 ⚪️➡️ 💰. |
|||
|
|||
👤 🏦 ▶️️ ℹ 📊, 📄, ⚡, ♒️ (💼 🤷). |
@ -1,19 +1,19 @@ |
|||
members: |
|||
- login: tiangolo |
|||
avatar_url: https://github.com/tiangolo.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/1326112 |
|||
url: https://github.com/tiangolo |
|||
- login: Kludex |
|||
avatar_url: https://github.com/Kludex.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/7353520 |
|||
url: https://github.com/Kludex |
|||
- login: alejsdev |
|||
avatar_url: https://github.com/alejsdev.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/90076947 |
|||
url: https://github.com/alejsdev |
|||
- login: svlandeg |
|||
avatar_url: https://github.com/svlandeg.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/8796347 |
|||
url: https://github.com/svlandeg |
|||
- login: estebanx64 |
|||
avatar_url: https://github.com/estebanx64.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/10840422 |
|||
url: https://github.com/estebanx64 |
|||
- login: patrick91 |
|||
avatar_url: https://github.com/patrick91.png |
|||
avatar_url: https://avatars.githubusercontent.com/u/667029 |
|||
url: https://github.com/patrick91 |
|||
|
@ -0,0 +1,300 @@ |
|||
# Environment Variables |
|||
|
|||
/// tip |
|||
|
|||
If you already know what "environment variables" are and how to use them, feel free to skip this. |
|||
|
|||
/// |
|||
|
|||
An environment variable (also known as "**env var**") is a variable that lives **outside** of the Python code, in the **operating system**, and could be read by your Python code (or by other programs as well). |
|||
|
|||
Environment variables could be useful for handling application **settings**, as part of the **installation** of Python, etc. |
|||
|
|||
## Create and Use Env Vars |
|||
|
|||
You can **create** and use environment variables in the **shell (terminal)**, without needing Python: |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// You could create an env var MY_NAME with |
|||
$ export MY_NAME="Wade Wilson" |
|||
|
|||
// Then you could use it with other programs, like |
|||
$ echo "Hello $MY_NAME" |
|||
|
|||
Hello Wade Wilson |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Create an env var MY_NAME |
|||
$ $Env:MY_NAME = "Wade Wilson" |
|||
|
|||
// Use it with other programs, like |
|||
$ echo "Hello $Env:MY_NAME" |
|||
|
|||
Hello Wade Wilson |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
## Read env vars in Python |
|||
|
|||
You could also create environment variables **outside** of Python, in the terminal (or with any other method), and then **read them in Python**. |
|||
|
|||
For example you could have a file `main.py` with: |
|||
|
|||
```Python hl_lines="3" |
|||
import os |
|||
|
|||
name = os.getenv("MY_NAME", "World") |
|||
print(f"Hello {name} from Python") |
|||
``` |
|||
|
|||
/// tip |
|||
|
|||
The second argument to <a href="https://docs.python.org/3.8/library/os.html#os.getenv" class="external-link" target="_blank">`os.getenv()`</a> is the default value to return. |
|||
|
|||
If not provided, it's `None` by default, here we provide `"World"` as the default value to use. |
|||
|
|||
/// |
|||
|
|||
Then you could call that Python program: |
|||
|
|||
//// tab | Linux, macOS, Windows Bash |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Here we don't set the env var yet |
|||
$ python main.py |
|||
|
|||
// As we didn't set the env var, we get the default value |
|||
|
|||
Hello World from Python |
|||
|
|||
// But if we create an environment variable first |
|||
$ export MY_NAME="Wade Wilson" |
|||
|
|||
// And then call the program again |
|||
$ python main.py |
|||
|
|||
// Now it can read the environment variable |
|||
|
|||
Hello Wade Wilson from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows PowerShell |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Here we don't set the env var yet |
|||
$ python main.py |
|||
|
|||
// As we didn't set the env var, we get the default value |
|||
|
|||
Hello World from Python |
|||
|
|||
// But if we create an environment variable first |
|||
$ $Env:MY_NAME = "Wade Wilson" |
|||
|
|||
// And then call the program again |
|||
$ python main.py |
|||
|
|||
// Now it can read the environment variable |
|||
|
|||
Hello Wade Wilson from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
As environment variables can be set outside of the code, but can be read by the code, and don't have to be stored (committed to `git`) with the rest of the files, it's common to use them for configurations or **settings**. |
|||
|
|||
You can also create an environment variable only for a **specific program invocation**, that is only available to that program, and only for its duration. |
|||
|
|||
To do that, create it right before the program itself, on the same line: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
// Create an env var MY_NAME in line for this program call |
|||
$ MY_NAME="Wade Wilson" python main.py |
|||
|
|||
// Now it can read the environment variable |
|||
|
|||
Hello Wade Wilson from Python |
|||
|
|||
// The env var no longer exists afterwards |
|||
$ python main.py |
|||
|
|||
Hello World from Python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
/// tip |
|||
|
|||
You can read more about it at <a href="https://12factor.net/config" class="external-link" target="_blank">The Twelve-Factor App: Config</a>. |
|||
|
|||
/// |
|||
|
|||
## Types and Validation |
|||
|
|||
These environment variables can only handle **text strings**, as they are external to Python and have to be compatible with other programs and the rest of the system (and even with different operating systems, as Linux, Windows, macOS). |
|||
|
|||
That means that **any value** read in Python from an environment variable **will be a `str`**, and any conversion to a different type or any validation has to be done in code. |
|||
|
|||
You will learn more about using environment variables for handling **application settings** in the [Advanced User Guide - Settings and Environment Variables](./advanced/settings.md){.internal-link target=_blank}. |
|||
|
|||
## `PATH` Environment Variable |
|||
|
|||
There is a **special** environment variable called **`PATH`** that is used by the operating systems (Linux, macOS, Windows) to find programs to run. |
|||
|
|||
The value of the variable `PATH` is a long string that is made of directories separated by a colon `:` on Linux and macOS, and by a semicolon `;` on Windows. |
|||
|
|||
For example, the `PATH` environment variable could look like this: |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
|||
``` |
|||
|
|||
This means that the system should look for programs in the directories: |
|||
|
|||
* `/usr/local/bin` |
|||
* `/usr/bin` |
|||
* `/bin` |
|||
* `/usr/sbin` |
|||
* `/sbin` |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32 |
|||
``` |
|||
|
|||
This means that the system should look for programs in the directories: |
|||
|
|||
* `C:\Program Files\Python312\Scripts` |
|||
* `C:\Program Files\Python312` |
|||
* `C:\Windows\System32` |
|||
|
|||
//// |
|||
|
|||
When you type a **command** in the terminal, the operating system **looks for** the program in **each of those directories** listed in the `PATH` environment variable. |
|||
|
|||
For example, when you type `python` in the terminal, the operating system looks for a program called `python` in the **first directory** in that list. |
|||
|
|||
If it finds it, then it will **use it**. Otherwise it keeps looking in the **other directories**. |
|||
|
|||
### Installing Python and Updating the `PATH` |
|||
|
|||
When you install Python, you might be asked if you want to update the `PATH` environment variable. |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
Let's say you install Python and it ends up in a directory `/opt/custompython/bin`. |
|||
|
|||
If you say yes to update the `PATH` environment variable, then the installer will add `/opt/custompython/bin` to the `PATH` environment variable. |
|||
|
|||
It could look like this: |
|||
|
|||
```plaintext |
|||
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/custompython/bin |
|||
``` |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one. |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
Let's say you install Python and it ends up in a directory `C:\opt\custompython\bin`. |
|||
|
|||
If you say yes to update the `PATH` environment variable, then the installer will add `C:\opt\custompython\bin` to the `PATH` environment variable. |
|||
|
|||
```plaintext |
|||
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32;C:\opt\custompython\bin |
|||
``` |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `C:\opt\custompython\bin` (the last directory) and use that one. |
|||
|
|||
//// |
|||
|
|||
This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one. |
|||
|
|||
So, if you type: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// tab | Linux, macOS |
|||
|
|||
The system will **find** the `python` program in `/opt/custompython/bin` and run it. |
|||
|
|||
It would be roughly equivalent to typing: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ /opt/custompython/bin/python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
//// tab | Windows |
|||
|
|||
The system will **find** the `python` program in `C:\opt\custompython\bin\python` and run it. |
|||
|
|||
It would be roughly equivalent to typing: |
|||
|
|||
<div class="termy"> |
|||
|
|||
```console |
|||
$ C:\opt\custompython\bin\python |
|||
``` |
|||
|
|||
</div> |
|||
|
|||
//// |
|||
|
|||
This information will be useful when learning about [Virtual Environments](virtual-environments.md){.internal-link target=_blank}. |
|||
|
|||
## Conclusion |
|||
|
|||
With this you should have a basic understanding of what **environment variables** are and how to use them in Python. |
|||
|
|||
You can also read more about them in the <a href="https://en.wikipedia.org/wiki/Environment_variable" class="external-link" target="_blank">Wikipedia for Environment Variable</a>. |
|||
|
|||
In many cases it's not very obvious how environment variables would be useful and applicable right away. But they keep showing up in many different scenarios when you are developing, so it's good to know about them. |
|||
|
|||
For example, you will need this information in the next section, about [Virtual Environments](virtual-environments.md). |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue