diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 52c34a49e..dd11727c7 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -7,6 +7,10 @@ on: types: - opened - synchronize + +env: + UV_SYSTEM_PYTHON: 1 + jobs: changes: runs-on: ubuntu-latest @@ -48,18 +52,20 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt', 'requirements-docs-tests.txt') }}-v08 + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Install docs extras - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-docs.txt + run: uv pip install -r requirements-docs.txt # Install MkDocs Material Insiders here just to put it in the cache for the rest of the steps - name: Install Material for MkDocs Insiders - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-docs-insiders.txt + if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) + run: uv pip install -r requirements-docs-insiders.txt env: TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }} - name: Verify Docs @@ -88,17 +94,19 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt', 'requirements-docs-tests.txt') }}-v08 + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Install docs extras - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-docs.txt + run: uv pip install -r requirements-docs.txt - name: Install Material for MkDocs Insiders - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-docs-insiders.txt + if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) + run: uv pip install -r requirements-docs-insiders.txt env: TOKEN: ${{ secrets.FASTAPI_MKDOCS_MATERIAL_INSIDERS }} - name: Update Languages diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index d2953f284..2fd46df6b 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -12,6 +12,9 @@ permissions: pull-requests: write statuses: write +env: + UV_SYSTEM_PYTHON: 1 + jobs: deploy-docs: runs-on: ubuntu-latest @@ -25,21 +28,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-github-actions-${{ env.pythonLocation }}-${{ hashFiles('requirements-github-actions.txt') }}-v01 + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Install GitHub Actions dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-github-actions.txt + run: uv pip install -r requirements-github-actions.txt - name: Deploy Docs Status Pending run: python ./scripts/deploy_docs_status.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.run_id }} - - name: Clean site run: | rm -rf ./site @@ -55,19 +59,19 @@ jobs: # hashFiles returns an empty string if there are no files if: hashFiles('./site/*') id: deploy - uses: cloudflare/pages-action@v1 + env: + PROJECT_NAME: fastapitiangolo + BRANCH: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'master' && 'main' ) || ( github.event.workflow_run.head_sha ) }} + uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: fastapitiangolo - directory: './site' - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'master' && 'main' ) || ( github.event.workflow_run.head_sha ) }} + command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }} - name: Comment Deploy run: python ./scripts/deploy_docs_status.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEPLOY_URL: ${{ steps.deploy.outputs.url }} + DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.run_id }} IS_DONE: "true" diff --git a/.github/workflows/issue-manager.yml b/.github/workflows/issue-manager.yml index 439084434..6a7e6143e 100644 --- a/.github/workflows/issue-manager.yml +++ b/.github/workflows/issue-manager.yml @@ -39,5 +39,9 @@ jobs: "waiting": { "delay": 2628000, "message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR." + }, + "invalid": { + "delay": 0, + "message": "This was marked as invalid and will be closed now. If this is an error, please provide additional details." } } diff --git a/.github/workflows/label-approved.yml b/.github/workflows/label-approved.yml index 0470fb606..11176bed8 100644 --- a/.github/workflows/label-approved.yml +++ b/.github/workflows/label-approved.yml @@ -8,6 +8,9 @@ on: permissions: pull-requests: write +env: + UV_SYSTEM_PYTHON: 1 + jobs: label-approved: if: github.repository_owner == 'fastapi' @@ -17,10 +20,26 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - - uses: docker://tiangolo/label-approved:0.0.4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} - config: > + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml + - name: Install GitHub Actions dependencies + run: uv pip install -r requirements-github-actions.txt + - name: Label Approved + run: python ./scripts/label_approved.py + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + CONFIG: > { "approved-1": { diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index c3bb83f9a..e8e58015a 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -17,6 +17,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/labeler@v5 + if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }} + - run: echo "Done adding labels" # Run this after labeler applied labels check-labels: needs: diff --git a/.github/workflows/notify-translations.yml b/.github/workflows/notify-translations.yml index 4787f3ddd..98aa41e5a 100644 --- a/.github/workflows/notify-translations.yml +++ b/.github/workflows/notify-translations.yml @@ -18,6 +18,9 @@ on: permissions: discussions: write +env: + UV_SYSTEM_PYTHON: 1 + jobs: notify-translations: runs-on: ubuntu-latest @@ -27,6 +30,19 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml # Allow debugging with tmate - name: Setup tmate session uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5004b94dd..c8ea4e18c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,7 +35,7 @@ jobs: TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} run: python -m build - name: Publish - uses: pypa/gh-action-pypi-publish@v1.10.1 + uses: pypa/gh-action-pypi-publish@v1.10.3 - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml index d3a975df5..daff8e244 100644 --- a/.github/workflows/smokeshow.yml +++ b/.github/workflows/smokeshow.yml @@ -8,6 +8,9 @@ on: permissions: statuses: write +env: + UV_SYSTEM_PYTHON: 1 + jobs: smokeshow: if: ${{ github.event.workflow_run.conclusion == 'success' }} @@ -18,19 +21,25 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.9' - - - run: pip install smokeshow - + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml + - run: uv pip install -r requirements-github-actions.txt - uses: actions/download-artifact@v4 with: name: coverage-html path: htmlcov github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - - run: smokeshow upload htmlcov env: SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb4b083c4..643037a12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,9 @@ on: # cron every week on monday - cron: "0 0 * * 1" +env: + UV_SYSTEM_PYTHON: 1 + jobs: lint: runs-on: ubuntu-latest @@ -25,19 +28,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - # Issue ref: https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-pydantic-v2-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08 + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-tests.txt + run: uv pip install -r requirements-tests.txt - name: Install Pydantic v2 - run: pip install --upgrade "pydantic>=2.0.2,<3.0.0" + run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" - name: Lint run: bash scripts/lint.sh @@ -63,23 +65,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - # Issue ref: https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ matrix.pydantic-version }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt', 'requirements-docs-tests.txt') }}-test-v08 + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-tests.txt + run: uv pip install -r requirements-tests.txt - name: Install Pydantic v1 if: matrix.pydantic-version == 'pydantic-v1' - run: pip install "pydantic>=1.10.0,<2.0.0" + run: uv pip install "pydantic>=1.10.0,<2.0.0" - name: Install Pydantic v2 if: matrix.pydantic-version == 'pydantic-v2' - run: pip install --upgrade "pydantic>=2.0.2,<3.0.0" + run: uv pip install --upgrade "pydantic>=2.0.2,<3.0.0" - run: mkdir coverage - name: Test run: bash scripts/test.sh @@ -105,16 +106,22 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.8' - # Issue ref: https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml + - name: Install Dependencies + run: uv pip install -r requirements-tests.txt - name: Get coverage files uses: actions/download-artifact@v4 with: pattern: coverage-* path: coverage merge-multiple: true - - run: pip install coverage[toml] - run: ls -la coverage - run: coverage combine coverage - run: coverage report diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1502f0abd..779018ff9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-toml @@ -14,7 +14,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.7 + rev: v0.7.0 hooks: - id: ruff args: diff --git a/README.md b/README.md index f274265de..a12e740f7 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ The key features are: "_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._" -
+ --- diff --git a/docs/az/docs/index.md b/docs/az/docs/index.md index b5d7f8f92..ad78d7d06 100644 --- a/docs/az/docs/index.md +++ b/docs/az/docs/index.md @@ -87,7 +87,7 @@ FastAPI Python ilə API yaratmaq üçün standart Python Timothy Crosley - Hug creator (ref) + --- diff --git a/docs/bn/docs/index.md b/docs/bn/docs/index.md index c882506ff..678ac9ca9 100644 --- a/docs/bn/docs/index.md +++ b/docs/bn/docs/index.md @@ -85,7 +85,7 @@ FastAPI একটি আধুনিক, দ্রুত ( বেশি ক্ "\_সত্যিই, আপনি যা তৈরি করেছেন তা খুব মজবুত এবং পরিপূর্ন৷ অনেক উপায়ে, আমি যা **Hug** এ করতে চেয়েছিলাম - তা কাউকে তৈরি করতে দেখে আমি সত্যিই অনুপ্রানিত৷\_" - + --- diff --git a/docs/bn/docs/python-types.md b/docs/bn/docs/python-types.md index d5304a65e..4a602b679 100644 --- a/docs/bn/docs/python-types.md +++ b/docs/bn/docs/python-types.md @@ -23,7 +23,7 @@ Python-এ ঐচ্ছিক "টাইপ হিন্ট" (যা "টাই চলুন একটি সাধারণ উদাহরণ দিয়ে শুরু করি: ```Python -{!../../../docs_src/python_types/tutorial001.py!} +{!../../docs_src/python_types/tutorial001.py!} ``` এই প্রোগ্রামটি কল করলে আউটপুট হয়: @@ -39,7 +39,7 @@ John Doe * তাদেরকে মাঝখানে একটি স্পেস দিয়ে concatenate করে। ```Python hl_lines="2" -{!../../../docs_src/python_types/tutorial001.py!} +{!../../docs_src/python_types/tutorial001.py!} ``` ### এটি সম্পাদনা করুন @@ -83,7 +83,7 @@ John Doe এগুলিই "টাইপ হিন্ট": ```Python hl_lines="1" -{!../../../docs_src/python_types/tutorial002.py!} +{!../../docs_src/python_types/tutorial002.py!} ``` এটি ডিফল্ট ভ্যালু ঘোষণা করার মত নয় যেমন: @@ -113,7 +113,7 @@ John Doe এই ফাংশনটি দেখুন, এটিতে ইতিমধ্যে টাইপ হিন্ট রয়েছে: ```Python hl_lines="1" -{!../../../docs_src/python_types/tutorial003.py!} +{!../../docs_src/python_types/tutorial003.py!} ``` এডিটর ভেরিয়েবলগুলির টাইপ জানার কারণে, আপনি শুধুমাত্র অটোকমপ্লিশনই পান না, আপনি এরর চেকও পান: @@ -123,7 +123,7 @@ John Doe এখন আপনি জানেন যে আপনাকে এটি ঠিক করতে হবে, `age`-কে একটি স্ট্রিং হিসেবে রূপান্তর করতে `str(age)` ব্যবহার করতে হবে: ```Python hl_lines="2" -{!../../../docs_src/python_types/tutorial004.py!} +{!../../docs_src/python_types/tutorial004.py!} ``` ## টাইপ ঘোষণা @@ -144,7 +144,7 @@ John Doe * `bytes` ```Python hl_lines="1" -{!../../../docs_src/python_types/tutorial005.py!} +{!../../docs_src/python_types/tutorial005.py!} ``` ### টাইপ প্যারামিটার সহ জেনেরিক টাইপ @@ -182,7 +182,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ যেহেতু লিস্ট এমন একটি টাইপ যা অভ্যন্তরীণ টাইপগুলি ধারণ করে, আপনি তাদের স্কোয়ার ব্রাকেটের ভিতরে ব্যবহার করুন: ```Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial006_py39.py!} +{!> ../../docs_src/python_types/tutorial006_py39.py!} ``` //// @@ -192,7 +192,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ `typing` থেকে `List` (বড় হাতের `L` দিয়ে) ইমপোর্ট করুন: ``` Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial006.py!} +{!> ../../docs_src/python_types/tutorial006.py!} ``` ভেরিয়েবলটি ঘোষণা করুন, একই কোলন (`:`) সিনট্যাক্স ব্যবহার করে। @@ -202,7 +202,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ যেহেতু লিস্ট এমন একটি টাইপ যা অভ্যন্তরীণ টাইপগুলি ধারণ করে, আপনি তাদের স্কোয়ার ব্রাকেটের ভিতরে করুন: ```Python hl_lines="4" -{!> ../../../docs_src/python_types/tutorial006.py!} +{!> ../../docs_src/python_types/tutorial006.py!} ``` //// @@ -240,7 +240,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ //// tab | Python 3.9+ ```Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial007_py39.py!} +{!> ../../docs_src/python_types/tutorial007_py39.py!} ``` //// @@ -248,7 +248,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ //// tab | Python 3.8+ ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial007.py!} +{!> ../../docs_src/python_types/tutorial007.py!} ``` //// @@ -269,7 +269,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ //// tab | Python 3.9+ ```Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial008_py39.py!} +{!> ../../docs_src/python_types/tutorial008_py39.py!} ``` //// @@ -277,7 +277,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্ //// tab | Python 3.8+ ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial008.py!} +{!> ../../docs_src/python_types/tutorial008.py!} ``` //// @@ -299,7 +299,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ //// tab | Python 3.10+ ```Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial008b_py310.py!} +{!> ../../docs_src/python_types/tutorial008b_py310.py!} ``` //// @@ -307,7 +307,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ //// tab | Python 3.8+ ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial008b.py!} +{!> ../../docs_src/python_types/tutorial008b.py!} ``` //// @@ -321,7 +321,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ Python 3.6 এবং তার উপরের সংস্করণগুলিতে (Python 3.10 অনতর্ভুক্ত) আপনি `typing` মডিউল থেকে `Optional` ইমপোর্ট করে এটি ঘোষণা এবং ব্যবহার করতে পারেন। ```Python hl_lines="1 4" -{!../../../docs_src/python_types/tutorial009.py!} +{!../../docs_src/python_types/tutorial009.py!} ``` `Optional[str]` ব্যবহার করা মানে হল শুধু `str` নয়, এটি হতে পারে `None`-ও, যা আপনার এডিটরকে সেই ত্রুটিগুলি শনাক্ত করতে সাহায্য করবে যেখানে আপনি ধরে নিচ্ছেন যে একটি মান সবসময় `str` হবে, অথচ এটি `None`-ও হতে পারেও। @@ -333,7 +333,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি //// tab | Python 3.10+ ```Python hl_lines="1" -{!> ../../../docs_src/python_types/tutorial009_py310.py!} +{!> ../../docs_src/python_types/tutorial009_py310.py!} ``` //// @@ -341,7 +341,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি //// tab | Python 3.8+ ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial009.py!} +{!> ../../docs_src/python_types/tutorial009.py!} ``` //// @@ -349,7 +349,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি //// tab | Python 3.8+ বিকল্প ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial009b.py!} +{!> ../../docs_src/python_types/tutorial009b.py!} ``` //// @@ -370,7 +370,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি একটি উদাহরণ হিসেবে, এই ফাংশনটি নিন: ```Python hl_lines="1 4" -{!../../../docs_src/python_types/tutorial009c.py!} +{!../../docs_src/python_types/tutorial009c.py!} ``` `name` প্যারামিটারটি `Optional[str]` হিসেবে সংজ্ঞায়িত হয়েছে, কিন্তু এটি **অপশনাল নয়**, আপনি প্যারামিটার ছাড়া ফাংশনটি কল করতে পারবেন না: @@ -388,7 +388,7 @@ say_hi(name=None) # এটি কাজ করে, None বৈধ 🎉 সুখবর হল, একবার আপনি Python 3.10 ব্যবহার করা শুরু করলে, আপনাকে এগুলোর ব্যাপারে আর চিন্তা করতে হবে না, যেহুতু আপনি | ব্যবহার করেই ইউনিয়ন ঘোষণা করতে পারবেন: ```Python hl_lines="1 4" -{!../../../docs_src/python_types/tutorial009c_py310.py!} +{!../../docs_src/python_types/tutorial009c_py310.py!} ``` এবং তারপর আপনাকে নামগুলি যেমন `Optional` এবং `Union` নিয়ে আর চিন্তা করতে হবে না। 😎 @@ -452,13 +452,13 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য ধরুন আপনার কাছে `Person` নামে একটি ক্লাস আছে, যার একটি নাম আছে: ```Python hl_lines="1-3" -{!../../../docs_src/python_types/tutorial010.py!} +{!../../docs_src/python_types/tutorial010.py!} ``` তারপর আপনি একটি ভেরিয়েবলকে `Person` টাইপের হিসেবে ঘোষণা করতে পারেন: ```Python hl_lines="6" -{!../../../docs_src/python_types/tutorial010.py!} +{!../../docs_src/python_types/tutorial010.py!} ``` এবং তারপর, আবার, আপনি এডিটর সাপোর্ট পেয়ে যাবেন: @@ -486,7 +486,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য //// tab | Python 3.10+ ```Python -{!> ../../../docs_src/python_types/tutorial011_py310.py!} +{!> ../../docs_src/python_types/tutorial011_py310.py!} ``` //// @@ -494,7 +494,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য //// tab | Python 3.9+ ```Python -{!> ../../../docs_src/python_types/tutorial011_py39.py!} +{!> ../../docs_src/python_types/tutorial011_py39.py!} ``` //// @@ -502,7 +502,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য //// tab | Python 3.8+ ```Python -{!> ../../../docs_src/python_types/tutorial011.py!} +{!> ../../docs_src/python_types/tutorial011.py!} ``` //// @@ -532,7 +532,7 @@ Python-এ এমন একটি ফিচার আছে যা `Annotated` Python 3.9-এ, `Annotated` স্ট্যান্ডার্ড লাইব্রেরিতে অন্তর্ভুক্ত, তাই আপনি এটি `typing` থেকে ইমপোর্ট করতে পারেন। ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial013_py39.py!} +{!> ../../docs_src/python_types/tutorial013_py39.py!} ``` //// @@ -544,7 +544,7 @@ Python 3.9-এর নীচের সংস্করণগুলিতে, আ এটি **FastAPI** এর সাথে ইতিমদ্ধে ইনস্টল হয়ে থাকবে। ```Python hl_lines="1 4" -{!> ../../../docs_src/python_types/tutorial013.py!} +{!> ../../docs_src/python_types/tutorial013.py!} ``` //// diff --git a/docs/de/docs/advanced/additional-responses.md b/docs/de/docs/advanced/additional-responses.md index 6f2c4b2dd..a87c56491 100644 --- a/docs/de/docs/advanced/additional-responses.md +++ b/docs/de/docs/advanced/additional-responses.md @@ -27,7 +27,7 @@ Jedes dieser Response-`dict`s kann einen Schlüssel `model` haben, welcher ein P Um beispielsweise eine weitere Response mit dem Statuscode `404` und einem Pydantic-Modell `Message` zu deklarieren, können Sie schreiben: ```Python hl_lines="18 22" -{!../../../docs_src/additional_responses/tutorial001.py!} +{!../../docs_src/additional_responses/tutorial001.py!} ``` /// note | "Hinweis" @@ -178,7 +178,7 @@ Sie können denselben `responses`-Parameter verwenden, um verschiedene Medientyp Sie können beispielsweise einen zusätzlichen Medientyp `image/png` hinzufügen und damit deklarieren, dass Ihre *Pfadoperation* ein JSON-Objekt (mit dem Medientyp `application/json`) oder ein PNG-Bild zurückgeben kann: ```Python hl_lines="19-24 28" -{!../../../docs_src/additional_responses/tutorial002.py!} +{!../../docs_src/additional_responses/tutorial002.py!} ``` /// note | "Hinweis" @@ -208,7 +208,7 @@ Sie können beispielsweise eine Response mit dem Statuscode `404` deklarieren, d Und eine Response mit dem Statuscode `200`, die Ihr `response_model` verwendet, aber ein benutzerdefiniertes Beispiel (`example`) enthält: ```Python hl_lines="20-31" -{!../../../docs_src/additional_responses/tutorial003.py!} +{!../../docs_src/additional_responses/tutorial003.py!} ``` Es wird alles kombiniert und in Ihre OpenAPI eingebunden und in der API-Dokumentation angezeigt: @@ -244,7 +244,7 @@ Mit dieser Technik können Sie einige vordefinierte Responses in Ihren *Pfadoper Zum Beispiel: ```Python hl_lines="13-17 26" -{!../../../docs_src/additional_responses/tutorial004.py!} +{!../../docs_src/additional_responses/tutorial004.py!} ``` ## Weitere Informationen zu OpenAPI-Responses diff --git a/docs/de/docs/advanced/additional-status-codes.md b/docs/de/docs/advanced/additional-status-codes.md index 672efee51..fc8d09e4c 100644 --- a/docs/de/docs/advanced/additional-status-codes.md +++ b/docs/de/docs/advanced/additional-status-codes.md @@ -17,7 +17,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt //// tab | Python 3.10+ ```Python hl_lines="4 25" -{!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!} +{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!} ``` //// @@ -25,7 +25,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt //// tab | Python 3.9+ ```Python hl_lines="4 25" -{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!} +{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!} ``` //// @@ -33,7 +33,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt //// tab | Python 3.8+ ```Python hl_lines="4 26" -{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!} +{!> ../../docs_src/additional_status_codes/tutorial001_an.py!} ``` //// @@ -47,7 +47,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="2 23" -{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!} +{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!} ``` //// @@ -61,7 +61,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="4 25" -{!> ../../../docs_src/additional_status_codes/tutorial001.py!} +{!> ../../docs_src/additional_status_codes/tutorial001.py!} ``` //// diff --git a/docs/de/docs/advanced/advanced-dependencies.md b/docs/de/docs/advanced/advanced-dependencies.md index f29970872..54351714e 100644 --- a/docs/de/docs/advanced/advanced-dependencies.md +++ b/docs/de/docs/advanced/advanced-dependencies.md @@ -21,7 +21,7 @@ Dazu deklarieren wir eine Methode `__call__`: //// tab | Python 3.9+ ```Python hl_lines="12" -{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!} +{!> ../../docs_src/dependencies/tutorial011_an_py39.py!} ``` //// @@ -29,7 +29,7 @@ Dazu deklarieren wir eine Methode `__call__`: //// tab | Python 3.8+ ```Python hl_lines="11" -{!> ../../../docs_src/dependencies/tutorial011_an.py!} +{!> ../../docs_src/dependencies/tutorial011_an.py!} ``` //// @@ -43,7 +43,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="10" -{!> ../../../docs_src/dependencies/tutorial011.py!} +{!> ../../docs_src/dependencies/tutorial011.py!} ``` //// @@ -57,7 +57,7 @@ Und jetzt können wir `__init__` verwenden, um die Parameter der Instanz zu dekl //// tab | Python 3.9+ ```Python hl_lines="9" -{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!} +{!> ../../docs_src/dependencies/tutorial011_an_py39.py!} ``` //// @@ -65,7 +65,7 @@ Und jetzt können wir `__init__` verwenden, um die Parameter der Instanz zu dekl //// tab | Python 3.8+ ```Python hl_lines="8" -{!> ../../../docs_src/dependencies/tutorial011_an.py!} +{!> ../../docs_src/dependencies/tutorial011_an.py!} ``` //// @@ -79,7 +79,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="7" -{!> ../../../docs_src/dependencies/tutorial011.py!} +{!> ../../docs_src/dependencies/tutorial011.py!} ``` //// @@ -93,7 +93,7 @@ Wir könnten eine Instanz dieser Klasse erstellen mit: //// tab | Python 3.9+ ```Python hl_lines="18" -{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!} +{!> ../../docs_src/dependencies/tutorial011_an_py39.py!} ``` //// @@ -101,7 +101,7 @@ Wir könnten eine Instanz dieser Klasse erstellen mit: //// tab | Python 3.8+ ```Python hl_lines="17" -{!> ../../../docs_src/dependencies/tutorial011_an.py!} +{!> ../../docs_src/dependencies/tutorial011_an.py!} ``` //// @@ -115,7 +115,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="16" -{!> ../../../docs_src/dependencies/tutorial011.py!} +{!> ../../docs_src/dependencies/tutorial011.py!} ``` //// @@ -137,7 +137,7 @@ checker(q="somequery") //// tab | Python 3.9+ ```Python hl_lines="22" -{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!} +{!> ../../docs_src/dependencies/tutorial011_an_py39.py!} ``` //// @@ -145,7 +145,7 @@ checker(q="somequery") //// tab | Python 3.8+ ```Python hl_lines="21" -{!> ../../../docs_src/dependencies/tutorial011_an.py!} +{!> ../../docs_src/dependencies/tutorial011_an.py!} ``` //// @@ -159,7 +159,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="20" -{!> ../../../docs_src/dependencies/tutorial011.py!} +{!> ../../docs_src/dependencies/tutorial011.py!} ``` //// diff --git a/docs/de/docs/advanced/async-tests.md b/docs/de/docs/advanced/async-tests.md index e56841faa..93ff84b8a 100644 --- a/docs/de/docs/advanced/async-tests.md +++ b/docs/de/docs/advanced/async-tests.md @@ -33,13 +33,13 @@ Betrachten wir als einfaches Beispiel eine Dateistruktur ähnlich der in [Größ Die Datei `main.py` hätte als Inhalt: ```Python -{!../../../docs_src/async_tests/main.py!} +{!../../docs_src/async_tests/main.py!} ``` Die Datei `test_main.py` hätte die Tests für `main.py`, das könnte jetzt so aussehen: ```Python -{!../../../docs_src/async_tests/test_main.py!} +{!../../docs_src/async_tests/test_main.py!} ``` ## Es ausführen @@ -61,7 +61,7 @@ $ pytest Der Marker `@pytest.mark.anyio` teilt pytest mit, dass diese Testfunktion asynchron aufgerufen werden soll: ```Python hl_lines="7" -{!../../../docs_src/async_tests/test_main.py!} +{!../../docs_src/async_tests/test_main.py!} ``` /// tip | "Tipp" @@ -73,7 +73,7 @@ Beachten Sie, dass die Testfunktion jetzt `async def` ist und nicht nur `def` wi Dann können wir einen `AsyncClient` mit der App erstellen und mit `await` asynchrone Requests an ihn senden. ```Python hl_lines="9-12" -{!../../../docs_src/async_tests/test_main.py!} +{!../../docs_src/async_tests/test_main.py!} ``` Das ist das Äquivalent zu: diff --git a/docs/de/docs/advanced/behind-a-proxy.md b/docs/de/docs/advanced/behind-a-proxy.md index 18f90ebde..74b25308a 100644 --- a/docs/de/docs/advanced/behind-a-proxy.md +++ b/docs/de/docs/advanced/behind-a-proxy.md @@ -19,7 +19,7 @@ In diesem Fall würde der ursprüngliche Pfad `/app` tatsächlich unter `/api/v1 Auch wenn Ihr gesamter Code unter der Annahme geschrieben ist, dass es nur `/app` gibt. ```Python hl_lines="6" -{!../../../docs_src/behind_a_proxy/tutorial001.py!} +{!../../docs_src/behind_a_proxy/tutorial001.py!} ``` Und der Proxy würde das **Pfadpräfix** on-the-fly **"entfernen**", bevor er die Anfrage an Uvicorn übermittelt, dafür sorgend, dass Ihre Anwendung davon überzeugt ist, dass sie unter `/app` bereitgestellt wird, sodass Sie nicht Ihren gesamten Code dahingehend aktualisieren müssen, das Präfix `/api/v1` zu verwenden. @@ -99,7 +99,7 @@ Sie können den aktuellen `root_path` abrufen, der von Ihrer Anwendung für jede Hier fügen wir ihn, nur zu Demonstrationszwecken, in die Nachricht ein. ```Python hl_lines="8" -{!../../../docs_src/behind_a_proxy/tutorial001.py!} +{!../../docs_src/behind_a_proxy/tutorial001.py!} ``` Wenn Sie Uvicorn dann starten mit: @@ -128,7 +128,7 @@ wäre die Response etwa: Falls Sie keine Möglichkeit haben, eine Kommandozeilenoption wie `--root-path` oder ähnlich zu übergeben, können Sie als Alternative beim Erstellen Ihrer FastAPI-Anwendung den Parameter `root_path` setzen: ```Python hl_lines="3" -{!../../../docs_src/behind_a_proxy/tutorial002.py!} +{!../../docs_src/behind_a_proxy/tutorial002.py!} ``` Die Übergabe des `root_path` an `FastAPI` wäre das Äquivalent zur Übergabe der `--root-path`-Kommandozeilenoption an Uvicorn oder Hypercorn. @@ -310,7 +310,7 @@ Wenn Sie eine benutzerdefinierte Liste von Servern (`servers`) übergeben und es Zum Beispiel: ```Python hl_lines="4-7" -{!../../../docs_src/behind_a_proxy/tutorial003.py!} +{!../../docs_src/behind_a_proxy/tutorial003.py!} ``` Erzeugt ein OpenAPI-Schema, wie: @@ -359,7 +359,7 @@ Die Dokumentationsoberfläche interagiert mit dem von Ihnen ausgewählten Server Wenn Sie nicht möchten, dass **FastAPI** einen automatischen Server inkludiert, welcher `root_path` verwendet, können Sie den Parameter `root_path_in_servers=False` verwenden: ```Python hl_lines="9" -{!../../../docs_src/behind_a_proxy/tutorial004.py!} +{!../../docs_src/behind_a_proxy/tutorial004.py!} ``` Dann wird er nicht in das OpenAPI-Schema aufgenommen. diff --git a/docs/de/docs/advanced/custom-response.md b/docs/de/docs/advanced/custom-response.md index 20d6a039a..357d2c562 100644 --- a/docs/de/docs/advanced/custom-response.md +++ b/docs/de/docs/advanced/custom-response.md @@ -31,7 +31,7 @@ Das liegt daran, dass FastAPI standardmäßig jedes enthaltene Element überprü Wenn Sie jedoch sicher sind, dass der von Ihnen zurückgegebene Inhalt **mit JSON serialisierbar** ist, können Sie ihn direkt an die Response-Klasse übergeben und die zusätzliche Arbeit vermeiden, die FastAPI hätte, indem es Ihren zurückgegebenen Inhalt durch den `jsonable_encoder` leitet, bevor es ihn an die Response-Klasse übergibt. ```Python hl_lines="2 7" -{!../../../docs_src/custom_response/tutorial001b.py!} +{!../../docs_src/custom_response/tutorial001b.py!} ``` /// info @@ -58,7 +58,7 @@ Um eine Response mit HTML direkt von **FastAPI** zurückzugeben, verwenden Sie ` * Übergeben Sie `HTMLResponse` als den Parameter `response_class` Ihres *Pfadoperation-Dekorators*. ```Python hl_lines="2 7" -{!../../../docs_src/custom_response/tutorial002.py!} +{!../../docs_src/custom_response/tutorial002.py!} ``` /// info @@ -78,7 +78,7 @@ Wie in [Eine Response direkt zurückgeben](response-directly.md){.internal-link Das gleiche Beispiel von oben, das eine `HTMLResponse` zurückgibt, könnte so aussehen: ```Python hl_lines="2 7 19" -{!../../../docs_src/custom_response/tutorial003.py!} +{!../../docs_src/custom_response/tutorial003.py!} ``` /// warning | "Achtung" @@ -104,7 +104,7 @@ Die `response_class` wird dann nur zur Dokumentation der OpenAPI-Pfadoperation* Es könnte zum Beispiel so etwas sein: ```Python hl_lines="7 21 23" -{!../../../docs_src/custom_response/tutorial004.py!} +{!../../docs_src/custom_response/tutorial004.py!} ``` In diesem Beispiel generiert die Funktion `generate_html_response()` bereits eine `Response` und gibt sie zurück, anstatt das HTML in einem `str` zurückzugeben. @@ -145,7 +145,7 @@ Sie akzeptiert die folgenden Parameter: FastAPI (eigentlich Starlette) fügt automatisch einen Content-Length-Header ein. Außerdem wird es einen Content-Type-Header einfügen, der auf dem media_type basiert, und für Texttypen einen Zeichensatz (charset) anfügen. ```Python hl_lines="1 18" -{!../../../docs_src/response_directly/tutorial002.py!} +{!../../docs_src/response_directly/tutorial002.py!} ``` ### `HTMLResponse` @@ -157,7 +157,7 @@ Nimmt Text oder Bytes entgegen und gibt eine HTML-Response zurück, wie Sie oben Nimmt Text oder Bytes entgegen und gibt eine Plain-Text-Response zurück. ```Python hl_lines="2 7 9" -{!../../../docs_src/custom_response/tutorial005.py!} +{!../../docs_src/custom_response/tutorial005.py!} ``` ### `JSONResponse` @@ -181,7 +181,7 @@ Eine alternative JSON-Response mit `dataclasses`: ```Python hl_lines="1 7-12 19-20" -{!../../../docs_src/dataclasses/tutorial001.py!} +{!../../docs_src/dataclasses/tutorial001.py!} ``` Das ist dank **Pydantic** ebenfalls möglich, da es `dataclasses` intern unterstützt. @@ -35,7 +35,7 @@ Wenn Sie jedoch eine Menge Datenklassen herumliegen haben, ist dies ein guter Tr Sie können `dataclasses` auch im Parameter `response_model` verwenden: ```Python hl_lines="1 7-13 19" -{!../../../docs_src/dataclasses/tutorial002.py!} +{!../../docs_src/dataclasses/tutorial002.py!} ``` Die Datenklasse wird automatisch in eine Pydantic-Datenklasse konvertiert. @@ -53,7 +53,7 @@ In einigen Fällen müssen Sie möglicherweise immer noch Pydantics Version von In diesem Fall können Sie einfach die Standard-`dataclasses` durch `pydantic.dataclasses` ersetzen, was einen direkten Ersatz darstellt: ```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" } -{!../../../docs_src/dataclasses/tutorial003.py!} +{!../../docs_src/dataclasses/tutorial003.py!} ``` 1. Wir importieren `field` weiterhin von Standard-`dataclasses`. diff --git a/docs/de/docs/advanced/events.md b/docs/de/docs/advanced/events.md index e898db49b..b0c4d3922 100644 --- a/docs/de/docs/advanced/events.md +++ b/docs/de/docs/advanced/events.md @@ -31,7 +31,7 @@ Beginnen wir mit einem Beispiel und sehen es uns dann im Detail an. Wir erstellen eine asynchrone Funktion `lifespan()` mit `yield` wie folgt: ```Python hl_lines="16 19" -{!../../../docs_src/events/tutorial003.py!} +{!../../docs_src/events/tutorial003.py!} ``` Hier simulieren wir das langsame *Hochfahren*, das Laden des Modells, indem wir die (Fake-)Modellfunktion vor dem `yield` in das Dictionary mit Modellen für maschinelles Lernen einfügen. Dieser Code wird ausgeführt, **bevor** die Anwendung **beginnt, Requests entgegenzunehmen**, während des *Hochfahrens*. @@ -51,7 +51,7 @@ Möglicherweise müssen Sie eine neue Version starten, oder Sie haben es einfach Das Erste, was auffällt, ist, dass wir eine asynchrone Funktion mit `yield` definieren. Das ist sehr ähnlich zu Abhängigkeiten mit `yield`. ```Python hl_lines="14-19" -{!../../../docs_src/events/tutorial003.py!} +{!../../docs_src/events/tutorial003.py!} ``` Der erste Teil der Funktion, vor dem `yield`, wird ausgeführt **bevor** die Anwendung startet. @@ -65,7 +65,7 @@ Wie Sie sehen, ist die Funktion mit einem `@asynccontextmanager` versehen. Dadurch wird die Funktion in einen sogenannten „**asynchronen Kontextmanager**“ umgewandelt. ```Python hl_lines="1 13" -{!../../../docs_src/events/tutorial003.py!} +{!../../docs_src/events/tutorial003.py!} ``` Ein **Kontextmanager** in Python ist etwas, das Sie in einer `with`-Anweisung verwenden können, zum Beispiel kann `open()` als Kontextmanager verwendet werden: @@ -89,7 +89,7 @@ In unserem obigen Codebeispiel verwenden wir ihn nicht direkt, sondern übergebe Der Parameter `lifespan` der `FastAPI`-App benötigt einen **asynchronen Kontextmanager**, wir können ihm also unseren neuen asynchronen Kontextmanager `lifespan` übergeben. ```Python hl_lines="22" -{!../../../docs_src/events/tutorial003.py!} +{!../../docs_src/events/tutorial003.py!} ``` ## Alternative Events (deprecated) @@ -113,7 +113,7 @@ Diese Funktionen können mit `async def` oder normalem `def` deklariert werden. Um eine Funktion hinzuzufügen, die vor dem Start der Anwendung ausgeführt werden soll, deklarieren Sie diese mit dem Event `startup`: ```Python hl_lines="8" -{!../../../docs_src/events/tutorial001.py!} +{!../../docs_src/events/tutorial001.py!} ``` In diesem Fall initialisiert die Eventhandler-Funktion `startup` die „Datenbank“ der Items (nur ein `dict`) mit einigen Werten. @@ -127,7 +127,7 @@ Und Ihre Anwendung empfängt erst dann Anfragen, wenn alle `startup`-Eventhandle Um eine Funktion hinzuzufügen, die beim Herunterfahren der Anwendung ausgeführt werden soll, deklarieren Sie sie mit dem Event `shutdown`: ```Python hl_lines="6" -{!../../../docs_src/events/tutorial002.py!} +{!../../docs_src/events/tutorial002.py!} ``` Hier schreibt die `shutdown`-Eventhandler-Funktion eine Textzeile `"Application shutdown"` in eine Datei `log.txt`. diff --git a/docs/de/docs/advanced/generate-clients.md b/docs/de/docs/advanced/generate-clients.md index b8d66fdd7..80c44b3f9 100644 --- a/docs/de/docs/advanced/generate-clients.md +++ b/docs/de/docs/advanced/generate-clients.md @@ -31,7 +31,7 @@ Beginnen wir mit einer einfachen FastAPI-Anwendung: //// tab | Python 3.9+ ```Python hl_lines="7-9 12-13 16-17 21" -{!> ../../../docs_src/generate_clients/tutorial001_py39.py!} +{!> ../../docs_src/generate_clients/tutorial001_py39.py!} ``` //// @@ -39,7 +39,7 @@ Beginnen wir mit einer einfachen FastAPI-Anwendung: //// tab | Python 3.8+ ```Python hl_lines="9-11 14-15 18 19 23" -{!> ../../../docs_src/generate_clients/tutorial001.py!} +{!> ../../docs_src/generate_clients/tutorial001.py!} ``` //// @@ -150,7 +150,7 @@ Beispielsweise könnten Sie einen Abschnitt für **Items (Artikel)** und einen w //// tab | Python 3.9+ ```Python hl_lines="21 26 34" -{!> ../../../docs_src/generate_clients/tutorial002_py39.py!} +{!> ../../docs_src/generate_clients/tutorial002_py39.py!} ``` //// @@ -158,7 +158,7 @@ Beispielsweise könnten Sie einen Abschnitt für **Items (Artikel)** und einen w //// tab | Python 3.8+ ```Python hl_lines="23 28 36" -{!> ../../../docs_src/generate_clients/tutorial002.py!} +{!> ../../docs_src/generate_clients/tutorial002.py!} ``` //// @@ -211,7 +211,7 @@ Anschließend können Sie diese benutzerdefinierte Funktion als Parameter `gener //// tab | Python 3.9+ ```Python hl_lines="6-7 10" -{!> ../../../docs_src/generate_clients/tutorial003_py39.py!} +{!> ../../docs_src/generate_clients/tutorial003_py39.py!} ``` //// @@ -219,7 +219,7 @@ Anschließend können Sie diese benutzerdefinierte Funktion als Parameter `gener //// tab | Python 3.8+ ```Python hl_lines="8-9 12" -{!> ../../../docs_src/generate_clients/tutorial003.py!} +{!> ../../docs_src/generate_clients/tutorial003.py!} ``` //// @@ -247,7 +247,7 @@ Wir könnten das OpenAPI-JSON in eine Datei `openapi.json` herunterladen und dan //// tab | Python ```Python -{!> ../../../docs_src/generate_clients/tutorial004.py!} +{!> ../../docs_src/generate_clients/tutorial004.py!} ``` //// @@ -255,7 +255,7 @@ Wir könnten das OpenAPI-JSON in eine Datei `openapi.json` herunterladen und dan //// tab | Node.js ```Javascript -{!> ../../../docs_src/generate_clients/tutorial004.js!} +{!> ../../docs_src/generate_clients/tutorial004.js!} ``` //// diff --git a/docs/de/docs/advanced/middleware.md b/docs/de/docs/advanced/middleware.md index 8912225fb..b4001efda 100644 --- a/docs/de/docs/advanced/middleware.md +++ b/docs/de/docs/advanced/middleware.md @@ -58,7 +58,7 @@ Erzwingt, dass alle eingehenden Requests entweder `https` oder `wss` sein müsse Alle eingehenden Requests an `http` oder `ws` werden stattdessen an das sichere Schema umgeleitet. ```Python hl_lines="2 6" -{!../../../docs_src/advanced_middleware/tutorial001.py!} +{!../../docs_src/advanced_middleware/tutorial001.py!} ``` ## `TrustedHostMiddleware` @@ -66,7 +66,7 @@ Alle eingehenden Requests an `http` oder `ws` werden stattdessen an das sichere Erzwingt, dass alle eingehenden Requests einen korrekt gesetzten `Host`-Header haben, um sich vor HTTP-Host-Header-Angriffen zu schützen. ```Python hl_lines="2 6-8" -{!../../../docs_src/advanced_middleware/tutorial002.py!} +{!../../docs_src/advanced_middleware/tutorial002.py!} ``` Die folgenden Argumente werden unterstützt: @@ -82,7 +82,7 @@ Verarbeitet GZip-Responses für alle Requests, die `"gzip"` im `Accept-Encoding` Diese Middleware verarbeitet sowohl Standard- als auch Streaming-Responses. ```Python hl_lines="2 6" -{!../../../docs_src/advanced_middleware/tutorial003.py!} +{!../../docs_src/advanced_middleware/tutorial003.py!} ``` Die folgenden Argumente werden unterstützt: diff --git a/docs/de/docs/advanced/openapi-callbacks.md b/docs/de/docs/advanced/openapi-callbacks.md index d7b5bc885..f407d5450 100644 --- a/docs/de/docs/advanced/openapi-callbacks.md +++ b/docs/de/docs/advanced/openapi-callbacks.md @@ -32,7 +32,7 @@ Sie verfügt über eine *Pfadoperation*, die einen `Invoice`-Body empfängt, und Dieser Teil ist ziemlich normal, der größte Teil des Codes ist Ihnen wahrscheinlich bereits bekannt: ```Python hl_lines="9-13 36-53" -{!../../../docs_src/openapi_callbacks/tutorial001.py!} +{!../../docs_src/openapi_callbacks/tutorial001.py!} ``` /// tip | "Tipp" @@ -93,7 +93,7 @@ Wenn Sie diese Sichtweise (des *externen Entwicklers*) vorübergehend übernehme Erstellen Sie zunächst einen neuen `APIRouter`, der einen oder mehrere Callbacks enthält. ```Python hl_lines="3 25" -{!../../../docs_src/openapi_callbacks/tutorial001.py!} +{!../../docs_src/openapi_callbacks/tutorial001.py!} ``` ### Die Callback-*Pfadoperation* erstellen @@ -106,7 +106,7 @@ Sie sollte wie eine normale FastAPI-*Pfadoperation* aussehen: * Und sie könnte auch eine Deklaration der Response enthalten, die zurückgegeben werden soll, z. B. `response_model=InvoiceEventReceived`. ```Python hl_lines="16-18 21-22 28-32" -{!../../../docs_src/openapi_callbacks/tutorial001.py!} +{!../../docs_src/openapi_callbacks/tutorial001.py!} ``` Es gibt zwei Hauptunterschiede zu einer normalen *Pfadoperation*: @@ -176,7 +176,7 @@ An diesem Punkt haben Sie die benötigte(n) *Callback-Pfadoperation(en)* (diejen Verwenden Sie nun den Parameter `callbacks` im *Pfadoperation-Dekorator Ihrer API*, um das Attribut `.routes` (das ist eigentlich nur eine `list`e von Routen/*Pfadoperationen*) dieses Callback-Routers zu übergeben: ```Python hl_lines="35" -{!../../../docs_src/openapi_callbacks/tutorial001.py!} +{!../../docs_src/openapi_callbacks/tutorial001.py!} ``` /// tip | "Tipp" diff --git a/docs/de/docs/advanced/openapi-webhooks.md b/docs/de/docs/advanced/openapi-webhooks.md index fb0daa908..9f1bb6959 100644 --- a/docs/de/docs/advanced/openapi-webhooks.md +++ b/docs/de/docs/advanced/openapi-webhooks.md @@ -33,7 +33,7 @@ Webhooks sind in OpenAPI 3.1.0 und höher verfügbar und werden von FastAPI `0.9 Wenn Sie eine **FastAPI**-Anwendung erstellen, gibt es ein `webhooks`-Attribut, mit dem Sie *Webhooks* definieren können, genauso wie Sie *Pfadoperationen* definieren würden, zum Beispiel mit `@app.webhooks.post()`. ```Python hl_lines="9-13 36-53" -{!../../../docs_src/openapi_webhooks/tutorial001.py!} +{!../../docs_src/openapi_webhooks/tutorial001.py!} ``` Die von Ihnen definierten Webhooks landen im **OpenAPI**-Schema und der automatischen **Dokumentations-Oberfläche**. diff --git a/docs/de/docs/advanced/path-operation-advanced-configuration.md b/docs/de/docs/advanced/path-operation-advanced-configuration.md index c9cb82fe3..2d8b88be5 100644 --- a/docs/de/docs/advanced/path-operation-advanced-configuration.md +++ b/docs/de/docs/advanced/path-operation-advanced-configuration.md @@ -13,7 +13,7 @@ Mit dem Parameter `operation_id` können Sie die OpenAPI `operationId` festlegen Sie müssten sicherstellen, dass sie für jede Operation eindeutig ist. ```Python hl_lines="6" -{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!} ``` ### Verwendung des Namens der *Pfadoperation-Funktion* als operationId @@ -23,7 +23,7 @@ Wenn Sie die Funktionsnamen Ihrer API als `operationId`s verwenden möchten, kö Sie sollten dies tun, nachdem Sie alle Ihre *Pfadoperationen* hinzugefügt haben. ```Python hl_lines="2 12-21 24" -{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!} ``` /// tip | "Tipp" @@ -45,7 +45,7 @@ Auch wenn diese sich in unterschiedlichen Modulen (Python-Dateien) befinden. Um eine *Pfadoperation* aus dem generierten OpenAPI-Schema (und damit aus den automatischen Dokumentationssystemen) auszuschließen, verwenden Sie den Parameter `include_in_schema` und setzen Sie ihn auf `False`: ```Python hl_lines="6" -{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!} ``` ## Fortgeschrittene Beschreibung mittels Docstring @@ -57,7 +57,7 @@ Das Hinzufügen eines `\f` (ein maskiertes „Form Feed“-Zeichen) führt dazu, Sie wird nicht in der Dokumentation angezeigt, aber andere Tools (z. B. Sphinx) können den Rest verwenden. ```Python hl_lines="19-29" -{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!} ``` ## Zusätzliche Responses @@ -101,7 +101,7 @@ Sie können das OpenAPI-Schema für eine *Pfadoperation* erweitern, indem Sie de Dieses `openapi_extra` kann beispielsweise hilfreich sein, um OpenAPI-Erweiterungen zu deklarieren: ```Python hl_lines="6" -{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!} ``` Wenn Sie die automatische API-Dokumentation öffnen, wird Ihre Erweiterung am Ende der spezifischen *Pfadoperation* angezeigt. @@ -150,7 +150,7 @@ Sie könnten sich beispielsweise dafür entscheiden, den Request mit Ihrem eigen Das könnte man mit `openapi_extra` machen: ```Python hl_lines="20-37 39-40" -{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!} +{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!} ``` In diesem Beispiel haben wir kein Pydantic-Modell deklariert. Tatsächlich wird der Requestbody nicht einmal als JSON geparst, sondern direkt als `bytes` gelesen und die Funktion `magic_data_reader ()` wäre dafür verantwortlich, ihn in irgendeiner Weise zu parsen. @@ -168,7 +168,7 @@ In der folgenden Anwendung verwenden wir beispielsweise weder die integrierte Fu //// tab | Pydantic v2 ```Python hl_lines="17-22 24" -{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!} +{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!} ``` //// @@ -176,7 +176,7 @@ In der folgenden Anwendung verwenden wir beispielsweise weder die integrierte Fu //// tab | Pydantic v1 ```Python hl_lines="17-22 24" -{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!} +{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!} ``` //// @@ -196,7 +196,7 @@ Und dann parsen wir in unserem Code diesen YAML-Inhalt direkt und verwenden dann //// tab | Pydantic v2 ```Python hl_lines="26-33" -{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!} +{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!} ``` //// @@ -204,7 +204,7 @@ Und dann parsen wir in unserem Code diesen YAML-Inhalt direkt und verwenden dann //// tab | Pydantic v1 ```Python hl_lines="26-33" -{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!} +{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!} ``` //// diff --git a/docs/de/docs/advanced/response-change-status-code.md b/docs/de/docs/advanced/response-change-status-code.md index bba908a3e..202df0d87 100644 --- a/docs/de/docs/advanced/response-change-status-code.md +++ b/docs/de/docs/advanced/response-change-status-code.md @@ -21,7 +21,7 @@ Sie können einen Parameter vom Typ `Response` in Ihrer *Pfadoperation-Funktion* Anschließend können Sie den `status_code` in diesem *vorübergehenden* Response-Objekt festlegen. ```Python hl_lines="1 9 12" -{!../../../docs_src/response_change_status_code/tutorial001.py!} +{!../../docs_src/response_change_status_code/tutorial001.py!} ``` Und dann können Sie wie gewohnt jedes benötigte Objekt zurückgeben (ein `dict`, ein Datenbankmodell usw.). diff --git a/docs/de/docs/advanced/response-cookies.md b/docs/de/docs/advanced/response-cookies.md index 3d2043565..ba100870d 100644 --- a/docs/de/docs/advanced/response-cookies.md +++ b/docs/de/docs/advanced/response-cookies.md @@ -7,7 +7,7 @@ Sie können einen Parameter vom Typ `Response` in Ihrer *Pfadoperation-Funktion* Und dann können Sie Cookies in diesem *vorübergehenden* Response-Objekt setzen. ```Python hl_lines="1 8-9" -{!../../../docs_src/response_cookies/tutorial002.py!} +{!../../docs_src/response_cookies/tutorial002.py!} ``` Anschließend können Sie wie gewohnt jedes gewünschte Objekt zurückgeben (ein `dict`, ein Datenbankmodell, usw.). @@ -27,7 +27,7 @@ Dazu können Sie eine Response erstellen, wie unter [Eine Response direkt zurüc Setzen Sie dann Cookies darin und geben Sie sie dann zurück: ```Python hl_lines="10-12" -{!../../../docs_src/response_cookies/tutorial001.py!} +{!../../docs_src/response_cookies/tutorial001.py!} ``` /// tip | "Tipp" diff --git a/docs/de/docs/advanced/response-directly.md b/docs/de/docs/advanced/response-directly.md index 377490b56..70c045f57 100644 --- a/docs/de/docs/advanced/response-directly.md +++ b/docs/de/docs/advanced/response-directly.md @@ -35,7 +35,7 @@ Sie können beispielsweise kein Pydantic-Modell in eine `JSONResponse` einfügen In diesen Fällen können Sie den `jsonable_encoder` verwenden, um Ihre Daten zu konvertieren, bevor Sie sie an eine Response übergeben: ```Python hl_lines="6-7 21-22" -{!../../../docs_src/response_directly/tutorial001.py!} +{!../../docs_src/response_directly/tutorial001.py!} ``` /// note | "Technische Details" @@ -57,7 +57,7 @@ Nehmen wir an, Sie möchten eine ../../../docs_src/security/tutorial006_an_py39.py!} +{!> ../../docs_src/security/tutorial006_an_py39.py!} ``` //// @@ -31,7 +31,7 @@ Wenn Sie dann den Benutzernamen und das Passwort eingeben, sendet der Browser di //// tab | Python 3.8+ ```Python hl_lines="2 7 11" -{!> ../../../docs_src/security/tutorial006_an.py!} +{!> ../../docs_src/security/tutorial006_an.py!} ``` //// @@ -45,7 +45,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="2 6 10" -{!> ../../../docs_src/security/tutorial006.py!} +{!> ../../docs_src/security/tutorial006.py!} ``` //// @@ -71,7 +71,7 @@ Dann können wir `secrets.compare_digest()` verwenden, um sicherzustellen, dass //// tab | Python 3.9+ ```Python hl_lines="1 12-24" -{!> ../../../docs_src/security/tutorial007_an_py39.py!} +{!> ../../docs_src/security/tutorial007_an_py39.py!} ``` //// @@ -79,7 +79,7 @@ Dann können wir `secrets.compare_digest()` verwenden, um sicherzustellen, dass //// tab | Python 3.8+ ```Python hl_lines="1 12-24" -{!> ../../../docs_src/security/tutorial007_an.py!} +{!> ../../docs_src/security/tutorial007_an.py!} ``` //// @@ -93,7 +93,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="1 11-21" -{!> ../../../docs_src/security/tutorial007.py!} +{!> ../../docs_src/security/tutorial007.py!} ``` //// @@ -163,7 +163,7 @@ Nachdem Sie festgestellt haben, dass die Anmeldeinformationen falsch sind, geben //// tab | Python 3.9+ ```Python hl_lines="26-30" -{!> ../../../docs_src/security/tutorial007_an_py39.py!} +{!> ../../docs_src/security/tutorial007_an_py39.py!} ``` //// @@ -171,7 +171,7 @@ Nachdem Sie festgestellt haben, dass die Anmeldeinformationen falsch sind, geben //// tab | Python 3.8+ ```Python hl_lines="26-30" -{!> ../../../docs_src/security/tutorial007_an.py!} +{!> ../../docs_src/security/tutorial007_an.py!} ``` //// @@ -185,7 +185,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="23-27" -{!> ../../../docs_src/security/tutorial007.py!} +{!> ../../docs_src/security/tutorial007.py!} ``` //// diff --git a/docs/de/docs/advanced/security/oauth2-scopes.md b/docs/de/docs/advanced/security/oauth2-scopes.md index f02707698..c0af2560a 100644 --- a/docs/de/docs/advanced/security/oauth2-scopes.md +++ b/docs/de/docs/advanced/security/oauth2-scopes.md @@ -65,7 +65,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im //// tab | Python 3.10+ ```Python hl_lines="4 8 12 46 64 105 107-115 121-124 128-134 139 155" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -73,7 +73,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im //// tab | Python 3.9+ ```Python hl_lines="2 4 8 12 46 64 105 107-115 121-124 128-134 139 155" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -81,7 +81,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im //// tab | Python 3.8+ ```Python hl_lines="2 4 8 12 47 65 106 108-116 122-125 129-135 140 156" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -95,7 +95,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="3 7 11 45 63 104 106-114 120-123 127-133 138 154" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -109,7 +109,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="2 4 8 12 46 64 105 107-115 121-124 128-134 139 155" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -123,7 +123,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="2 4 8 12 46 64 105 107-115 121-124 128-134 139 155" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -139,7 +139,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des //// tab | Python 3.10+ ```Python hl_lines="62-65" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -147,7 +147,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des //// tab | Python 3.9+ ```Python hl_lines="62-65" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -155,7 +155,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des //// tab | Python 3.8+ ```Python hl_lines="63-66" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -169,7 +169,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="61-64" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -183,7 +183,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="62-65" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -197,7 +197,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="62-65" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -229,7 +229,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe //// tab | Python 3.10+ ```Python hl_lines="155" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -237,7 +237,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe //// tab | Python 3.9+ ```Python hl_lines="155" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -245,7 +245,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe //// tab | Python 3.8+ ```Python hl_lines="156" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -259,7 +259,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="154" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -273,7 +273,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="155" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -287,7 +287,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="155" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -319,7 +319,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen //// tab | Python 3.10+ ```Python hl_lines="4 139 170" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -327,7 +327,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen //// tab | Python 3.9+ ```Python hl_lines="4 139 170" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -335,7 +335,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen //// tab | Python 3.8+ ```Python hl_lines="4 140 171" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -349,7 +349,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="3 138 167" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -363,7 +363,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="4 139 168" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -377,7 +377,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="4 139 168" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -409,7 +409,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d //// tab | Python 3.10+ ```Python hl_lines="8 105" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -417,7 +417,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d //// tab | Python 3.9+ ```Python hl_lines="8 105" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -425,7 +425,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d //// tab | Python 3.8+ ```Python hl_lines="8 106" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -439,7 +439,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="7 104" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -453,7 +453,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="8 105" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -467,7 +467,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="8 105" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -487,7 +487,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du //// tab | Python 3.10+ ```Python hl_lines="105 107-115" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -495,7 +495,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du //// tab | Python 3.9+ ```Python hl_lines="105 107-115" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -503,7 +503,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du //// tab | Python 3.8+ ```Python hl_lines="106 108-116" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -517,7 +517,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="104 106-114" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -531,7 +531,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="105 107-115" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -545,7 +545,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="105 107-115" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -567,7 +567,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u //// tab | Python 3.10+ ```Python hl_lines="46 116-127" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -575,7 +575,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u //// tab | Python 3.9+ ```Python hl_lines="46 116-127" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -583,7 +583,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u //// tab | Python 3.8+ ```Python hl_lines="47 117-128" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -597,7 +597,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="45 115-126" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -611,7 +611,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="46 116-127" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -625,7 +625,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="46 116-127" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// @@ -639,7 +639,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen //// tab | Python 3.10+ ```Python hl_lines="128-134" -{!> ../../../docs_src/security/tutorial005_an_py310.py!} +{!> ../../docs_src/security/tutorial005_an_py310.py!} ``` //// @@ -647,7 +647,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen //// tab | Python 3.9+ ```Python hl_lines="128-134" -{!> ../../../docs_src/security/tutorial005_an_py39.py!} +{!> ../../docs_src/security/tutorial005_an_py39.py!} ``` //// @@ -655,7 +655,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen //// tab | Python 3.8+ ```Python hl_lines="129-135" -{!> ../../../docs_src/security/tutorial005_an.py!} +{!> ../../docs_src/security/tutorial005_an.py!} ``` //// @@ -669,7 +669,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="127-133" -{!> ../../../docs_src/security/tutorial005_py310.py!} +{!> ../../docs_src/security/tutorial005_py310.py!} ``` //// @@ -683,7 +683,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="128-134" -{!> ../../../docs_src/security/tutorial005_py39.py!} +{!> ../../docs_src/security/tutorial005_py39.py!} ``` //// @@ -697,7 +697,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="128-134" -{!> ../../../docs_src/security/tutorial005.py!} +{!> ../../docs_src/security/tutorial005.py!} ``` //// diff --git a/docs/de/docs/advanced/settings.md b/docs/de/docs/advanced/settings.md index 3cd4c6c7d..8b9ba2f48 100644 --- a/docs/de/docs/advanced/settings.md +++ b/docs/de/docs/advanced/settings.md @@ -181,7 +181,7 @@ Sie können dieselben Validierungs-Funktionen und -Tools verwenden, die Sie für //// tab | Pydantic v2 ```Python hl_lines="2 5-8 11" -{!> ../../../docs_src/settings/tutorial001.py!} +{!> ../../docs_src/settings/tutorial001.py!} ``` //// @@ -195,7 +195,7 @@ In Pydantic v1 würden Sie `BaseSettings` direkt von `pydantic` statt von `pydan /// ```Python hl_lines="2 5-8 11" -{!> ../../../docs_src/settings/tutorial001_pv1.py!} +{!> ../../docs_src/settings/tutorial001_pv1.py!} ``` //// @@ -215,7 +215,7 @@ Als Nächstes werden die Daten konvertiert und validiert. Wenn Sie also dieses ` Dann können Sie das neue `settings`-Objekt in Ihrer Anwendung verwenden: ```Python hl_lines="18-20" -{!../../../docs_src/settings/tutorial001.py!} +{!../../docs_src/settings/tutorial001.py!} ``` ### Den Server ausführen @@ -251,13 +251,13 @@ Sie könnten diese Einstellungen in eine andere Moduldatei einfügen, wie Sie in Sie könnten beispielsweise eine Datei `config.py` haben mit: ```Python -{!../../../docs_src/settings/app01/config.py!} +{!../../docs_src/settings/app01/config.py!} ``` Und dann verwenden Sie diese in einer Datei `main.py`: ```Python hl_lines="3 11-13" -{!../../../docs_src/settings/app01/main.py!} +{!../../docs_src/settings/app01/main.py!} ``` /// tip | "Tipp" @@ -277,7 +277,7 @@ Dies könnte besonders beim Testen nützlich sein, da es sehr einfach ist, eine Ausgehend vom vorherigen Beispiel könnte Ihre Datei `config.py` so aussehen: ```Python hl_lines="10" -{!../../../docs_src/settings/app02/config.py!} +{!../../docs_src/settings/app02/config.py!} ``` Beachten Sie, dass wir jetzt keine Standardinstanz `settings = Settings()` erstellen. @@ -289,7 +289,7 @@ Jetzt erstellen wir eine Abhängigkeit, die ein neues `config.Settings()` zurüc //// tab | Python 3.9+ ```Python hl_lines="6 12-13" -{!> ../../../docs_src/settings/app02_an_py39/main.py!} +{!> ../../docs_src/settings/app02_an_py39/main.py!} ``` //// @@ -297,7 +297,7 @@ Jetzt erstellen wir eine Abhängigkeit, die ein neues `config.Settings()` zurüc //// tab | Python 3.8+ ```Python hl_lines="6 12-13" -{!> ../../../docs_src/settings/app02_an/main.py!} +{!> ../../docs_src/settings/app02_an/main.py!} ``` //// @@ -311,7 +311,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="5 11-12" -{!> ../../../docs_src/settings/app02/main.py!} +{!> ../../docs_src/settings/app02/main.py!} ``` //// @@ -329,7 +329,7 @@ Und dann können wir das von der *Pfadoperation-Funktion* als Abhängigkeit einf //// tab | Python 3.9+ ```Python hl_lines="17 19-21" -{!> ../../../docs_src/settings/app02_an_py39/main.py!} +{!> ../../docs_src/settings/app02_an_py39/main.py!} ``` //// @@ -337,7 +337,7 @@ Und dann können wir das von der *Pfadoperation-Funktion* als Abhängigkeit einf //// tab | Python 3.8+ ```Python hl_lines="17 19-21" -{!> ../../../docs_src/settings/app02_an/main.py!} +{!> ../../docs_src/settings/app02_an/main.py!} ``` //// @@ -351,7 +351,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="16 18-20" -{!> ../../../docs_src/settings/app02/main.py!} +{!> ../../docs_src/settings/app02/main.py!} ``` //// @@ -361,7 +361,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. Dann wäre es sehr einfach, beim Testen ein anderes Einstellungsobjekt bereitzustellen, indem man eine Abhängigkeitsüberschreibung für `get_settings` erstellt: ```Python hl_lines="9-10 13 21" -{!../../../docs_src/settings/app02/test_main.py!} +{!../../docs_src/settings/app02/test_main.py!} ``` Bei der Abhängigkeitsüberschreibung legen wir einen neuen Wert für `admin_email` fest, wenn wir das neue `Settings`-Objekt erstellen, und geben dann dieses neue Objekt zurück. @@ -406,7 +406,7 @@ Und dann aktualisieren Sie Ihre `config.py` mit: //// tab | Pydantic v2 ```Python hl_lines="9" -{!> ../../../docs_src/settings/app03_an/config.py!} +{!> ../../docs_src/settings/app03_an/config.py!} ``` /// tip | "Tipp" @@ -420,7 +420,7 @@ Das Attribut `model_config` wird nur für die Pydantic-Konfiguration verwendet. //// tab | Pydantic v1 ```Python hl_lines="9-10" -{!> ../../../docs_src/settings/app03_an/config_pv1.py!} +{!> ../../docs_src/settings/app03_an/config_pv1.py!} ``` /// tip | "Tipp" @@ -465,7 +465,7 @@ Da wir jedoch den `@lru_cache`-Dekorator oben verwenden, wird das `Settings`-Obj //// tab | Python 3.9+ ```Python hl_lines="1 11" -{!> ../../../docs_src/settings/app03_an_py39/main.py!} +{!> ../../docs_src/settings/app03_an_py39/main.py!} ``` //// @@ -473,7 +473,7 @@ Da wir jedoch den `@lru_cache`-Dekorator oben verwenden, wird das `Settings`-Obj //// tab | Python 3.8+ ```Python hl_lines="1 11" -{!> ../../../docs_src/settings/app03_an/main.py!} +{!> ../../docs_src/settings/app03_an/main.py!} ``` //// @@ -487,7 +487,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="1 10" -{!> ../../../docs_src/settings/app03/main.py!} +{!> ../../docs_src/settings/app03/main.py!} ``` //// diff --git a/docs/de/docs/advanced/sub-applications.md b/docs/de/docs/advanced/sub-applications.md index 7dfaaa0cd..172b8d3c1 100644 --- a/docs/de/docs/advanced/sub-applications.md +++ b/docs/de/docs/advanced/sub-applications.md @@ -11,7 +11,7 @@ Wenn Sie zwei unabhängige FastAPI-Anwendungen mit deren eigenen unabhängigen O Erstellen Sie zunächst die Hauptanwendung **FastAPI** und deren *Pfadoperationen*: ```Python hl_lines="3 6-8" -{!../../../docs_src/sub_applications/tutorial001.py!} +{!../../docs_src/sub_applications/tutorial001.py!} ``` ### Unteranwendung @@ -21,7 +21,7 @@ Erstellen Sie dann Ihre Unteranwendung und deren *Pfadoperationen*. Diese Unteranwendung ist nur eine weitere Standard-FastAPI-Anwendung, aber diese wird „gemountet“: ```Python hl_lines="11 14-16" -{!../../../docs_src/sub_applications/tutorial001.py!} +{!../../docs_src/sub_applications/tutorial001.py!} ``` ### Die Unteranwendung mounten @@ -31,7 +31,7 @@ Mounten Sie in Ihrer Top-Level-Anwendung `app` die Unteranwendung `subapi`. In diesem Fall wird sie im Pfad `/subapi` gemountet: ```Python hl_lines="11 19" -{!../../../docs_src/sub_applications/tutorial001.py!} +{!../../docs_src/sub_applications/tutorial001.py!} ``` ### Es in der automatischen API-Dokumentation betrachten diff --git a/docs/de/docs/advanced/templates.md b/docs/de/docs/advanced/templates.md index abc7624f1..6cb3fcf6c 100644 --- a/docs/de/docs/advanced/templates.md +++ b/docs/de/docs/advanced/templates.md @@ -28,7 +28,7 @@ $ pip install jinja2 * Verwenden Sie die von Ihnen erstellten `templates`, um eine `TemplateResponse` zu rendern und zurückzugeben, übergeben Sie den Namen des Templates, das Requestobjekt und ein „Kontext“-Dictionary mit Schlüssel-Wert-Paaren, die innerhalb des Jinja2-Templates verwendet werden sollen. ```Python hl_lines="4 11 15-18" -{!../../../docs_src/templates/tutorial001.py!} +{!../../docs_src/templates/tutorial001.py!} ``` /// note | "Hinweis" @@ -58,7 +58,7 @@ Sie können auch `from starlette.templating import Jinja2Templates` verwenden. Dann können Sie unter `templates/item.html` ein Template erstellen, mit z. B. folgendem Inhalt: ```jinja hl_lines="7" -{!../../../docs_src/templates/templates/item.html!} +{!../../docs_src/templates/templates/item.html!} ``` ### Template-Kontextwerte @@ -112,13 +112,13 @@ Mit beispielsweise der ID `42` würde dies Folgendes ergeben: Sie können `url_for()` innerhalb des Templates auch beispielsweise mit den `StaticFiles` verwenden, die Sie mit `name="static"` gemountet haben. ```jinja hl_lines="4" -{!../../../docs_src/templates/templates/item.html!} +{!../../docs_src/templates/templates/item.html!} ``` In diesem Beispiel würde das zu einer CSS-Datei unter `static/styles.css` verlinken, mit folgendem Inhalt: ```CSS hl_lines="4" -{!../../../docs_src/templates/static/styles.css!} +{!../../docs_src/templates/static/styles.css!} ``` Und da Sie `StaticFiles` verwenden, wird diese CSS-Datei automatisch von Ihrer **FastAPI**-Anwendung unter der URL `/static/styles.css` bereitgestellt. diff --git a/docs/de/docs/advanced/testing-dependencies.md b/docs/de/docs/advanced/testing-dependencies.md index f131d27cd..c565b30f2 100644 --- a/docs/de/docs/advanced/testing-dependencies.md +++ b/docs/de/docs/advanced/testing-dependencies.md @@ -31,7 +31,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh //// tab | Python 3.10+ ```Python hl_lines="26-27 30" -{!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!} +{!> ../../docs_src/dependency_testing/tutorial001_an_py310.py!} ``` //// @@ -39,7 +39,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh //// tab | Python 3.9+ ```Python hl_lines="28-29 32" -{!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!} +{!> ../../docs_src/dependency_testing/tutorial001_an_py39.py!} ``` //// @@ -47,7 +47,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh //// tab | Python 3.8+ ```Python hl_lines="29-30 33" -{!> ../../../docs_src/dependency_testing/tutorial001_an.py!} +{!> ../../docs_src/dependency_testing/tutorial001_an.py!} ``` //// @@ -61,7 +61,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="24-25 28" -{!> ../../../docs_src/dependency_testing/tutorial001_py310.py!} +{!> ../../docs_src/dependency_testing/tutorial001_py310.py!} ``` //// @@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="28-29 32" -{!> ../../../docs_src/dependency_testing/tutorial001.py!} +{!> ../../docs_src/dependency_testing/tutorial001.py!} ``` //// diff --git a/docs/de/docs/advanced/testing-events.md b/docs/de/docs/advanced/testing-events.md index f50093548..3e63791c6 100644 --- a/docs/de/docs/advanced/testing-events.md +++ b/docs/de/docs/advanced/testing-events.md @@ -3,5 +3,5 @@ Wenn Sie in Ihren Tests Ihre Event-Handler (`startup` und `shutdown`) ausführen wollen, können Sie den `TestClient` mit einer `with`-Anweisung verwenden: ```Python hl_lines="9-12 20-24" -{!../../../docs_src/app_testing/tutorial003.py!} +{!../../docs_src/app_testing/tutorial003.py!} ``` diff --git a/docs/de/docs/advanced/testing-websockets.md b/docs/de/docs/advanced/testing-websockets.md index 4cbc45c17..7ae7d92d6 100644 --- a/docs/de/docs/advanced/testing-websockets.md +++ b/docs/de/docs/advanced/testing-websockets.md @@ -5,7 +5,7 @@ Sie können den schon bekannten `TestClient` zum Testen von WebSockets verwenden Dazu verwenden Sie den `TestClient` in einer `with`-Anweisung, eine Verbindung zum WebSocket herstellend: ```Python hl_lines="27-31" -{!../../../docs_src/app_testing/tutorial002.py!} +{!../../docs_src/app_testing/tutorial002.py!} ``` /// note | "Hinweis" diff --git a/docs/de/docs/advanced/using-request-directly.md b/docs/de/docs/advanced/using-request-directly.md index 1d575a7cb..6a0b96680 100644 --- a/docs/de/docs/advanced/using-request-directly.md +++ b/docs/de/docs/advanced/using-request-directly.md @@ -30,7 +30,7 @@ Angenommen, Sie möchten auf die IP-Adresse/den Host des Clients in Ihrer *Pfado Dazu müssen Sie direkt auf den Request zugreifen. ```Python hl_lines="1 7-8" -{!../../../docs_src/using_request_directly/tutorial001.py!} +{!../../docs_src/using_request_directly/tutorial001.py!} ``` Durch die Deklaration eines *Pfadoperation-Funktionsparameters*, dessen Typ der `Request` ist, weiß **FastAPI**, dass es den `Request` diesem Parameter übergeben soll. diff --git a/docs/de/docs/advanced/websockets.md b/docs/de/docs/advanced/websockets.md index 6d772b6c9..cf13fa23c 100644 --- a/docs/de/docs/advanced/websockets.md +++ b/docs/de/docs/advanced/websockets.md @@ -39,7 +39,7 @@ In der Produktion hätten Sie eine der oben genannten Optionen. Aber es ist die einfachste Möglichkeit, sich auf die Serverseite von WebSockets zu konzentrieren und ein funktionierendes Beispiel zu haben: ```Python hl_lines="2 6-38 41-43" -{!../../../docs_src/websockets/tutorial001.py!} +{!../../docs_src/websockets/tutorial001.py!} ``` ## Einen `websocket` erstellen @@ -47,7 +47,7 @@ Aber es ist die einfachste Möglichkeit, sich auf die Serverseite von WebSockets Erstellen Sie in Ihrer **FastAPI**-Anwendung einen `websocket`: ```Python hl_lines="1 46-47" -{!../../../docs_src/websockets/tutorial001.py!} +{!../../docs_src/websockets/tutorial001.py!} ``` /// note | "Technische Details" @@ -63,7 +63,7 @@ Sie können auch `from starlette.websockets import WebSocket` verwenden. In Ihrer WebSocket-Route können Sie Nachrichten `await`en und Nachrichten senden. ```Python hl_lines="48-52" -{!../../../docs_src/websockets/tutorial001.py!} +{!../../docs_src/websockets/tutorial001.py!} ``` Sie können Binär-, Text- und JSON-Daten empfangen und senden. @@ -118,7 +118,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa //// tab | Python 3.10+ ```Python hl_lines="68-69 82" -{!> ../../../docs_src/websockets/tutorial002_an_py310.py!} +{!> ../../docs_src/websockets/tutorial002_an_py310.py!} ``` //// @@ -126,7 +126,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa //// tab | Python 3.9+ ```Python hl_lines="68-69 82" -{!> ../../../docs_src/websockets/tutorial002_an_py39.py!} +{!> ../../docs_src/websockets/tutorial002_an_py39.py!} ``` //// @@ -134,7 +134,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa //// tab | Python 3.8+ ```Python hl_lines="69-70 83" -{!> ../../../docs_src/websockets/tutorial002_an.py!} +{!> ../../docs_src/websockets/tutorial002_an.py!} ``` //// @@ -148,7 +148,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="66-67 79" -{!> ../../../docs_src/websockets/tutorial002_py310.py!} +{!> ../../docs_src/websockets/tutorial002_py310.py!} ``` //// @@ -162,7 +162,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich. /// ```Python hl_lines="68-69 81" -{!> ../../../docs_src/websockets/tutorial002.py!} +{!> ../../docs_src/websockets/tutorial002.py!} ``` //// @@ -213,7 +213,7 @@ Wenn eine WebSocket-Verbindung geschlossen wird, löst `await websocket.receive_ //// tab | Python 3.9+ ```Python hl_lines="79-81" -{!> ../../../docs_src/websockets/tutorial003_py39.py!} +{!> ../../docs_src/websockets/tutorial003_py39.py!} ``` //// @@ -221,7 +221,7 @@ Wenn eine WebSocket-Verbindung geschlossen wird, löst `await websocket.receive_ //// tab | Python 3.8+ ```Python hl_lines="81-83" -{!> ../../../docs_src/websockets/tutorial003.py!} +{!> ../../docs_src/websockets/tutorial003.py!} ``` //// diff --git a/docs/de/docs/advanced/wsgi.md b/docs/de/docs/advanced/wsgi.md index 19ff90a90..50abc84d1 100644 --- a/docs/de/docs/advanced/wsgi.md +++ b/docs/de/docs/advanced/wsgi.md @@ -13,7 +13,7 @@ Wrappen Sie dann die WSGI-Anwendung (z. B. Flask) mit der Middleware. Und dann mounten Sie das auf einem Pfad. ```Python hl_lines="2-3 23" -{!../../../docs_src/wsgi/tutorial001.py!} +{!../../docs_src/wsgi/tutorial001.py!} ``` ## Es ansehen diff --git a/docs/de/docs/alternatives.md b/docs/de/docs/alternatives.md index 286ef1723..49e1cc6f0 100644 --- a/docs/de/docs/alternatives.md +++ b/docs/de/docs/alternatives.md @@ -321,7 +321,7 @@ Das hat tatsächlich dazu geführt, dass Teile von Pydantic aktualisiert wurden, /// -### Hug +### Hug Hug war eines der ersten Frameworks, welches die Deklaration von API-Parametertypen mithilfe von Python-Typhinweisen implementierte. Das war eine großartige Idee, die andere Tools dazu inspirierte, dasselbe zu tun. diff --git a/docs/de/docs/how-to/conditional-openapi.md b/docs/de/docs/how-to/conditional-openapi.md index 7f277bb88..a0a4983bb 100644 --- a/docs/de/docs/how-to/conditional-openapi.md +++ b/docs/de/docs/how-to/conditional-openapi.md @@ -30,7 +30,7 @@ Sie können problemlos dieselben Pydantic-Einstellungen verwenden, um Ihre gener Zum Beispiel: ```Python hl_lines="6 11" -{!../../../docs_src/conditional_openapi/tutorial001.py!} +{!../../docs_src/conditional_openapi/tutorial001.py!} ``` Hier deklarieren wir die Einstellung `openapi_url` mit dem gleichen Defaultwert `"/openapi.json"`. diff --git a/docs/de/docs/how-to/configure-swagger-ui.md b/docs/de/docs/how-to/configure-swagger-ui.md index c18091efd..31b9cd290 100644 --- a/docs/de/docs/how-to/configure-swagger-ui.md +++ b/docs/de/docs/how-to/configure-swagger-ui.md @@ -1,6 +1,6 @@ # Swagger-Oberfläche konfigurieren -Sie können einige zusätzliche Parameter der Swagger-Oberfläche konfigurieren. +Sie können einige zusätzliche Parameter der Swagger-Oberfläche konfigurieren. Um diese zu konfigurieren, übergeben Sie das Argument `swagger_ui_parameters` beim Erstellen des `FastAPI()`-App-Objekts oder an die Funktion `get_swagger_ui_html()`. @@ -19,7 +19,7 @@ Ohne Änderung der Einstellungen ist die Syntaxhervorhebung standardmäßig akti Sie können sie jedoch deaktivieren, indem Sie `syntaxHighlight` auf `False` setzen: ```Python hl_lines="3" -{!../../../docs_src/configure_swagger_ui/tutorial001.py!} +{!../../docs_src/configure_swagger_ui/tutorial001.py!} ``` ... und dann zeigt die Swagger-Oberfläche die Syntaxhervorhebung nicht mehr an: @@ -31,7 +31,7 @@ Sie können sie jedoch deaktivieren, indem Sie `syntaxHighlight` auf `False` set Auf die gleiche Weise könnten Sie das Theme der Syntaxhervorhebung mit dem Schlüssel `syntaxHighlight.theme` festlegen (beachten Sie, dass er einen Punkt in der Mitte hat): ```Python hl_lines="3" -{!../../../docs_src/configure_swagger_ui/tutorial002.py!} +{!../../docs_src/configure_swagger_ui/tutorial002.py!} ``` Obige Konfiguration würde das Theme für die Farbe der Syntaxhervorhebung ändern: @@ -45,7 +45,7 @@ FastAPI enthält einige Defaultkonfigurationsparameter, die für die meisten Anw Es umfasst die folgenden Defaultkonfigurationen: ```Python -{!../../../fastapi/openapi/docs.py[ln:7-23]!} +{!../../fastapi/openapi/docs.py[ln:7-23]!} ``` Sie können jede davon überschreiben, indem Sie im Argument `swagger_ui_parameters` einen anderen Wert festlegen. @@ -53,12 +53,12 @@ Sie können jede davon überschreiben, indem Sie im Argument `swagger_ui_paramet Um beispielsweise `deepLinking` zu deaktivieren, könnten Sie folgende Einstellungen an `swagger_ui_parameters` übergeben: ```Python hl_lines="3" -{!../../../docs_src/configure_swagger_ui/tutorial003.py!} +{!../../docs_src/configure_swagger_ui/tutorial003.py!} ``` ## Andere Parameter der Swagger-Oberfläche -Um alle anderen möglichen Konfigurationen zu sehen, die Sie verwenden können, lesen Sie die offizielle Dokumentation für die Parameter der Swagger-Oberfläche. +Um alle anderen möglichen Konfigurationen zu sehen, die Sie verwenden können, lesen Sie die offizielle Dokumentation für die Parameter der Swagger-Oberfläche. ## JavaScript-basierte Einstellungen diff --git a/docs/de/docs/how-to/custom-docs-ui-assets.md b/docs/de/docs/how-to/custom-docs-ui-assets.md index e8750f7c2..e5fd20a10 100644 --- a/docs/de/docs/how-to/custom-docs-ui-assets.md +++ b/docs/de/docs/how-to/custom-docs-ui-assets.md @@ -19,7 +19,7 @@ Der erste Schritt besteht darin, die automatischen Dokumentationen zu deaktivier Um diese zu deaktivieren, setzen Sie deren URLs beim Erstellen Ihrer `FastAPI`-App auf `None`: ```Python hl_lines="8" -{!../../../docs_src/custom_docs_ui/tutorial001.py!} +{!../../docs_src/custom_docs_ui/tutorial001.py!} ``` ### Die benutzerdefinierten Dokumentationen hinzufügen @@ -37,7 +37,7 @@ Sie können die internen Funktionen von FastAPI wiederverwenden, um die HTML-Sei Und genau so für ReDoc ... ```Python hl_lines="2-6 11-19 22-24 27-33" -{!../../../docs_src/custom_docs_ui/tutorial001.py!} +{!../../docs_src/custom_docs_ui/tutorial001.py!} ``` /// tip | "Tipp" @@ -55,7 +55,7 @@ Swagger UI erledigt das hinter den Kulissen für Sie, benötigt aber diesen „U Um nun testen zu können, ob alles funktioniert, erstellen Sie eine *Pfadoperation*: ```Python hl_lines="36-38" -{!../../../docs_src/custom_docs_ui/tutorial001.py!} +{!../../docs_src/custom_docs_ui/tutorial001.py!} ``` ### Es ausprobieren @@ -125,7 +125,7 @@ Danach könnte Ihre Dateistruktur wie folgt aussehen: * „Mounten“ Sie eine `StaticFiles()`-Instanz in einem bestimmten Pfad. ```Python hl_lines="7 11" -{!../../../docs_src/custom_docs_ui/tutorial002.py!} +{!../../docs_src/custom_docs_ui/tutorial002.py!} ``` ### Die statischen Dateien testen @@ -159,7 +159,7 @@ Wie bei der Verwendung eines benutzerdefinierten CDN besteht der erste Schritt d Um diese zu deaktivieren, setzen Sie deren URLs beim Erstellen Ihrer `FastAPI`-App auf `None`: ```Python hl_lines="9" -{!../../../docs_src/custom_docs_ui/tutorial002.py!} +{!../../docs_src/custom_docs_ui/tutorial002.py!} ``` ### Die benutzerdefinierten Dokumentationen, mit statischen Dateien, hinzufügen @@ -177,7 +177,7 @@ Auch hier können Sie die internen Funktionen von FastAPI wiederverwenden, um di Und genau so für ReDoc ... ```Python hl_lines="2-6 14-22 25-27 30-36" -{!../../../docs_src/custom_docs_ui/tutorial002.py!} +{!../../docs_src/custom_docs_ui/tutorial002.py!} ``` /// tip | "Tipp" @@ -195,7 +195,7 @@ Swagger UI erledigt das hinter den Kulissen für Sie, benötigt aber diesen „U Um nun testen zu können, ob alles funktioniert, erstellen Sie eine *Pfadoperation*: ```Python hl_lines="39-41" -{!../../../docs_src/custom_docs_ui/tutorial002.py!} +{!../../docs_src/custom_docs_ui/tutorial002.py!} ``` ### Benutzeroberfläche, mit statischen Dateien, testen diff --git a/docs/de/docs/how-to/custom-request-and-route.md b/docs/de/docs/how-to/custom-request-and-route.md index a0c4a0e0c..f81fa1da3 100644 --- a/docs/de/docs/how-to/custom-request-and-route.md +++ b/docs/de/docs/how-to/custom-request-and-route.md @@ -43,7 +43,7 @@ Wenn der Header kein `gzip` enthält, wird nicht versucht, den Body zu dekomprim Auf diese Weise kann dieselbe Routenklasse gzip-komprimierte oder unkomprimierte Requests verarbeiten. ```Python hl_lines="8-15" -{!../../../docs_src/custom_request_and_route/tutorial001.py!} +{!../../docs_src/custom_request_and_route/tutorial001.py!} ``` ### Eine benutzerdefinierte `GzipRoute`-Klasse erstellen @@ -57,7 +57,7 @@ Diese Methode gibt eine Funktion zurück. Und diese Funktion empfängt einen Req Hier verwenden wir sie, um aus dem ursprünglichen Request einen `GzipRequest` zu erstellen. ```Python hl_lines="18-26" -{!../../../docs_src/custom_request_and_route/tutorial001.py!} +{!../../docs_src/custom_request_and_route/tutorial001.py!} ``` /// note | "Technische Details" @@ -97,13 +97,13 @@ Wir können denselben Ansatz auch verwenden, um in einem Exceptionhandler auf de Alles, was wir tun müssen, ist, den Request innerhalb eines `try`/`except`-Blocks zu handhaben: ```Python hl_lines="13 15" -{!../../../docs_src/custom_request_and_route/tutorial002.py!} +{!../../docs_src/custom_request_and_route/tutorial002.py!} ``` Wenn eine Exception auftritt, befindet sich die `Request`-Instanz weiterhin im Gültigkeitsbereich, sodass wir den Requestbody lesen und bei der Fehlerbehandlung verwenden können: ```Python hl_lines="16-18" -{!../../../docs_src/custom_request_and_route/tutorial002.py!} +{!../../docs_src/custom_request_and_route/tutorial002.py!} ``` ## Benutzerdefinierte `APIRoute`-Klasse in einem Router @@ -111,11 +111,11 @@ Wenn eine Exception auftritt, befindet sich die `Request`-Instanz weiterhin im G Sie können auch den Parameter `route_class` eines `APIRouter` festlegen: ```Python hl_lines="26" -{!../../../docs_src/custom_request_and_route/tutorial003.py!} +{!../../docs_src/custom_request_and_route/tutorial003.py!} ``` In diesem Beispiel verwenden die *Pfadoperationen* unter dem `router` die benutzerdefinierte `TimedRoute`-Klasse und haben in der Response einen zusätzlichen `X-Response-Time`-Header mit der Zeit, die zum Generieren der Response benötigt wurde: ```Python hl_lines="13-20" -{!../../../docs_src/custom_request_and_route/tutorial003.py!} +{!../../docs_src/custom_request_and_route/tutorial003.py!} ``` diff --git a/docs/de/docs/how-to/extending-openapi.md b/docs/de/docs/how-to/extending-openapi.md index 347c5bed3..c895fb860 100644 --- a/docs/de/docs/how-to/extending-openapi.md +++ b/docs/de/docs/how-to/extending-openapi.md @@ -44,7 +44,7 @@ Fügen wir beispielsweise Strawberry-Dokumentation. diff --git a/docs/de/docs/how-to/separate-openapi-schemas.md b/docs/de/docs/how-to/separate-openapi-schemas.md index eaecb27de..974341dd2 100644 --- a/docs/de/docs/how-to/separate-openapi-schemas.md +++ b/docs/de/docs/how-to/separate-openapi-schemas.md @@ -13,7 +13,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses: //// tab | Python 3.10+ ```Python hl_lines="7" -{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!} +{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!} # Code unterhalb weggelassen 👇 ``` @@ -22,7 +22,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:kwargs
, verwendet werden. Selbst wenn diese keinen Defaultwert haben.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
### Besser mit `Annotated`
@@ -224,7 +224,7 @@ Bedenken Sie, dass Sie, wenn Sie `Annotated` verwenden, dieses Problem nicht hab
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
```
////
@@ -232,7 +232,7 @@ Bedenken Sie, dass Sie, wenn Sie `Annotated` verwenden, dieses Problem nicht hab
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
```
////
@@ -245,7 +245,7 @@ Hier, mit `ge=1`, wird festgelegt, dass `item_id` eine Ganzzahl benötigt, die g
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
```
////
@@ -253,7 +253,7 @@ Hier, mit `ge=1`, wird festgelegt, dass `item_id` eine Ganzzahl benötigt, die g
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
```
////
@@ -267,7 +267,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
////
@@ -282,7 +282,7 @@ Das Gleiche trifft zu auf:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
```
////
@@ -290,7 +290,7 @@ Das Gleiche trifft zu auf:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
```
////
@@ -304,7 +304,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
////
@@ -322,7 +322,7 @@ Das gleiche gilt für lt
../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
```
////
@@ -330,7 +330,7 @@ Das gleiche gilt für lt
../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
```
////
@@ -344,7 +344,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
////
diff --git a/docs/de/docs/tutorial/path-params.md b/docs/de/docs/tutorial/path-params.md
index 2c1b691a8..9cb172c94 100644
--- a/docs/de/docs/tutorial/path-params.md
+++ b/docs/de/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
Sie können Pfad-„Parameter“ oder -„Variablen“ mit der gleichen Syntax deklarieren, welche in Python-Format-Strings verwendet wird:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
Der Wert des Pfad-Parameters `item_id` wird Ihrer Funktion als das Argument `item_id` übergeben.
@@ -19,7 +19,7 @@ Wenn Sie dieses Beispiel ausführen und auf ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
```
////
@@ -15,7 +15,7 @@ Nehmen wir als Beispiel die folgende Anwendung:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
```
////
@@ -46,7 +46,7 @@ Importieren Sie zuerst:
In Python 3.9 oder darüber, ist `Annotated` Teil der Standardbibliothek, also können Sie es von `typing` importieren.
```Python hl_lines="1 3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -58,7 +58,7 @@ In Versionen unter Python 3.9 importieren Sie `Annotated` von `typing_extensions
Es wird bereits mit FastAPI installiert sein.
```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -126,7 +126,7 @@ Jetzt, da wir `Annotated` für unsere Metadaten deklariert haben, fügen Sie `Qu
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -134,7 +134,7 @@ Jetzt, da wir `Annotated` für unsere Metadaten deklariert haben, fügen Sie `Qu
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -164,7 +164,7 @@ So würden Sie `Query()` als Defaultwert Ihres Funktionsparameters verwenden, de
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
```
////
@@ -172,7 +172,7 @@ So würden Sie `Query()` als Defaultwert Ihres Funktionsparameters verwenden, de
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
```
////
@@ -278,7 +278,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
```
////
@@ -286,7 +286,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
```
////
@@ -294,7 +294,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
```
////
@@ -308,7 +308,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
```
////
@@ -322,7 +322,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
```
////
@@ -334,7 +334,7 @@ Sie können einen ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
```
////
@@ -342,7 +342,7 @@ Sie können einen ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
```
////
@@ -350,7 +350,7 @@ Sie können einen ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
```
////
@@ -364,7 +364,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
```
////
@@ -378,7 +378,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
```
////
@@ -402,7 +402,7 @@ Sie könnten immer noch Code sehen, der den alten Namen verwendet:
//// tab | Python 3.10+ Pydantic v1
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
```
////
@@ -418,7 +418,7 @@ Beispielsweise könnten Sie den `q` Query-Parameter so deklarieren, dass er eine
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
```
////
@@ -426,7 +426,7 @@ Beispielsweise könnten Sie den `q` Query-Parameter so deklarieren, dass er eine
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
```
////
@@ -440,7 +440,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
```
////
@@ -488,7 +488,7 @@ Wenn Sie einen Parameter erforderlich machen wollen, während Sie `Query` verwen
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
```
////
@@ -496,7 +496,7 @@ Wenn Sie einen Parameter erforderlich machen wollen, während Sie `Query` verwen
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
```
////
@@ -510,7 +510,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// tip | "Tipp"
@@ -530,7 +530,7 @@ Es gibt eine Alternative, die explizit deklariert, dass ein Wert erforderlich is
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
```
////
@@ -538,7 +538,7 @@ Es gibt eine Alternative, die explizit deklariert, dass ein Wert erforderlich is
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
```
////
@@ -552,7 +552,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
```
////
@@ -576,7 +576,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
```
////
@@ -584,7 +584,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
```
////
@@ -592,7 +592,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
```
////
@@ -606,7 +606,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
```
////
@@ -620,7 +620,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
```
////
@@ -646,7 +646,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
```
////
@@ -654,7 +654,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
```
////
@@ -662,7 +662,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
```
////
@@ -676,7 +676,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
```
////
@@ -690,7 +690,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
```
////
@@ -704,7 +704,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
```
////
@@ -745,7 +745,7 @@ Und Sie können auch eine Default-`list`e von Werten definieren, wenn keine übe
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
```
////
@@ -753,7 +753,7 @@ Und Sie können auch eine Default-`list`e von Werten definieren, wenn keine übe
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
```
////
@@ -767,7 +767,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
```
////
@@ -781,7 +781,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
```
////
@@ -810,7 +810,7 @@ Sie können auch `list` direkt verwenden, anstelle von `List[str]` (oder `list[s
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
```
////
@@ -818,7 +818,7 @@ Sie können auch `list` direkt verwenden, anstelle von `List[str]` (oder `list[s
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
```
////
@@ -832,7 +832,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
```
////
@@ -864,7 +864,7 @@ Sie können einen Titel hinzufügen – `title`:
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
```
////
@@ -872,7 +872,7 @@ Sie können einen Titel hinzufügen – `title`:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
```
////
@@ -880,7 +880,7 @@ Sie können einen Titel hinzufügen – `title`:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
```
////
@@ -894,7 +894,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
```
////
@@ -908,7 +908,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
```
////
@@ -918,7 +918,7 @@ Und eine Beschreibung – `description`:
//// tab | Python 3.10+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
```
////
@@ -926,7 +926,7 @@ Und eine Beschreibung – `description`:
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
```
////
@@ -934,7 +934,7 @@ Und eine Beschreibung – `description`:
//// tab | Python 3.8+
```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
```
////
@@ -948,7 +948,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
```
////
@@ -962,7 +962,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
```
////
@@ -988,7 +988,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
```
////
@@ -996,7 +996,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
```
////
@@ -1004,7 +1004,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
```
////
@@ -1018,7 +1018,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
```
////
@@ -1032,7 +1032,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
```
////
@@ -1048,7 +1048,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
//// tab | Python 3.10+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
```
////
@@ -1056,7 +1056,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
//// tab | Python 3.9+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
```
////
@@ -1064,7 +1064,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
//// tab | Python 3.8+
```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
```
////
@@ -1078,7 +1078,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
```
////
@@ -1092,7 +1092,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
```
////
@@ -1108,7 +1108,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
```
////
@@ -1116,7 +1116,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
```
////
@@ -1124,7 +1124,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
```
////
@@ -1138,7 +1138,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
```
////
@@ -1152,7 +1152,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
```
////
diff --git a/docs/de/docs/tutorial/query-params.md b/docs/de/docs/tutorial/query-params.md
index 136852216..bb1dbdf9c 100644
--- a/docs/de/docs/tutorial/query-params.md
+++ b/docs/de/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
Wenn Sie in ihrer Funktion Parameter deklarieren, die nicht Teil der Pfad-Parameter sind, dann werden diese automatisch als „Query“-Parameter interpretiert.
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
Query-Parameter (Deutsch: Abfrage-Parameter) sind die Schlüssel-Wert-Paare, die nach dem `?` in einer URL aufgelistet sind, getrennt durch `&`-Zeichen.
@@ -66,7 +66,7 @@ Auf die gleiche Weise können Sie optionale Query-Parameter deklarieren, indem S
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
```
////
@@ -74,7 +74,7 @@ Auf die gleiche Weise können Sie optionale Query-Parameter deklarieren, indem S
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
```
////
@@ -94,7 +94,7 @@ Sie können auch `bool`-Typen deklarieren und sie werden konvertiert:
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
```
////
@@ -102,7 +102,7 @@ Sie können auch `bool`-Typen deklarieren und sie werden konvertiert:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
```
////
@@ -150,7 +150,7 @@ Parameter werden anhand ihres Namens erkannt:
//// tab | Python 3.10+
```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
```
////
@@ -158,7 +158,7 @@ Parameter werden anhand ihres Namens erkannt:
//// tab | Python 3.8+
```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
```
////
@@ -172,7 +172,7 @@ Wenn Sie keinen spezifischen Wert haben wollen, sondern der Parameter einfach op
Aber wenn Sie wollen, dass ein Query-Parameter erforderlich ist, vergeben Sie einfach keinen Defaultwert:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
Hier ist `needy` ein erforderlicher Query-Parameter vom Typ `str`.
@@ -222,7 +222,7 @@ Und natürlich können Sie einige Parameter als erforderlich, einige mit Default
//// tab | Python 3.10+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
```
////
@@ -230,7 +230,7 @@ Und natürlich können Sie einige Parameter als erforderlich, einige mit Default
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
```
////
diff --git a/docs/de/docs/tutorial/request-files.md b/docs/de/docs/tutorial/request-files.md
index cf44df5f0..c0d0ef3f2 100644
--- a/docs/de/docs/tutorial/request-files.md
+++ b/docs/de/docs/tutorial/request-files.md
@@ -19,7 +19,7 @@ Importieren Sie `File` und `UploadFile` von `fastapi`:
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -27,7 +27,7 @@ Importieren Sie `File` und `UploadFile` von `fastapi`:
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -41,7 +41,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -53,7 +53,7 @@ Erstellen Sie Datei-Parameter, so wie Sie es auch mit `Body` und `Form` machen w
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -61,7 +61,7 @@ Erstellen Sie Datei-Parameter, so wie Sie es auch mit `Body` und `Form` machen w
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -109,7 +109,7 @@ Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`:
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -117,7 +117,7 @@ Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`:
//// tab | Python 3.8+
```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -131,7 +131,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -220,7 +220,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
//// tab | Python 3.10+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
```
////
@@ -228,7 +228,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
//// tab | Python 3.9+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
```
////
@@ -236,7 +236,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
//// tab | Python 3.8+
```Python hl_lines="10 18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
```
////
@@ -250,7 +250,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7 15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
```
////
@@ -264,7 +264,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
```
////
@@ -276,7 +276,7 @@ Sie können auch `File()` zusammen mit `UploadFile` verwenden, um zum Beispiel z
//// tab | Python 3.9+
```Python hl_lines="9 15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
```
////
@@ -284,7 +284,7 @@ Sie können auch `File()` zusammen mit `UploadFile` verwenden, um zum Beispiel z
//// tab | Python 3.8+
```Python hl_lines="8 14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
```
////
@@ -298,7 +298,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7 13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
```
////
@@ -314,7 +314,7 @@ Um das zu machen, deklarieren Sie eine Liste von `bytes` oder `UploadFile`s:
//// tab | Python 3.9+
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
```
////
@@ -322,7 +322,7 @@ Um das zu machen, deklarieren Sie eine Liste von `bytes` oder `UploadFile`s:
//// tab | Python 3.8+
```Python hl_lines="11 16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
```
////
@@ -336,7 +336,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="8 13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
```
////
@@ -350,7 +350,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
```
////
@@ -372,7 +372,7 @@ Und so wie zuvor können Sie `File()` verwenden, um zusätzliche Parameter zu se
//// tab | Python 3.9+
```Python hl_lines="11 18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
```
////
@@ -380,7 +380,7 @@ Und so wie zuvor können Sie `File()` verwenden, um zusätzliche Parameter zu se
//// tab | Python 3.8+
```Python hl_lines="12 19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
```
////
@@ -394,7 +394,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="9 16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
```
////
@@ -408,7 +408,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="11 18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
```
////
diff --git a/docs/de/docs/tutorial/request-forms-and-files.md b/docs/de/docs/tutorial/request-forms-and-files.md
index e109595d1..2b89edbb4 100644
--- a/docs/de/docs/tutorial/request-forms-and-files.md
+++ b/docs/de/docs/tutorial/request-forms-and-files.md
@@ -15,7 +15,7 @@ Z. B. `pip install python-multipart`.
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -23,7 +23,7 @@ Z. B. `pip install python-multipart`.
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -37,7 +37,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
@@ -49,7 +49,7 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q
//// tab | Python 3.9+
```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -57,7 +57,7 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q
//// tab | Python 3.8+
```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -71,7 +71,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
diff --git a/docs/de/docs/tutorial/request-forms.md b/docs/de/docs/tutorial/request-forms.md
index 391788aff..0784aa8c0 100644
--- a/docs/de/docs/tutorial/request-forms.md
+++ b/docs/de/docs/tutorial/request-forms.md
@@ -17,7 +17,7 @@ Importieren Sie `Form` von `fastapi`:
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@ Importieren Sie `Form` von `fastapi`:
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
@@ -51,7 +51,7 @@ Erstellen Sie Formular-Parameter, so wie Sie es auch mit `Body` und `Query` mach
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -59,7 +59,7 @@ Erstellen Sie Formular-Parameter, so wie Sie es auch mit `Body` und `Query` mach
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -73,7 +73,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
diff --git a/docs/de/docs/tutorial/response-model.md b/docs/de/docs/tutorial/response-model.md
index b480780bc..31ad73c77 100644
--- a/docs/de/docs/tutorial/response-model.md
+++ b/docs/de/docs/tutorial/response-model.md
@@ -7,7 +7,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
//// tab | Python 3.10+
```Python hl_lines="16 21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
```
////
@@ -15,7 +15,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
//// tab | Python 3.9+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
```
////
@@ -23,7 +23,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
//// tab | Python 3.8+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
```
////
@@ -62,7 +62,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
//// tab | Python 3.10+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
```
////
@@ -70,7 +70,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
//// tab | Python 3.9+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
```
////
@@ -78,7 +78,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
//// tab | Python 3.8+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
```
////
@@ -116,7 +116,7 @@ Im Folgenden deklarieren wir ein `UserIn`-Modell; es enthält ein Klartext-Passw
//// tab | Python 3.10+
```Python hl_lines="7 9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -124,7 +124,7 @@ Im Folgenden deklarieren wir ein `UserIn`-Modell; es enthält ein Klartext-Passw
//// tab | Python 3.8+
```Python hl_lines="9 11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -143,7 +143,7 @@ Wir verwenden dieses Modell, um sowohl unsere Eingabe- als auch Ausgabedaten zu
//// tab | Python 3.10+
```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -151,7 +151,7 @@ Wir verwenden dieses Modell, um sowohl unsere Eingabe- als auch Ausgabedaten zu
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -175,7 +175,7 @@ Wir können stattdessen ein Eingabemodell mit dem Klartext-Passwort, und ein Aus
//// tab | Python 3.10+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -183,7 +183,7 @@ Wir können stattdessen ein Eingabemodell mit dem Klartext-Passwort, und ein Aus
//// tab | Python 3.8+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -193,7 +193,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
//// tab | Python 3.10+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -201,7 +201,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -211,7 +211,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -219,7 +219,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
//// tab | Python 3.8+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -249,7 +249,7 @@ Und in solchen Fällen können wir Klassen und Vererbung verwenden, um Vorteil a
//// tab | Python 3.10+
```Python hl_lines="7-10 13-14 18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
```
////
@@ -257,7 +257,7 @@ Und in solchen Fällen können wir Klassen und Vererbung verwenden, um Vorteil a
//// tab | Python 3.8+
```Python hl_lines="9-13 15-16 20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
```
////
@@ -303,7 +303,7 @@ Es kann Fälle geben, bei denen Sie etwas zurückgeben, das kein gültiges Pydan
Der häufigste Anwendungsfall ist, wenn Sie [eine Response direkt zurückgeben, wie es später im Handbuch für fortgeschrittene Benutzer erläutert wird](../advanced/response-directly.md){.internal-link target=_blank}.
```Python hl_lines="8 10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
```
Dieser einfache Anwendungsfall wird automatisch von FastAPI gehandhabt, weil die Annotation des Rückgabetyps die Klasse (oder eine Unterklasse von) `Response` ist.
@@ -315,7 +315,7 @@ Und Tools werden auch glücklich sein, weil sowohl `RedirectResponse` als auch `
Sie können auch eine Unterklasse von `Response` in der Typannotation verwenden.
```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
```
Das wird ebenfalls funktionieren, weil `RedirectResponse` eine Unterklasse von `Response` ist, und FastAPI sich um diesen einfachen Anwendungsfall automatisch kümmert.
@@ -329,7 +329,7 @@ Das gleiche wird passieren, wenn Sie eine ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
```
////
@@ -355,7 +355,7 @@ In diesem Fall können Sie die Generierung des Responsemodells abschalten, indem
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
```
////
@@ -363,7 +363,7 @@ In diesem Fall können Sie die Generierung des Responsemodells abschalten, indem
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
```
////
@@ -377,7 +377,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
//// tab | Python 3.10+
```Python hl_lines="9 11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -385,7 +385,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
//// tab | Python 3.9+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -393,7 +393,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
//// tab | Python 3.8+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -413,7 +413,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -421,7 +421,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
//// tab | Python 3.9+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -429,7 +429,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -532,7 +532,7 @@ Das trifft auch auf `response_model_by_alias` zu, welches ähnlich funktioniert.
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
```
////
@@ -540,7 +540,7 @@ Das trifft auch auf `response_model_by_alias` zu, welches ähnlich funktioniert.
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
```
////
@@ -560,7 +560,7 @@ Wenn Sie vergessen, ein `set` zu verwenden, und stattdessen eine `list`e oder ei
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
```
////
@@ -568,7 +568,7 @@ Wenn Sie vergessen, ein `set` zu verwenden, und stattdessen eine `list`e oder ei
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
```
////
diff --git a/docs/de/docs/tutorial/response-status-code.md b/docs/de/docs/tutorial/response-status-code.md
index 5f96b83e4..872007a12 100644
--- a/docs/de/docs/tutorial/response-status-code.md
+++ b/docs/de/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@ So wie ein Responsemodell, können Sie auch einen HTTP-Statuscode für die Respo
* usw.
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note | "Hinweis"
@@ -77,7 +77,7 @@ Um mehr über Statuscodes zu lernen, und welcher wofür verwendet wird, lesen Si
Schauen wir uns das vorherige Beispiel noch einmal an:
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
`201` ist der Statuscode für „Created“ („Erzeugt“).
@@ -87,7 +87,7 @@ Aber Sie müssen sich nicht daran erinnern, welcher dieser Codes was bedeutet.
Sie können die Hilfsvariablen von `fastapi.status` verwenden.
```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
```
Diese sind nur eine Annehmlichkeit und enthalten dieselbe Nummer, aber auf diese Weise können Sie die Autovervollständigung Ihres Editors verwenden, um sie zu finden:
diff --git a/docs/de/docs/tutorial/schema-extra-example.md b/docs/de/docs/tutorial/schema-extra-example.md
index 07b4bb759..0da1a4ea4 100644
--- a/docs/de/docs/tutorial/schema-extra-example.md
+++ b/docs/de/docs/tutorial/schema-extra-example.md
@@ -11,7 +11,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
//// tab | Python 3.10+ Pydantic v2
```Python hl_lines="13-24"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
```
////
@@ -19,7 +19,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
//// tab | Python 3.10+ Pydantic v1
```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
```
////
@@ -27,7 +27,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
//// tab | Python 3.8+ Pydantic v2
```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
```
////
@@ -35,7 +35,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
//// tab | Python 3.8+ Pydantic v1
```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
```
////
@@ -83,7 +83,7 @@ Wenn Sie `Field()` mit Pydantic-Modellen verwenden, können Sie ebenfalls zusät
//// tab | Python 3.10+
```Python hl_lines="2 8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
```
////
@@ -91,7 +91,7 @@ Wenn Sie `Field()` mit Pydantic-Modellen verwenden, können Sie ebenfalls zusät
//// tab | Python 3.8+
```Python hl_lines="4 10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
```
////
@@ -117,7 +117,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
//// tab | Python 3.10+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
```
////
@@ -125,7 +125,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
//// tab | Python 3.9+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
```
////
@@ -133,7 +133,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
//// tab | Python 3.8+
```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
```
////
@@ -147,7 +147,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
```
////
@@ -161,7 +161,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
```
////
@@ -179,7 +179,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
//// tab | Python 3.10+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
```
////
@@ -187,7 +187,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
//// tab | Python 3.9+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
```
////
@@ -195,7 +195,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
//// tab | Python 3.8+
```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
```
////
@@ -209,7 +209,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
```
////
@@ -223,7 +223,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
```
////
@@ -270,7 +270,7 @@ Sie können es so verwenden:
//// tab | Python 3.10+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
```
////
@@ -278,7 +278,7 @@ Sie können es so verwenden:
//// tab | Python 3.9+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
```
////
@@ -286,7 +286,7 @@ Sie können es so verwenden:
//// tab | Python 3.8+
```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
```
////
@@ -300,7 +300,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
```
////
@@ -314,7 +314,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
```
////
diff --git a/docs/de/docs/tutorial/security/first-steps.md b/docs/de/docs/tutorial/security/first-steps.md
index 6bc42cf6c..c552a681b 100644
--- a/docs/de/docs/tutorial/security/first-steps.md
+++ b/docs/de/docs/tutorial/security/first-steps.md
@@ -23,7 +23,7 @@ Kopieren Sie das Beispiel in eine Datei `main.py`:
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -31,7 +31,7 @@ Kopieren Sie das Beispiel in eine Datei `main.py`:
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -45,7 +45,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -157,7 +157,7 @@ Wenn wir eine Instanz der Klasse `OAuth2PasswordBearer` erstellen, übergeben wi
//// tab | Python 3.9+
```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -165,7 +165,7 @@ Wenn wir eine Instanz der Klasse `OAuth2PasswordBearer` erstellen, übergeben wi
//// tab | Python 3.8+
```Python hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -223,7 +223,7 @@ Jetzt können Sie dieses `oauth2_scheme` als Abhängigkeit `Depends` übergeben.
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -231,7 +231,7 @@ Jetzt können Sie dieses `oauth2_scheme` als Abhängigkeit `Depends` übergeben.
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -245,7 +245,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
diff --git a/docs/de/docs/tutorial/security/get-current-user.md b/docs/de/docs/tutorial/security/get-current-user.md
index 8a68deeef..a9478a36e 100644
--- a/docs/de/docs/tutorial/security/get-current-user.md
+++ b/docs/de/docs/tutorial/security/get-current-user.md
@@ -5,7 +5,7 @@ Im vorherigen Kapitel hat das Sicherheitssystem (das auf dem Dependency Injectio
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -13,7 +13,7 @@ Im vorherigen Kapitel hat das Sicherheitssystem (das auf dem Dependency Injectio
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -27,7 +27,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -45,7 +45,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
//// tab | Python 3.10+
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -53,7 +53,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
//// tab | Python 3.9+
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -61,7 +61,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
//// tab | Python 3.8+
```Python hl_lines="5 13-17"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="3 10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -89,7 +89,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -107,7 +107,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
//// tab | Python 3.10+
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -115,7 +115,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
//// tab | Python 3.9+
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -123,7 +123,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
//// tab | Python 3.8+
```Python hl_lines="26"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -137,7 +137,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -151,7 +151,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -163,7 +163,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
//// tab | Python 3.10+
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -171,7 +171,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
//// tab | Python 3.9+
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
//// tab | Python 3.8+
```Python hl_lines="20-23 27-28"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -193,7 +193,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="17-20 24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -207,7 +207,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -219,7 +219,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
//// tab | Python 3.10+
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -227,7 +227,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
//// tab | Python 3.9+
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -235,7 +235,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
//// tab | Python 3.8+
```Python hl_lines="32"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -249,7 +249,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -263,7 +263,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -323,7 +323,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
//// tab | Python 3.10+
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -331,7 +331,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
//// tab | Python 3.9+
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -339,7 +339,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
//// tab | Python 3.8+
```Python hl_lines="31-33"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -353,7 +353,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -367,7 +367,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
diff --git a/docs/de/docs/tutorial/security/oauth2-jwt.md b/docs/de/docs/tutorial/security/oauth2-jwt.md
index 88f0dbe42..79e817840 100644
--- a/docs/de/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/de/docs/tutorial/security/oauth2-jwt.md
@@ -121,7 +121,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
//// tab | Python 3.10+
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -129,7 +129,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
//// tab | Python 3.9+
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -137,7 +137,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
//// tab | Python 3.8+
```Python hl_lines="7 49 56-57 60-61 70-76"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -151,7 +151,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="6 47 54-55 58-59 68-74"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -165,7 +165,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -207,7 +207,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
//// tab | Python 3.10+
```Python hl_lines="6 12-14 28-30 78-86"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -215,7 +215,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
//// tab | Python 3.9+
```Python hl_lines="6 12-14 28-30 78-86"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -223,7 +223,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
//// tab | Python 3.8+
```Python hl_lines="6 13-15 29-31 79-87"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -237,7 +237,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="5 11-13 27-29 77-85"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -251,7 +251,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="6 12-14 28-30 78-86"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -267,7 +267,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
//// tab | Python 3.10+
```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -275,7 +275,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
//// tab | Python 3.9+
```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -283,7 +283,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
//// tab | Python 3.8+
```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -297,7 +297,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="88-105"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -311,7 +311,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -325,7 +325,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
//// tab | Python 3.10+
```Python hl_lines="117-132"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -333,7 +333,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
//// tab | Python 3.9+
```Python hl_lines="117-132"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -341,7 +341,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
//// tab | Python 3.8+
```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -355,7 +355,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="114-129"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -369,7 +369,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
diff --git a/docs/de/docs/tutorial/security/simple-oauth2.md b/docs/de/docs/tutorial/security/simple-oauth2.md
index 3b1c4ae28..4c20fae55 100644
--- a/docs/de/docs/tutorial/security/simple-oauth2.md
+++ b/docs/de/docs/tutorial/security/simple-oauth2.md
@@ -55,7 +55,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
//// tab | Python 3.10+
```Python hl_lines="4 78"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -63,7 +63,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
//// tab | Python 3.9+
```Python hl_lines="4 78"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -71,7 +71,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
//// tab | Python 3.8+
```Python hl_lines="4 79"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -85,7 +85,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="2 74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -99,7 +99,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="4 76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -153,7 +153,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
//// tab | Python 3.10+
```Python hl_lines="3 79-81"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -161,7 +161,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
//// tab | Python 3.9+
```Python hl_lines="3 79-81"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -169,7 +169,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
//// tab | Python 3.8+
```Python hl_lines="3 80-82"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -183,7 +183,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="1 75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -197,7 +197,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="3 77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -229,7 +229,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
//// tab | Python 3.10+
```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -237,7 +237,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
//// tab | Python 3.9+
```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -245,7 +245,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
//// tab | Python 3.8+
```Python hl_lines="83-86"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -259,7 +259,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -273,7 +273,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -321,7 +321,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
//// tab | Python 3.10+
```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -329,7 +329,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
//// tab | Python 3.9+
```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -337,7 +337,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
//// tab | Python 3.8+
```Python hl_lines="88"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -351,7 +351,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -365,7 +365,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -397,7 +397,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
//// tab | Python 3.10+
```Python hl_lines="58-66 69-74 94"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -405,7 +405,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
//// tab | Python 3.9+
```Python hl_lines="58-66 69-74 94"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -413,7 +413,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
//// tab | Python 3.8+
```Python hl_lines="59-67 70-75 95"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -427,7 +427,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="56-64 67-70 88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -441,7 +441,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python hl_lines="58-66 69-72 90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
diff --git a/docs/de/docs/tutorial/static-files.md b/docs/de/docs/tutorial/static-files.md
index cca8cd0ea..4afd251aa 100644
--- a/docs/de/docs/tutorial/static-files.md
+++ b/docs/de/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@ Mit `StaticFiles` können Sie statische Dateien aus einem Verzeichnis automatisc
* „Mounten“ Sie eine `StaticFiles()`-Instanz in einem bestimmten Pfad.
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "Technische Details"
diff --git a/docs/de/docs/tutorial/testing.md b/docs/de/docs/tutorial/testing.md
index 43ced2aae..bda6d7d60 100644
--- a/docs/de/docs/tutorial/testing.md
+++ b/docs/de/docs/tutorial/testing.md
@@ -27,7 +27,7 @@ Verwenden Sie das `TestClient`-Objekt auf die gleiche Weise wie `httpx`.
Schreiben Sie einfache `assert`-Anweisungen mit den Standard-Python-Ausdrücken, die Sie überprüfen müssen (wiederum, Standard-`pytest`).
```Python hl_lines="2 12 15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
```
/// tip | "Tipp"
@@ -75,7 +75,7 @@ In der Datei `main.py` haben Sie Ihre **FastAPI**-Anwendung:
```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
```
### Testdatei
@@ -93,7 +93,7 @@ Dann könnten Sie eine Datei `test_main.py` mit Ihren Tests haben. Sie könnte s
Da sich diese Datei im selben Package befindet, können Sie relative Importe verwenden, um das Objekt `app` aus dem `main`-Modul (`main.py`) zu importieren:
```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
```
... und haben den Code für die Tests wie zuvor.
@@ -125,7 +125,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
//// tab | Python 3.10+
```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
```
////
@@ -133,7 +133,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
```
////
@@ -141,7 +141,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
```
////
@@ -155,7 +155,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
```
////
@@ -169,7 +169,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
///
```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
```
////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
Anschließend könnten Sie `test_main.py` mit den erweiterten Tests aktualisieren:
```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
```
Wenn Sie möchten, dass der Client Informationen im Request übergibt und Sie nicht wissen, wie das geht, können Sie suchen (googeln), wie es mit `httpx` gemacht wird, oder sogar, wie es mit `requests` gemacht wird, da das Design von HTTPX auf dem Design von Requests basiert.
diff --git a/docs/em/docs/advanced/additional-responses.md b/docs/em/docs/advanced/additional-responses.md
index 7a70718c5..e4442135e 100644
--- a/docs/em/docs/advanced/additional-responses.md
+++ b/docs/em/docs/advanced/additional-responses.md
@@ -27,7 +27,7 @@
🖼, 📣 ➕1️⃣ 📨 ⏮️ 👔 📟 `404` & Pydantic 🏷 `Message`, 👆 💪 ✍:
```Python hl_lines="18 22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
```
/// note
@@ -178,7 +178,7 @@
🖼, 👆 💪 🚮 🌖 📻 🆎 `image/png`, 📣 👈 👆 *➡ 🛠️* 💪 📨 🎻 🎚 (⏮️ 📻 🆎 `application/json`) ⚖️ 🇩🇴 🖼:
```Python hl_lines="19-24 28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
```
/// note
@@ -208,7 +208,7 @@
& 📨 ⏮️ 👔 📟 `200` 👈 ⚙️ 👆 `response_model`, ✋️ 🔌 🛃 `example`:
```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
```
⚫️ 🔜 🌐 🌀 & 🔌 👆 🗄, & 🎦 🛠️ 🩺:
@@ -244,7 +244,7 @@ new_dict = {**old_dict, "new key": "new value"}
🖼:
```Python hl_lines="13-17 26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
```
## 🌖 ℹ 🔃 🗄 📨
diff --git a/docs/em/docs/advanced/additional-status-codes.md b/docs/em/docs/advanced/additional-status-codes.md
index 3f3b0aea4..7a50e1bca 100644
--- a/docs/em/docs/advanced/additional-status-codes.md
+++ b/docs/em/docs/advanced/additional-status-codes.md
@@ -15,7 +15,7 @@
🏆 👈, 🗄 `JSONResponse`, & 📨 👆 🎚 📤 🔗, ⚒ `status_code` 👈 👆 💚:
```Python hl_lines="4 25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
```
/// warning
diff --git a/docs/em/docs/advanced/advanced-dependencies.md b/docs/em/docs/advanced/advanced-dependencies.md
index 22044c783..721428ce4 100644
--- a/docs/em/docs/advanced/advanced-dependencies.md
+++ b/docs/em/docs/advanced/advanced-dependencies.md
@@ -19,7 +19,7 @@
👈, 👥 📣 👩🔬 `__call__`:
```Python hl_lines="10"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
```
👉 💼, 👉 `__call__` ⚫️❔ **FastAPI** 🔜 ⚙️ ✅ 🌖 🔢 & 🎧-🔗, & 👉 ⚫️❔ 🔜 🤙 🚶♀️ 💲 🔢 👆 *➡ 🛠️ 🔢* ⏪.
@@ -29,7 +29,7 @@
& 🔜, 👥 💪 ⚙️ `__init__` 📣 🔢 👐 👈 👥 💪 ⚙️ "🔗" 🔗:
```Python hl_lines="7"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
```
👉 💼, **FastAPI** 🏆 🚫 ⏱ 👆 ⚖️ 💅 🔃 `__init__`, 👥 🔜 ⚙️ ⚫️ 🔗 👆 📟.
@@ -39,7 +39,7 @@
👥 💪 ✍ 👐 👉 🎓 ⏮️:
```Python hl_lines="16"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
```
& 👈 🌌 👥 💪 "🔗" 👆 🔗, 👈 🔜 ✔️ `"bar"` 🔘 ⚫️, 🔢 `checker.fixed_content`.
@@ -57,7 +57,7 @@ checker(q="somequery")
...& 🚶♀️ ⚫️❔ 👈 📨 💲 🔗 👆 *➡ 🛠️ 🔢* 🔢 `fixed_content_included`:
```Python hl_lines="20"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/async-tests.md b/docs/em/docs/advanced/async-tests.md
index 11f885fe6..4d468acd4 100644
--- a/docs/em/docs/advanced/async-tests.md
+++ b/docs/em/docs/advanced/async-tests.md
@@ -33,13 +33,13 @@
📁 `main.py` 🔜 ✔️:
```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
```
📁 `test_main.py` 🔜 ✔️ 💯 `main.py`, ⚫️ 💪 👀 💖 👉 🔜:
```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
## 🏃 ⚫️
@@ -61,7 +61,7 @@ $ pytest
📑 `@pytest.mark.anyio` 💬 ✳ 👈 👉 💯 🔢 🔜 🤙 🔁:
```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
/// tip
@@ -73,7 +73,7 @@ $ pytest
⤴️ 👥 💪 ✍ `AsyncClient` ⏮️ 📱, & 📨 🔁 📨 ⚫️, ⚙️ `await`.
```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
👉 🌓:
diff --git a/docs/em/docs/advanced/behind-a-proxy.md b/docs/em/docs/advanced/behind-a-proxy.md
index bb65e1487..e66ddccf7 100644
--- a/docs/em/docs/advanced/behind-a-proxy.md
+++ b/docs/em/docs/advanced/behind-a-proxy.md
@@ -95,7 +95,7 @@ $ uvicorn main:app --root-path /api/v1
📥 👥 ✅ ⚫️ 📧 🎦 🎯.
```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
```
⤴️, 🚥 👆 ▶️ Uvicorn ⏮️:
@@ -124,7 +124,7 @@ $ uvicorn main:app --root-path /api/v1
👐, 🚥 👆 🚫 ✔️ 🌌 🚚 📋 ⏸ 🎛 💖 `--root-path` ⚖️ 🌓, 👆 💪 ⚒ `root_path` 🔢 🕐❔ 🏗 👆 FastAPI 📱:
```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
```
🚶♀️ `root_path` `FastAPI` 🔜 🌓 🚶♀️ `--root-path` 📋 ⏸ 🎛 Uvicorn ⚖️ Hypercorn.
@@ -306,7 +306,7 @@ $ uvicorn main:app --root-path /api/v1
🖼:
```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
```
🔜 🏗 🗄 🔗 💖:
@@ -355,7 +355,7 @@ $ uvicorn main:app --root-path /api/v1
🚥 👆 🚫 💚 **FastAPI** 🔌 🏧 💽 ⚙️ `root_path`, 👆 💪 ⚙️ 🔢 `root_path_in_servers=False`:
```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
```
& ⤴️ ⚫️ 🏆 🚫 🔌 ⚫️ 🗄 🔗.
diff --git a/docs/em/docs/advanced/custom-response.md b/docs/em/docs/advanced/custom-response.md
index eec87b91b..7147a4536 100644
--- a/docs/em/docs/advanced/custom-response.md
+++ b/docs/em/docs/advanced/custom-response.md
@@ -31,7 +31,7 @@
✋️ 🚥 👆 🎯 👈 🎚 👈 👆 🛬 **🎻 ⏮️ 🎻**, 👆 💪 🚶♀️ ⚫️ 🔗 📨 🎓 & ❎ ➕ 🌥 👈 FastAPI 🔜 ✔️ 🚶♀️ 👆 📨 🎚 🔘 `jsonable_encoder` ⏭ 🚶♀️ ⚫️ 📨 🎓.
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
```
/// info
@@ -58,7 +58,7 @@
* 🚶♀️ `HTMLResponse` 🔢 `response_class` 👆 *➡ 🛠️ 👨🎨*.
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
```
/// info
@@ -78,7 +78,7 @@
🎏 🖼 ⚪️➡️ 🔛, 🛬 `HTMLResponse`, 💪 👀 💖:
```Python hl_lines="2 7 19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
```
/// warning
@@ -104,7 +104,7 @@
🖼, ⚫️ 💪 🕳 💖:
```Python hl_lines="7 21 23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
```
👉 🖼, 🔢 `generate_html_response()` ⏪ 🏗 & 📨 `Response` ↩️ 🛬 🕸 `str`.
@@ -145,7 +145,7 @@
FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 🎚, ⚓️ 🔛 = & 🔁 = ✍ 🆎.
```Python hl_lines="1 18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
```
### `HTMLResponse`
@@ -157,7 +157,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
✊ ✍ ⚖️ 🔢 & 📨 ✅ ✍ 📨.
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
```
### `JSONResponse`
@@ -181,7 +181,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
///
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
```
/// tip
@@ -197,7 +197,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
👆 💪 📨 `RedirectResponse` 🔗:
```Python hl_lines="2 9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
```
---
@@ -206,7 +206,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial006b.py!}
+{!../../docs_src/custom_response/tutorial006b.py!}
```
🚥 👆 👈, ⤴️ 👆 💪 📨 📛 🔗 ⚪️➡️ 👆 *➡ 🛠️* 🔢.
@@ -218,7 +218,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
👆 💪 ⚙️ `status_code` 🔢 🌀 ⏮️ `response_class` 🔢:
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial006c.py!}
+{!../../docs_src/custom_response/tutorial006c.py!}
```
### `StreamingResponse`
@@ -226,7 +226,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
✊ 🔁 🚂 ⚖️ 😐 🚂/🎻 & 🎏 📨 💪.
```Python hl_lines="2 14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
```
#### ⚙️ `StreamingResponse` ⏮️ 📁-💖 🎚
@@ -238,7 +238,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
👉 🔌 📚 🗃 🔗 ⏮️ ☁ 💾, 📹 🏭, & 🎏.
```{ .python .annotate hl_lines="2 10-12 14" }
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
```
1️⃣. 👉 🚂 🔢. ⚫️ "🚂 🔢" ↩️ ⚫️ 🔌 `yield` 📄 🔘.
@@ -269,13 +269,13 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
📁 📨 🔜 🔌 ☑ `Content-Length`, `Last-Modified` & `ETag` 🎚.
```Python hl_lines="2 10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
```
👆 💪 ⚙️ `response_class` 🔢:
```Python hl_lines="2 8 10"
-{!../../../docs_src/custom_response/tutorial009b.py!}
+{!../../docs_src/custom_response/tutorial009b.py!}
```
👉 💼, 👆 💪 📨 📁 ➡ 🔗 ⚪️➡️ 👆 *➡ 🛠️* 🔢.
@@ -291,7 +291,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
👆 💪 ✍ `CustomORJSONResponse`. 👑 👜 👆 ✔️ ✍ `Response.render(content)` 👩🔬 👈 📨 🎚 `bytes`:
```Python hl_lines="9-14 17"
-{!../../../docs_src/custom_response/tutorial009c.py!}
+{!../../docs_src/custom_response/tutorial009c.py!}
```
🔜 ↩️ 🛬:
@@ -319,7 +319,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎
🖼 🔛, **FastAPI** 🔜 ⚙️ `ORJSONResponse` 🔢, 🌐 *➡ 🛠️*, ↩️ `JSONResponse`.
```Python hl_lines="2 4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/dataclasses.md b/docs/em/docs/advanced/dataclasses.md
index 3f49ef07c..ab76e5083 100644
--- a/docs/em/docs/advanced/dataclasses.md
+++ b/docs/em/docs/advanced/dataclasses.md
@@ -5,7 +5,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, & 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
✋️ FastAPI 🐕🦺 ⚙️ `dataclasses` 🎏 🌌:
```Python hl_lines="1 7-12 19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
```
👉 🐕🦺 👏 **Pydantic**, ⚫️ ✔️ 🔗 🐕🦺 `dataclasses`.
@@ -35,7 +35,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, & 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
👆 💪 ⚙️ `dataclasses` `response_model` 🔢:
```Python hl_lines="1 7-13 19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
```
🎻 🔜 🔁 🗜 Pydantic 🎻.
@@ -53,7 +53,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, & 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
👈 💼, 👆 💪 🎯 💱 🐩 `dataclasses` ⏮️ `pydantic.dataclasses`, ❔ 💧-♻:
```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" }
-{!../../../docs_src/dataclasses/tutorial003.py!}
+{!../../docs_src/dataclasses/tutorial003.py!}
```
1️⃣. 👥 🗄 `field` ⚪️➡️ 🐩 `dataclasses`.
diff --git a/docs/em/docs/advanced/events.md b/docs/em/docs/advanced/events.md
index 12c902c18..2eae2b366 100644
--- a/docs/em/docs/advanced/events.md
+++ b/docs/em/docs/advanced/events.md
@@ -31,7 +31,7 @@
👥 ✍ 🔁 🔢 `lifespan()` ⏮️ `yield` 💖 👉:
```Python hl_lines="16 19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
📥 👥 ⚖ 😥 *🕴* 🛠️ 🚚 🏷 🚮 (❌) 🏷 🔢 📖 ⏮️ 🎰 🏫 🏷 ⏭ `yield`. 👉 📟 🔜 🛠️ **⏭** 🈸 **▶️ ✊ 📨**, ⏮️ *🕴*.
@@ -51,7 +51,7 @@
🥇 👜 👀, 👈 👥 ⚖ 🔁 🔢 ⏮️ `yield`. 👉 📶 🎏 🔗 ⏮️ `yield`.
```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
🥇 🍕 🔢, ⏭ `yield`, 🔜 🛠️ **⏭** 🈸 ▶️.
@@ -65,7 +65,7 @@
👈 🗜 🔢 🔘 🕳 🤙 "**🔁 🔑 👨💼**".
```Python hl_lines="1 13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
**🔑 👨💼** 🐍 🕳 👈 👆 💪 ⚙️ `with` 📄, 🖼, `open()` 💪 ⚙️ 🔑 👨💼:
@@ -89,7 +89,7 @@ async with lifespan(app):
`lifespan` 🔢 `FastAPI` 📱 ✊ **🔁 🔑 👨💼**, 👥 💪 🚶♀️ 👆 🆕 `lifespan` 🔁 🔑 👨💼 ⚫️.
```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
## 🎛 🎉 (😢)
@@ -113,7 +113,7 @@ async with lifespan(app):
🚮 🔢 👈 🔜 🏃 ⏭ 🈸 ▶️, 📣 ⚫️ ⏮️ 🎉 `"startup"`:
```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
```
👉 💼, `startup` 🎉 🐕🦺 🔢 🔜 🔢 🏬 "💽" ( `dict`) ⏮️ 💲.
@@ -127,7 +127,7 @@ async with lifespan(app):
🚮 🔢 👈 🔜 🏃 🕐❔ 🈸 🤫 🔽, 📣 ⚫️ ⏮️ 🎉 `"shutdown"`:
```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
```
📥, `shutdown` 🎉 🐕🦺 🔢 🔜 ✍ ✍ ⏸ `"Application shutdown"` 📁 `log.txt`.
diff --git a/docs/em/docs/advanced/generate-clients.md b/docs/em/docs/advanced/generate-clients.md
index c8e044340..f09d75623 100644
--- a/docs/em/docs/advanced/generate-clients.md
+++ b/docs/em/docs/advanced/generate-clients.md
@@ -19,7 +19,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9-11 14-15 18 19 23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
```
////
@@ -27,7 +27,7 @@
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="7-9 12-13 16-17 21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
```
////
@@ -139,7 +139,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="23 28 36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
```
////
@@ -147,7 +147,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="21 26 34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
```
////
@@ -200,7 +200,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="8-9 12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
```
////
@@ -208,7 +208,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="6-7 10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
```
////
@@ -234,7 +234,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
👥 💪 ⏬ 🗄 🎻 📁 `openapi.json` & ⤴️ 👥 💪 **❎ 👈 🔡 🔖** ⏮️ ✍ 💖 👉:
```Python
-{!../../../docs_src/generate_clients/tutorial004.py!}
+{!../../docs_src/generate_clients/tutorial004.py!}
```
⏮️ 👈, 🛠️ 🆔 🔜 📁 ⚪️➡️ 👜 💖 `items-get_items` `get_items`, 👈 🌌 👩💻 🚂 💪 🏗 🙅 👩🔬 📛.
diff --git a/docs/em/docs/advanced/middleware.md b/docs/em/docs/advanced/middleware.md
index e3cc389c6..23d2918d7 100644
--- a/docs/em/docs/advanced/middleware.md
+++ b/docs/em/docs/advanced/middleware.md
@@ -58,7 +58,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
🙆 📨 📨 `http` ⚖️ `ws` 🔜 ❎ 🔐 ⚖ ↩️.
```Python hl_lines="2 6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
```
## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
🛠️ 👈 🌐 📨 📨 ✔️ ☑ ⚒ `Host` 🎚, ✔ 💂♂ 🛡 🇺🇸🔍 🦠 🎚 👊.
```Python hl_lines="2 6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
```
📄 ❌ 🐕🦺:
@@ -82,7 +82,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
🛠️ 🔜 🍵 👯♂️ 🐩 & 🎥 📨.
```Python hl_lines="2 6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
```
📄 ❌ 🐕🦺:
diff --git a/docs/em/docs/advanced/openapi-callbacks.md b/docs/em/docs/advanced/openapi-callbacks.md
index 00d54ebec..f7b5e7ed9 100644
--- a/docs/em/docs/advanced/openapi-callbacks.md
+++ b/docs/em/docs/advanced/openapi-callbacks.md
@@ -32,7 +32,7 @@
👉 🍕 📶 😐, 🌅 📟 🎲 ⏪ 😰 👆:
```Python hl_lines="9-13 36-53"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
/// tip
@@ -93,7 +93,7 @@ httpx.post(callback_url, json={"description": "Invoice paid", "paid": True})
🥇 ✍ 🆕 `APIRouter` 👈 🔜 🔌 1️⃣ ⚖️ 🌅 ⏲.
```Python hl_lines="3 25"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
### ✍ ⏲ *➡ 🛠️*
@@ -106,7 +106,7 @@ httpx.post(callback_url, json={"description": "Invoice paid", "paid": True})
* & ⚫️ 💪 ✔️ 📄 📨 ⚫️ 🔜 📨, ✅ `response_model=InvoiceEventReceived`.
```Python hl_lines="16-18 21-22 28-32"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
📤 2️⃣ 👑 🔺 ⚪️➡️ 😐 *➡ 🛠️*:
@@ -176,7 +176,7 @@ https://www.external.org/events/invoices/2expen51ve
🔜 ⚙️ 🔢 `callbacks` *👆 🛠️ ➡ 🛠️ 👨🎨* 🚶♀️ 🔢 `.routes` (👈 🤙 `list` 🛣/*➡ 🛠️*) ⚪️➡️ 👈 ⏲ 📻:
```Python hl_lines="35"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/path-operation-advanced-configuration.md b/docs/em/docs/advanced/path-operation-advanced-configuration.md
index b684df26f..805bfdf30 100644
--- a/docs/em/docs/advanced/path-operation-advanced-configuration.md
+++ b/docs/em/docs/advanced/path-operation-advanced-configuration.md
@@ -13,7 +13,7 @@
👆 🔜 ✔️ ⚒ 💭 👈 ⚫️ 😍 🔠 🛠️.
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### ⚙️ *➡ 🛠️ 🔢* 📛 {
@@ -23,7 +23,7 @@
👆 🔜 ⚫️ ⏮️ ❎ 🌐 👆 *➡ 🛠️*.
```Python hl_lines="2 12-21 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
/// tip
@@ -45,7 +45,7 @@
🚫 *➡ 🛠️* ⚪️➡️ 🏗 🗄 🔗 (& ➡️, ⚪️➡️ 🏧 🧾 ⚙️), ⚙️ 🔢 `include_in_schema` & ⚒ ⚫️ `False`:
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## 🏧 📛 ⚪️➡️ #️⃣
@@ -57,7 +57,7 @@
⚫️ 🏆 🚫 🎦 🆙 🧾, ✋️ 🎏 🧰 (✅ 🐉) 🔜 💪 ⚙️ 🎂.
```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```
## 🌖 📨
@@ -101,7 +101,7 @@
👉 `openapi_extra` 💪 👍, 🖼, 📣 [🗄 ↔](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions):
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
```
🚥 👆 📂 🏧 🛠️ 🩺, 👆 ↔ 🔜 🎦 🆙 🔝 🎯 *➡ 🛠️*.
@@ -150,7 +150,7 @@
👆 💪 👈 ⏮️ `openapi_extra`:
```Python hl_lines="20-37 39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
```
👉 🖼, 👥 🚫 📣 🙆 Pydantic 🏷. 👐, 📨 💪 🚫 🎻 🎻, ⚫️ ✍ 🔗 `bytes`, & 🔢 `magic_data_reader()` 🔜 🈚 🎻 ⚫️ 🌌.
@@ -166,7 +166,7 @@
🖼, 👉 🈸 👥 🚫 ⚙️ FastAPI 🛠️ 🛠️ ⚗ 🎻 🔗 ⚪️➡️ Pydantic 🏷 🚫 🏧 🔬 🎻. 👐, 👥 📣 📨 🎚 🆎 📁, 🚫 🎻:
```Python hl_lines="17-22 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
```
👐, 👐 👥 🚫 ⚙️ 🔢 🛠️ 🛠️, 👥 ⚙️ Pydantic 🏷 ❎ 🏗 🎻 🔗 💽 👈 👥 💚 📨 📁.
@@ -176,7 +176,7 @@
& ⤴️ 👆 📟, 👥 🎻 👈 📁 🎚 🔗, & ⤴️ 👥 🔄 ⚙️ 🎏 Pydantic 🏷 ✔ 📁 🎚:
```Python hl_lines="26-33"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/response-change-status-code.md b/docs/em/docs/advanced/response-change-status-code.md
index 156efcc16..7f2e8c157 100644
--- a/docs/em/docs/advanced/response-change-status-code.md
+++ b/docs/em/docs/advanced/response-change-status-code.md
@@ -21,7 +21,7 @@
& ⤴️ 👆 💪 ⚒ `status_code` 👈 *🔀* 📨 🎚.
```Python hl_lines="1 9 12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
```
& ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
diff --git a/docs/em/docs/advanced/response-cookies.md b/docs/em/docs/advanced/response-cookies.md
index 717fb87ce..6b9e9a4d9 100644
--- a/docs/em/docs/advanced/response-cookies.md
+++ b/docs/em/docs/advanced/response-cookies.md
@@ -7,7 +7,7 @@
& ⤴️ 👆 💪 ⚒ 🍪 👈 *🔀* 📨 🎚.
```Python hl_lines="1 8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
```
& ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
@@ -27,7 +27,7 @@
⤴️ ⚒ 🍪 ⚫️, & ⤴️ 📨 ⚫️:
```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/response-directly.md b/docs/em/docs/advanced/response-directly.md
index 13ee081c2..dcffc56c6 100644
--- a/docs/em/docs/advanced/response-directly.md
+++ b/docs/em/docs/advanced/response-directly.md
@@ -35,7 +35,7 @@
📚 💼, 👆 💪 ⚙️ `jsonable_encoder` 🗜 👆 📊 ⏭ 🚶♀️ ⚫️ 📨:
```Python hl_lines="6-7 21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
```
/// note | "📡 ℹ"
@@ -57,7 +57,7 @@
👆 💪 🚮 👆 📂 🎚 🎻, 🚮 ⚫️ `Response`, & 📨 ⚫️:
```Python hl_lines="1 18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
```
## 🗒
diff --git a/docs/em/docs/advanced/response-headers.md b/docs/em/docs/advanced/response-headers.md
index 27e1cdbd5..cbbbae237 100644
--- a/docs/em/docs/advanced/response-headers.md
+++ b/docs/em/docs/advanced/response-headers.md
@@ -7,7 +7,7 @@
& ⤴️ 👆 💪 ⚒ 🎚 👈 *🔀* 📨 🎚.
```Python hl_lines="1 7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
```
& ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
@@ -25,7 +25,7 @@
✍ 📨 🔬 [📨 📨 🔗](response-directly.md){.internal-link target=_blank} & 🚶♀️ 🎚 🌖 🔢:
```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
```
/// note | "📡 ℹ"
diff --git a/docs/em/docs/advanced/security/http-basic-auth.md b/docs/em/docs/advanced/security/http-basic-auth.md
index 33470a726..e6fe3e32c 100644
--- a/docs/em/docs/advanced/security/http-basic-auth.md
+++ b/docs/em/docs/advanced/security/http-basic-auth.md
@@ -21,7 +21,7 @@
* ⚫️ 🔌 `username` & `password` 📨.
```Python hl_lines="2 6 10"
-{!../../../docs_src/security/tutorial006.py!}
+{!../../docs_src/security/tutorial006.py!}
```
🕐❔ 👆 🔄 📂 📛 🥇 🕰 (⚖️ 🖊 "🛠️" 🔼 🩺) 🖥 🔜 💭 👆 👆 🆔 & 🔐:
@@ -43,7 +43,7 @@
⤴️ 👥 💪 ⚙️ `secrets.compare_digest()` 🚚 👈 `credentials.username` `"stanleyjobson"`, & 👈 `credentials.password` `"swordfish"`.
```Python hl_lines="1 11-21"
-{!../../../docs_src/security/tutorial007.py!}
+{!../../docs_src/security/tutorial007.py!}
```
👉 🔜 🎏:
@@ -109,5 +109,5 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
⏮️ 🔍 👈 🎓 ❌, 📨 `HTTPException` ⏮️ 👔 📟 4️⃣0️⃣1️⃣ (🎏 📨 🕐❔ 🙅♂ 🎓 🚚) & 🚮 🎚 `WWW-Authenticate` ⚒ 🖥 🎦 💳 📋 🔄:
```Python hl_lines="23-27"
-{!../../../docs_src/security/tutorial007.py!}
+{!../../docs_src/security/tutorial007.py!}
```
diff --git a/docs/em/docs/advanced/security/oauth2-scopes.md b/docs/em/docs/advanced/security/oauth2-scopes.md
index 73b2ec540..661be034e 100644
--- a/docs/em/docs/advanced/security/oauth2-scopes.md
+++ b/docs/em/docs/advanced/security/oauth2-scopes.md
@@ -63,7 +63,7 @@ Oauth2️⃣ 👫 🎻.
🥇, ➡️ 🔜 👀 🍕 👈 🔀 ⚪️➡️ 🖼 👑 **🔰 - 👩💻 🦮** [Oauth2️⃣ ⏮️ 🔐 (& 🔁), 📨 ⏮️ 🥙 🤝](../../tutorial/security/oauth2-jwt.md){.internal-link target=_blank}. 🔜 ⚙️ Oauth2️⃣ ↔:
```Python hl_lines="2 4 8 12 46 64 105 107-115 121-124 128-134 139 155"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
🔜 ➡️ 📄 👈 🔀 🔁 🔁.
@@ -75,7 +75,7 @@ Oauth2️⃣ 👫 🎻.
`scopes` 🔢 📨 `dict` ⏮️ 🔠 ↔ 🔑 & 📛 💲:
```Python hl_lines="62-65"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
↩️ 👥 🔜 📣 📚 ↔, 👫 🔜 🎦 🆙 🛠️ 🩺 🕐❔ 👆 🕹-/✔.
@@ -103,7 +103,7 @@ Oauth2️⃣ 👫 🎻.
///
```Python hl_lines="155"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
## 📣 ↔ *➡ 🛠️* & 🔗
@@ -131,7 +131,7 @@ Oauth2️⃣ 👫 🎻.
///
```Python hl_lines="4 139 168"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
/// info | "📡 ℹ"
@@ -159,7 +159,7 @@ Oauth2️⃣ 👫 🎻.
👉 `SecurityScopes` 🎓 🎏 `Request` (`Request` ⚙️ 🤚 📨 🎚 🔗).
```Python hl_lines="8 105"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
## ⚙️ `scopes`
@@ -175,7 +175,7 @@ Oauth2️⃣ 👫 🎻.
👉 ⚠, 👥 🔌 ↔ 🚚 (🚥 🙆) 🎻 👽 🚀 (⚙️ `scope_str`). 👥 🚮 👈 🎻 ⚗ ↔ `WWW-Authenticate` 🎚 (👉 🍕 🔌).
```Python hl_lines="105 107-115"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
## ✔ `username` & 💽 💠
@@ -193,7 +193,7 @@ Oauth2️⃣ 👫 🎻.
👥 ✔ 👈 👥 ✔️ 👩💻 ⏮️ 👈 🆔, & 🚥 🚫, 👥 🤚 👈 🎏 ⚠ 👥 ✍ ⏭.
```Python hl_lines="46 116-127"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
## ✔ `scopes`
@@ -203,7 +203,7 @@ Oauth2️⃣ 👫 🎻.
👉, 👥 ⚙️ `security_scopes.scopes`, 👈 🔌 `list` ⏮️ 🌐 👫 ↔ `str`.
```Python hl_lines="128-134"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
```
## 🔗 🌲 & ↔
diff --git a/docs/em/docs/advanced/settings.md b/docs/em/docs/advanced/settings.md
index e84941b57..59fb71d73 100644
--- a/docs/em/docs/advanced/settings.md
+++ b/docs/em/docs/advanced/settings.md
@@ -149,7 +149,7 @@ Hello World from Python
👆 💪 ⚙️ 🌐 🎏 🔬 ⚒ & 🧰 👆 ⚙️ Pydantic 🏷, 💖 🎏 📊 🆎 & 🌖 🔬 ⏮️ `Field()`.
```Python hl_lines="2 5-8 11"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
```
/// tip
@@ -167,7 +167,7 @@ Hello World from Python
⤴️ 👆 💪 ⚙️ 🆕 `settings` 🎚 👆 🈸:
```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
```
### 🏃 💽
@@ -203,13 +203,13 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
🖼, 👆 💪 ✔️ 📁 `config.py` ⏮️:
```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
```
& ⤴️ ⚙️ ⚫️ 📁 `main.py`:
```Python hl_lines="3 11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
```
/// tip
@@ -229,7 +229,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
👟 ⚪️➡️ ⏮️ 🖼, 👆 `config.py` 📁 💪 👀 💖:
```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
```
👀 👈 🔜 👥 🚫 ✍ 🔢 👐 `settings = Settings()`.
@@ -239,7 +239,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
🔜 👥 ✍ 🔗 👈 📨 🆕 `config.Settings()`.
```Python hl_lines="5 11-12"
-{!../../../docs_src/settings/app02/main.py!}
+{!../../docs_src/settings/app02/main.py!}
```
/// tip
@@ -253,7 +253,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
& ⤴️ 👥 💪 🚚 ⚫️ ⚪️➡️ *➡ 🛠️ 🔢* 🔗 & ⚙️ ⚫️ 🙆 👥 💪 ⚫️.
```Python hl_lines="16 18-20"
-{!../../../docs_src/settings/app02/main.py!}
+{!../../docs_src/settings/app02/main.py!}
```
### ⚒ & 🔬
@@ -261,7 +261,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
⤴️ ⚫️ 🔜 📶 ⏩ 🚚 🎏 ⚒ 🎚 ⏮️ 🔬 🏗 🔗 🔐 `get_settings`:
```Python hl_lines="9-10 13 21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
```
🔗 🔐 👥 ⚒ 🆕 💲 `admin_email` 🕐❔ 🏗 🆕 `Settings` 🎚, & ⤴️ 👥 📨 👈 🆕 🎚.
@@ -304,7 +304,7 @@ APP_NAME="ChimichangApp"
& ⤴️ ℹ 👆 `config.py` ⏮️:
```Python hl_lines="9-10"
-{!../../../docs_src/settings/app03/config.py!}
+{!../../docs_src/settings/app03/config.py!}
```
📥 👥 ✍ 🎓 `Config` 🔘 👆 Pydantic `Settings` 🎓, & ⚒ `env_file` 📁 ⏮️ 🇨🇻 📁 👥 💚 ⚙️.
@@ -339,7 +339,7 @@ def get_settings():
✋️ 👥 ⚙️ `@lru_cache` 👨🎨 🔛 🔝, `Settings` 🎚 🔜 ✍ 🕴 🕐, 🥇 🕰 ⚫️ 🤙. 👶 👶
```Python hl_lines="1 10"
-{!../../../docs_src/settings/app03/main.py!}
+{!../../docs_src/settings/app03/main.py!}
```
⤴️ 🙆 🏁 🤙 `get_settings()` 🔗 ⏭ 📨, ↩️ 🛠️ 🔗 📟 `get_settings()` & 🏗 🆕 `Settings` 🎚, ⚫️ 🔜 📨 🎏 🎚 👈 📨 🔛 🥇 🤙, 🔄 & 🔄.
diff --git a/docs/em/docs/advanced/sub-applications.md b/docs/em/docs/advanced/sub-applications.md
index 1e0931f95..e19f3f234 100644
--- a/docs/em/docs/advanced/sub-applications.md
+++ b/docs/em/docs/advanced/sub-applications.md
@@ -11,7 +11,7 @@
🥇, ✍ 👑, 🔝-🎚, **FastAPI** 🈸, & 🚮 *➡ 🛠️*:
```Python hl_lines="3 6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### 🎧-🈸
@@ -21,7 +21,7 @@
👉 🎧-🈸 ➕1️⃣ 🐩 FastAPI 🈸, ✋️ 👉 1️⃣ 👈 🔜 "🗻":
```Python hl_lines="11 14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### 🗻 🎧-🈸
@@ -31,7 +31,7 @@
👉 💼, ⚫️ 🔜 📌 ➡ `/subapi`:
```Python hl_lines="11 19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### ✅ 🏧 🛠️ 🩺
diff --git a/docs/em/docs/advanced/templates.md b/docs/em/docs/advanced/templates.md
index c45ff47a1..66c7484a6 100644
--- a/docs/em/docs/advanced/templates.md
+++ b/docs/em/docs/advanced/templates.md
@@ -28,7 +28,7 @@ $ pip install jinja2
* ⚙️ `templates` 👆 ✍ ✍ & 📨 `TemplateResponse`, 🚶♀️ `request` 1️⃣ 🔑-💲 👫 Jinja2️⃣ "🔑".
```Python hl_lines="4 11 15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
```
/// note
@@ -56,7 +56,7 @@ $ pip install jinja2
⤴️ 👆 💪 ✍ 📄 `templates/item.html` ⏮️:
```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
```
⚫️ 🔜 🎦 `id` ✊ ⚪️➡️ "🔑" `dict` 👆 🚶♀️:
@@ -70,13 +70,13 @@ $ pip install jinja2
& 👆 💪 ⚙️ `url_for()` 🔘 📄, & ⚙️ ⚫️, 🖼, ⏮️ `StaticFiles` 👆 📌.
```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
```
👉 🖼, ⚫️ 🔜 🔗 🎚 📁 `static/styles.css` ⏮️:
```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
```
& ↩️ 👆 ⚙️ `StaticFiles`, 👈 🎚 📁 🔜 🍦 🔁 👆 **FastAPI** 🈸 📛 `/static/styles.css`.
diff --git a/docs/em/docs/advanced/testing-database.md b/docs/em/docs/advanced/testing-database.md
deleted file mode 100644
index 825d545a9..000000000
--- a/docs/em/docs/advanced/testing-database.md
+++ /dev/null
@@ -1,101 +0,0 @@
-# 🔬 💽
-
-👆 💪 ⚙️ 🎏 🔗 🔐 ⚪️➡️ [🔬 🔗 ⏮️ 🔐](testing-dependencies.md){.internal-link target=_blank} 📉 💽 🔬.
-
-👆 💪 💚 ⚒ 🆙 🎏 💽 🔬, 💾 💽 ⏮️ 💯, 🏤-🥧 ⚫️ ⏮️ 🔬 💽, ♒️.
-
-👑 💭 ⚫️❔ 🎏 👆 👀 👈 ⏮️ 📃.
-
-## 🚮 💯 🗄 📱
-
-➡️ ℹ 🖼 ⚪️➡️ [🗄 (🔗) 💽](../tutorial/sql-databases.md){.internal-link target=_blank} ⚙️ 🔬 💽.
-
-🌐 📱 📟 🎏, 👆 💪 🚶 🔙 👈 📃 ✅ ❔ ⚫️.
-
-🕴 🔀 📥 🆕 🔬 📁.
-
-👆 😐 🔗 `get_db()` 🔜 📨 💽 🎉.
-
-💯, 👆 💪 ⚙️ 🔗 🔐 📨 👆 *🛃* 💽 🎉 ↩️ 1️⃣ 👈 🔜 ⚙️ 🛎.
-
-👉 🖼 👥 🔜 ✍ 🍕 💽 🕴 💯.
-
-## 📁 📊
-
-👥 ✍ 🆕 📁 `sql_app/tests/test_sql_app.py`.
-
-🆕 📁 📊 👀 💖:
-
-``` hl_lines="9-11"
-.
-└── sql_app
- ├── __init__.py
- ├── crud.py
- ├── database.py
- ├── main.py
- ├── models.py
- ├── schemas.py
- └── tests
- ├── __init__.py
- └── test_sql_app.py
-```
-
-## ✍ 🆕 💽 🎉
-
-🥇, 👥 ✍ 🆕 💽 🎉 ⏮️ 🆕 💽.
-
-💯 👥 🔜 ⚙️ 📁 `test.db` ↩️ `sql_app.db`.
-
-✋️ 🎂 🎉 📟 🌅 ⚖️ 🌘 🎏, 👥 📁 ⚫️.
-
-```Python hl_lines="8-13"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-/// tip
-
-👆 💪 📉 ❎ 👈 📟 🚮 ⚫️ 🔢 & ⚙️ ⚫️ ⚪️➡️ 👯♂️ `database.py` & `tests/test_sql_app.py`.
-
-🦁 & 🎯 🔛 🎯 🔬 📟, 👥 🖨 ⚫️.
-
-///
-
-## ✍ 💽
-
-↩️ 🔜 👥 🔜 ⚙️ 🆕 💽 🆕 📁, 👥 💪 ⚒ 💭 👥 ✍ 💽 ⏮️:
-
-```Python
-Base.metadata.create_all(bind=engine)
-```
-
-👈 🛎 🤙 `main.py`, ✋️ ⏸ `main.py` ⚙️ 💽 📁 `sql_app.db`, & 👥 💪 ⚒ 💭 👥 ✍ `test.db` 💯.
-
-👥 🚮 👈 ⏸ 📥, ⏮️ 🆕 📁.
-
-```Python hl_lines="16"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-## 🔗 🔐
-
-🔜 👥 ✍ 🔗 🔐 & 🚮 ⚫️ 🔐 👆 📱.
-
-```Python hl_lines="19-24 27"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-/// tip
-
-📟 `override_get_db()` 🌖 ⚫️❔ 🎏 `get_db()`, ✋️ `override_get_db()` 👥 ⚙️ `TestingSessionLocal` 🔬 💽 ↩️.
-
-///
-
-## 💯 📱
-
-⤴️ 👥 💪 💯 📱 🛎.
-
-```Python hl_lines="32-47"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-& 🌐 🛠️ 👥 ⚒ 💽 ⏮️ 💯 🔜 `test.db` 💽 ↩️ 👑 `sql_app.db`.
diff --git a/docs/em/docs/advanced/testing-dependencies.md b/docs/em/docs/advanced/testing-dependencies.md
index 8bcffcc29..027767df1 100644
--- a/docs/em/docs/advanced/testing-dependencies.md
+++ b/docs/em/docs/advanced/testing-dependencies.md
@@ -29,7 +29,7 @@
& ⤴️ **FastAPI** 🔜 🤙 👈 🔐 ↩️ ⏮️ 🔗.
```Python hl_lines="28-29 32"
-{!../../../docs_src/dependency_testing/tutorial001.py!}
+{!../../docs_src/dependency_testing/tutorial001.py!}
```
/// tip
diff --git a/docs/em/docs/advanced/testing-events.md b/docs/em/docs/advanced/testing-events.md
index d64436eb9..071d49c21 100644
--- a/docs/em/docs/advanced/testing-events.md
+++ b/docs/em/docs/advanced/testing-events.md
@@ -3,5 +3,5 @@
🕐❔ 👆 💪 👆 🎉 🐕🦺 (`startup` & `shutdown`) 🏃 👆 💯, 👆 💪 ⚙️ `TestClient` ⏮️ `with` 📄:
```Python hl_lines="9-12 20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
```
diff --git a/docs/em/docs/advanced/testing-websockets.md b/docs/em/docs/advanced/testing-websockets.md
index 5fb1e9c34..62939c343 100644
--- a/docs/em/docs/advanced/testing-websockets.md
+++ b/docs/em/docs/advanced/testing-websockets.md
@@ -5,7 +5,7 @@
👉, 👆 ⚙️ `TestClient` `with` 📄, 🔗*️⃣:
```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
```
/// note
diff --git a/docs/em/docs/advanced/using-request-directly.md b/docs/em/docs/advanced/using-request-directly.md
index edc951d96..ae212364f 100644
--- a/docs/em/docs/advanced/using-request-directly.md
+++ b/docs/em/docs/advanced/using-request-directly.md
@@ -30,7 +30,7 @@
👈 👆 💪 🔐 📨 🔗.
```Python hl_lines="1 7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
```
📣 *➡ 🛠️ 🔢* 🔢 ⏮️ 🆎 ➖ `Request` **FastAPI** 🔜 💭 🚶♀️ `Request` 👈 🔢.
diff --git a/docs/em/docs/advanced/websockets.md b/docs/em/docs/advanced/websockets.md
index 30dc3043e..7957eba1f 100644
--- a/docs/em/docs/advanced/websockets.md
+++ b/docs/em/docs/advanced/websockets.md
@@ -39,7 +39,7 @@ $ pip install websockets
✋️ ⚫️ 🙅 🌌 🎯 🔛 💽-🚄 *️⃣ & ✔️ 👷 🖼:
```Python hl_lines="2 6-38 41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
## ✍ `websocket`
@@ -47,7 +47,7 @@ $ pip install websockets
👆 **FastAPI** 🈸, ✍ `websocket`:
```Python hl_lines="1 46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
/// note | "📡 ℹ"
@@ -63,7 +63,7 @@ $ pip install websockets
👆 *️⃣ 🛣 👆 💪 `await` 📧 & 📨 📧.
```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
👆 💪 📨 & 📨 💱, ✍, & 🎻 💽.
@@ -116,7 +116,7 @@ $ uvicorn main:app --reload
👫 👷 🎏 🌌 🎏 FastAPI 🔗/*➡ 🛠️*:
```Python hl_lines="66-77 76-91"
-{!../../../docs_src/websockets/tutorial002.py!}
+{!../../docs_src/websockets/tutorial002.py!}
```
/// info
@@ -163,7 +163,7 @@ $ uvicorn main:app --reload
🕐❔ *️⃣ 🔗 📪, `await websocket.receive_text()` 🔜 🤚 `WebSocketDisconnect` ⚠, ❔ 👆 💪 ⤴️ ✊ & 🍵 💖 👉 🖼.
```Python hl_lines="81-83"
-{!../../../docs_src/websockets/tutorial003.py!}
+{!../../docs_src/websockets/tutorial003.py!}
```
🔄 ⚫️ 👅:
diff --git a/docs/em/docs/advanced/wsgi.md b/docs/em/docs/advanced/wsgi.md
index 6a4ed073c..8c0008c74 100644
--- a/docs/em/docs/advanced/wsgi.md
+++ b/docs/em/docs/advanced/wsgi.md
@@ -13,7 +13,7 @@
& ⤴️ 🗻 👈 🔽 ➡.
```Python hl_lines="2-3 22"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
```
## ✅ ⚫️
diff --git a/docs/em/docs/alternatives.md b/docs/em/docs/alternatives.md
index 334c0de73..5309de51f 100644
--- a/docs/em/docs/alternatives.md
+++ b/docs/em/docs/alternatives.md
@@ -321,7 +321,7 @@ APISpec ✍ 🎏 🍭 👩💻.
///
-### 🤗
+### 🤗
🤗 🕐 🥇 🛠️ 🛠️ 📄 🛠️ 🔢 🆎 ⚙️ 🐍 🆎 🔑. 👉 👑 💭 👈 😮 🎏 🧰 🎏.
diff --git a/docs/em/docs/how-to/conditional-openapi.md b/docs/em/docs/how-to/conditional-openapi.md
index a17ba4eec..a5932933a 100644
--- a/docs/em/docs/how-to/conditional-openapi.md
+++ b/docs/em/docs/how-to/conditional-openapi.md
@@ -30,7 +30,7 @@
🖼:
```Python hl_lines="6 11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
```
📥 👥 📣 ⚒ `openapi_url` ⏮️ 🎏 🔢 `"/openapi.json"`.
diff --git a/docs/em/docs/how-to/custom-request-and-route.md b/docs/em/docs/how-to/custom-request-and-route.md
index 1f66c6eda..0425e6267 100644
--- a/docs/em/docs/how-to/custom-request-and-route.md
+++ b/docs/em/docs/how-to/custom-request-and-route.md
@@ -43,7 +43,7 @@
👈 🌌, 🎏 🛣 🎓 💪 🍵 🗜 🗜 ⚖️ 🗜 📨.
```Python hl_lines="8-15"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
```
### ✍ 🛃 `GzipRoute` 🎓
@@ -57,7 +57,7 @@
📥 👥 ⚙️ ⚫️ ✍ `GzipRequest` ⚪️➡️ ⏮️ 📨.
```Python hl_lines="18-26"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
```
/// note | "📡 ℹ"
@@ -97,13 +97,13 @@
🌐 👥 💪 🍵 📨 🔘 `try`/`except` 🍫:
```Python hl_lines="13 15"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
```
🚥 ⚠ 📉, `Request` 👐 🔜 ↔, 👥 💪 ✍ & ⚒ ⚙️ 📨 💪 🕐❔ 🚚 ❌:
```Python hl_lines="16-18"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
```
## 🛃 `APIRoute` 🎓 📻
@@ -111,11 +111,11 @@
👆 💪 ⚒ `route_class` 🔢 `APIRouter`:
```Python hl_lines="26"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
```
👉 🖼, *➡ 🛠️* 🔽 `router` 🔜 ⚙️ 🛃 `TimedRoute` 🎓, & 🔜 ✔️ ➕ `X-Response-Time` 🎚 📨 ⏮️ 🕰 ⚫️ ✊ 🏗 📨:
```Python hl_lines="13-20"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
```
diff --git a/docs/em/docs/how-to/extending-openapi.md b/docs/em/docs/how-to/extending-openapi.md
index dc9adf80e..698c78ec1 100644
--- a/docs/em/docs/how-to/extending-openapi.md
+++ b/docs/em/docs/how-to/extending-openapi.md
@@ -47,7 +47,7 @@
🥇, ✍ 🌐 👆 **FastAPI** 🈸 🛎:
```Python hl_lines="1 4 7-9"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
```
### 🏗 🗄 🔗
@@ -55,7 +55,7 @@
⤴️, ⚙️ 🎏 🚙 🔢 🏗 🗄 🔗, 🔘 `custom_openapi()` 🔢:
```Python hl_lines="2 15-20"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
```
### 🔀 🗄 🔗
@@ -63,7 +63,7 @@
🔜 👆 💪 🚮 📄 ↔, ❎ 🛃 `x-logo` `info` "🎚" 🗄 🔗:
```Python hl_lines="21-23"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
```
### 💾 🗄 🔗
@@ -75,7 +75,7 @@
⚫️ 🔜 🏗 🕴 🕐, & ⤴️ 🎏 💾 🔗 🔜 ⚙️ ⏭ 📨.
```Python hl_lines="13-14 24-25"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
```
### 🔐 👩🔬
@@ -83,7 +83,7 @@
🔜 👆 💪 ❎ `.openapi()` 👩🔬 ⏮️ 👆 🆕 🔢.
```Python hl_lines="28"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
```
### ✅ ⚫️
diff --git a/docs/em/docs/how-to/graphql.md b/docs/em/docs/how-to/graphql.md
index b8610b767..5d0d95567 100644
--- a/docs/em/docs/how-to/graphql.md
+++ b/docs/em/docs/how-to/graphql.md
@@ -36,7 +36,7 @@
📥 🤪 🎮 ❔ 👆 💪 🛠️ 🍓 ⏮️ FastAPI:
```Python hl_lines="3 22 25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
```
👆 💪 💡 🌅 🔃 🍓 🍓 🧾.
diff --git a/docs/em/docs/how-to/sql-databases-peewee.md b/docs/em/docs/how-to/sql-databases-peewee.md
deleted file mode 100644
index 88b827c24..000000000
--- a/docs/em/docs/how-to/sql-databases-peewee.md
+++ /dev/null
@@ -1,576 +0,0 @@
-# 🗄 (🔗) 💽 ⏮️ 🏒
-
-/// warning
-
-🚥 👆 ▶️, 🔰 [🗄 (🔗) 💽](../tutorial/sql-databases.md){.internal-link target=_blank} 👈 ⚙️ 🇸🇲 🔜 🥃.
-
-💭 🆓 🚶 👉.
-
-///
-
-🚥 👆 ▶️ 🏗 ⚪️➡️ 🖌, 👆 🎲 👻 📆 ⏮️ 🇸🇲 🐜 ([🗄 (🔗) 💽](../tutorial/sql-databases.md){.internal-link target=_blank}), ⚖️ 🙆 🎏 🔁 🐜.
-
-🚥 👆 ⏪ ✔️ 📟 🧢 👈 ⚙️ 🏒 🐜, 👆 💪 ✅ 📥 ❔ ⚙️ ⚫️ ⏮️ **FastAPI**.
-
-/// warning | "🐍 3️⃣.7️⃣ ➕ ✔"
-
-👆 🔜 💪 🐍 3️⃣.7️⃣ ⚖️ 🔛 🔒 ⚙️ 🏒 ⏮️ FastAPI.
-
-///
-
-## 🏒 🔁
-
-🏒 🚫 🔧 🔁 🛠️, ⚖️ ⏮️ 👫 🤯.
-
-🏒 ✔️ 🏋️ 🔑 🔃 🚮 🔢 & 🔃 ❔ ⚫️ 🔜 ⚙️.
-
-🚥 👆 🛠️ 🈸 ⏮️ 🗝 🚫-🔁 🛠️, & 💪 👷 ⏮️ 🌐 🚮 🔢, **⚫️ 💪 👑 🧰**.
-
-✋️ 🚥 👆 💪 🔀 🔢, 🐕🦺 🌖 🌘 1️⃣ 🔁 💽, 👷 ⏮️ 🔁 🛠️ (💖 FastAPI), ♒️, 👆 🔜 💪 🚮 🏗 ➕ 📟 🔐 👈 🔢.
-
-👐, ⚫️ 💪 ⚫️, & 📥 👆 🔜 👀 ⚫️❔ ⚫️❔ 📟 👆 ✔️ 🚮 💪 ⚙️ 🏒 ⏮️ FastAPI.
-
-/// note | "📡 ℹ"
-
-👆 💪 ✍ 🌅 🔃 🏒 🧍 🔃 🔁 🐍 🩺, ❔, 🇵🇷.
-
-///
-
-## 🎏 📱
-
-👥 🔜 ✍ 🎏 🈸 🇸🇲 🔰 ([🗄 (🔗) 💽](../tutorial/sql-databases.md){.internal-link target=_blank}).
-
-🌅 📟 🤙 🎏.
-
-, 👥 🔜 🎯 🕴 🔛 🔺.
-
-## 📁 📊
-
-➡️ 💬 👆 ✔️ 📁 📛 `my_super_project` 👈 🔌 🎧-📁 🤙 `sql_app` ⏮️ 📊 💖 👉:
-
-```
-.
-└── sql_app
- ├── __init__.py
- ├── crud.py
- ├── database.py
- ├── main.py
- └── schemas.py
-```
-
-👉 🌖 🎏 📊 👥 ✔️ 🇸🇲 🔰.
-
-🔜 ➡️ 👀 ⚫️❔ 🔠 📁/🕹 🔨.
-
-## ✍ 🏒 🍕
-
-➡️ 🔗 📁 `sql_app/database.py`.
-
-### 🐩 🏒 📟
-
-➡️ 🥇 ✅ 🌐 😐 🏒 📟, ✍ 🏒 💽:
-
-```Python hl_lines="3 5 22"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
-```
-
-/// tip
-
-✔️ 🤯 👈 🚥 👆 💚 ⚙️ 🎏 💽, 💖 ✳, 👆 🚫 🚫 🔀 🎻. 👆 🔜 💪 ⚙️ 🎏 🏒 💽 🎓.
-
-///
-
-#### 🗒
-
-❌:
-
-```Python
-check_same_thread=False
-```
-
-🌓 1️⃣ 🇸🇲 🔰:
-
-```Python
-connect_args={"check_same_thread": False}
-```
-
-...⚫️ 💪 🕴 `SQLite`.
-
-/// info | "📡 ℹ"
-
-⚫️❔ 🎏 📡 ℹ [🗄 (🔗) 💽](../tutorial/sql-databases.md#_7){.internal-link target=_blank} ✔.
-
-///
-
-### ⚒ 🏒 🔁-🔗 `PeeweeConnectionState`
-
-👑 ❔ ⏮️ 🏒 & FastAPI 👈 🏒 ⚓️ 🙇 🔛 🐍 `threading.local`, & ⚫️ 🚫 ✔️ 🎯 🌌 🔐 ⚫️ ⚖️ ➡️ 👆 🍵 🔗/🎉 🔗 (🔨 🇸🇲 🔰).
-
-& `threading.local` 🚫 🔗 ⏮️ 🆕 🔁 ⚒ 🏛 🐍.
-
-/// note | "📡 ℹ"
-
-`threading.local` ⚙️ ✔️ "🎱" 🔢 👈 ✔️ 🎏 💲 🔠 🧵.
-
-👉 ⚠ 🗝 🛠️ 🏗 ✔️ 1️⃣ 👁 🧵 📍 📨, 🙅♂ 🌖, 🙅♂ 🌘.
-
-⚙️ 👉, 🔠 📨 🔜 ✔️ 🚮 👍 💽 🔗/🎉, ❔ ☑ 🏁 🥅.
-
-✋️ FastAPI, ⚙️ 🆕 🔁 ⚒, 💪 🍵 🌅 🌘 1️⃣ 📨 🔛 🎏 🧵. & 🎏 🕰, 👁 📨, ⚫️ 💪 🏃 💗 👜 🎏 🧵 (🧵), ⚓️ 🔛 🚥 👆 ⚙️ `async def` ⚖️ 😐 `def`. 👉 ⚫️❔ 🤝 🌐 🎭 📈 FastAPI.
-
-///
-
-✋️ 🐍 3️⃣.7️⃣ & 🔛 🚚 🌖 🏧 🎛 `threading.local`, 👈 💪 ⚙️ 🥉 🌐❔ `threading.local` 🔜 ⚙️, ✋️ 🔗 ⏮️ 🆕 🔁 ⚒.
-
-👥 🔜 ⚙️ 👈. ⚫️ 🤙 `contextvars`.
-
-👥 🔜 🔐 🔗 🍕 🏒 👈 ⚙️ `threading.local` & ❎ 👫 ⏮️ `contextvars`, ⏮️ 🔗 ℹ.
-
-👉 5️⃣📆 😑 🍖 🏗 (& ⚫️ 🤙), 👆 🚫 🤙 💪 🍕 🤔 ❔ ⚫️ 👷 ⚙️ ⚫️.
-
-👥 🔜 ✍ `PeeweeConnectionState`:
-
-```Python hl_lines="10-19"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
-```
-
-👉 🎓 😖 ⚪️➡️ 🎁 🔗 🎓 ⚙️ 🏒.
-
-⚫️ ✔️ 🌐 ⚛ ⚒ 🏒 ⚙️ `contextvars` ↩️ `threading.local`.
-
-`contextvars` 👷 🍖 🎏 🌘 `threading.local`. ✋️ 🎂 🏒 🔗 📟 🤔 👈 👉 🎓 👷 ⏮️ `threading.local`.
-
-, 👥 💪 ➕ 🎱 ⚒ ⚫️ 👷 🚥 ⚫️ ⚙️ `threading.local`. `__init__`, `__setattr__`, & `__getattr__` 🛠️ 🌐 ✔ 🎱 👉 ⚙️ 🏒 🍵 🤔 👈 ⚫️ 🔜 🔗 ⏮️ FastAPI.
-
-/// tip
-
-👉 🔜 ⚒ 🏒 🎭 ☑ 🕐❔ ⚙️ ⏮️ FastAPI. 🚫 🎲 📂 ⚖️ 📪 🔗 👈 ➖ ⚙️, 🏗 ❌, ♒️.
-
-✋️ ⚫️ 🚫 🤝 🏒 🔁 💎-🏋️. 👆 🔜 ⚙️ 😐 `def` 🔢 & 🚫 `async def`.
-
-///
-
-### ⚙️ 🛃 `PeeweeConnectionState` 🎓
-
-🔜, 📁 `._state` 🔗 🔢 🏒 💽 `db` 🎚 ⚙️ 🆕 `PeeweeConnectionState`:
-
-```Python hl_lines="24"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
-```
-
-/// tip
-
-⚒ 💭 👆 📁 `db._state` *⏮️* 🏗 `db`.
-
-///
-
-/// tip
-
-👆 🔜 🎏 🙆 🎏 🏒 💽, 🔌 `PostgresqlDatabase`, `MySQLDatabase`, ♒️.
-
-///
-
-## ✍ 💽 🏷
-
-➡️ 🔜 👀 📁 `sql_app/models.py`.
-
-### ✍ 🏒 🏷 👆 💽
-
-🔜 ✍ 🏒 🏷 (🎓) `User` & `Item`.
-
-👉 🎏 👆 🔜 🚥 👆 ⏩ 🏒 🔰 & ℹ 🏷 ✔️ 🎏 💽 🇸🇲 🔰.
-
-/// tip
-
-🏒 ⚙️ ⚖ "**🏷**" 🔗 👉 🎓 & 👐 👈 🔗 ⏮️ 💽.
-
-✋️ Pydantic ⚙️ ⚖ "**🏷**" 🔗 🕳 🎏, 💽 🔬, 🛠️, & 🧾 🎓 & 👐.
-
-///
-
-🗄 `db` ⚪️➡️ `database` (📁 `database.py` ⚪️➡️ 🔛) & ⚙️ ⚫️ 📥.
-
-```Python hl_lines="3 6-12 15-21"
-{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
-```
-
-/// tip
-
-🏒 ✍ 📚 🎱 🔢.
-
-⚫️ 🔜 🔁 🚮 `id` 🔢 🔢 👑 🔑.
-
-⚫️ 🔜 ⚒ 📛 🏓 ⚓️ 🔛 🎓 📛.
-
- `Item`, ⚫️ 🔜 ✍ 🔢 `owner_id` ⏮️ 🔢 🆔 `User`. ✋️ 👥 🚫 📣 ⚫️ 🙆.
-
-///
-
-## ✍ Pydantic 🏷
-
-🔜 ➡️ ✅ 📁 `sql_app/schemas.py`.
-
-/// tip
-
-❎ 😨 🖖 🏒 *🏷* & Pydantic *🏷*, 👥 🔜 ✔️ 📁 `models.py` ⏮️ 🏒 🏷, & 📁 `schemas.py` ⏮️ Pydantic 🏷.
-
-👫 Pydantic 🏷 🔬 🌅 ⚖️ 🌘 "🔗" (☑ 📊 💠).
-
-👉 🔜 ℹ 👥 ❎ 😨 ⏪ ⚙️ 👯♂️.
-
-///
-
-### ✍ Pydantic *🏷* / 🔗
-
-✍ 🌐 🎏 Pydantic 🏷 🇸🇲 🔰:
-
-```Python hl_lines="16-18 21-22 25-30 34-35 38-39 42-48"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
-```
-
-/// tip
-
-📥 👥 🏗 🏷 ⏮️ `id`.
-
-👥 🚫 🎯 ✔ `id` 🔢 🏒 🏷, ✋️ 🏒 🚮 1️⃣ 🔁.
-
-👥 ❎ 🎱 `owner_id` 🔢 `Item`.
-
-///
-
-### ✍ `PeeweeGetterDict` Pydantic *🏷* / 🔗
-
-🕐❔ 👆 🔐 💛 🏒 🎚, 💖 `some_user.items`, 🏒 🚫 🚚 `list` `Item`.
-
-⚫️ 🚚 🎁 🛃 🎚 🎓 `ModelSelect`.
-
-⚫️ 💪 ✍ `list` 🚮 🏬 ⏮️ `list(some_user.items)`.
-
-✋️ 🎚 ⚫️ 🚫 `list`. & ⚫️ 🚫 ☑ 🐍 🚂. ↩️ 👉, Pydantic 🚫 💭 🔢 ❔ 🗜 ⚫️ `list` Pydantic *🏷* / 🔗.
-
-✋️ ⏮️ ⏬ Pydantic ✔ 🚚 🛃 🎓 👈 😖 ⚪️➡️ `pydantic.utils.GetterDict`, 🚚 🛠️ ⚙️ 🕐❔ ⚙️ `orm_mode = True` 🗃 💲 🐜 🏷 🔢.
-
-👥 🔜 ✍ 🛃 `PeeweeGetterDict` 🎓 & ⚙️ ⚫️ 🌐 🎏 Pydantic *🏷* / 🔗 👈 ⚙️ `orm_mode`:
-
-```Python hl_lines="3 8-13 31 49"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
-```
-
-📥 👥 ✅ 🚥 🔢 👈 ➖ 🔐 (✅ `.items` `some_user.items`) 👐 `peewee.ModelSelect`.
-
-& 🚥 👈 💼, 📨 `list` ⏮️ ⚫️.
-
-& ⤴️ 👥 ⚙️ ⚫️ Pydantic *🏷* / 🔗 👈 ⚙️ `orm_mode = True`, ⏮️ 📳 🔢 `getter_dict = PeeweeGetterDict`.
-
-/// tip
-
-👥 🕴 💪 ✍ 1️⃣ `PeeweeGetterDict` 🎓, & 👥 💪 ⚙️ ⚫️ 🌐 Pydantic *🏷* / 🔗.
-
-///
-
-## 💩 🇨🇻
-
-🔜 ➡️ 👀 📁 `sql_app/crud.py`.
-
-### ✍ 🌐 💩 🇨🇻
-
-✍ 🌐 🎏 💩 🇨🇻 🇸🇲 🔰, 🌐 📟 📶 🎏:
-
-```Python hl_lines="1 4-5 8-9 12-13 16-20 23-24 27-30"
-{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
-```
-
-📤 🔺 ⏮️ 📟 🇸🇲 🔰.
-
-👥 🚫 🚶♀️ `db` 🔢 🤭. ↩️ 👥 ⚙️ 🏷 🔗. 👉 ↩️ `db` 🎚 🌐 🎚, 👈 🔌 🌐 🔗 ⚛. 👈 ⚫️❔ 👥 ✔️ 🌐 `contextvars` ℹ 🔛.
-
-🆖, 🕐❔ 🛬 📚 🎚, 💖 `get_users`, 👥 🔗 🤙 `list`, 💖:
-
-```Python
-list(models.User.select())
-```
-
-👉 🎏 🤔 👈 👥 ✔️ ✍ 🛃 `PeeweeGetterDict`. ✋️ 🛬 🕳 👈 ⏪ `list` ↩️ `peewee.ModelSelect` `response_model` *➡ 🛠️* ⏮️ `List[models.User]` (👈 👥 🔜 👀 ⏪) 🔜 👷 ☑.
-
-## 👑 **FastAPI** 📱
-
-& 🔜 📁 `sql_app/main.py` ➡️ 🛠️ & ⚙️ 🌐 🎏 🍕 👥 ✍ ⏭.
-
-### ✍ 💽 🏓
-
-📶 🙃 🌌 ✍ 💽 🏓:
-
-```Python hl_lines="9-11"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
-```
-
-### ✍ 🔗
-
-✍ 🔗 👈 🔜 🔗 💽 ▶️️ ▶️ 📨 & 🔌 ⚫️ 🔚:
-
-```Python hl_lines="23-29"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
-```
-
-📥 👥 ✔️ 🛁 `yield` ↩️ 👥 🤙 🚫 ⚙️ 💽 🎚 🔗.
-
-⚫️ 🔗 💽 & ♻ 🔗 💽 🔗 🔢 👈 🔬 🔠 📨 (⚙️ `contextvars` 🎱 ⚪️➡️ 🔛).
-
-↩️ 💽 🔗 ⚠ 👤/🅾 🚧, 👉 🔗 ✍ ⏮️ 😐 `def` 🔢.
-
-& ⤴️, 🔠 *➡ 🛠️ 🔢* 👈 💪 🔐 💽 👥 🚮 ⚫️ 🔗.
-
-✋️ 👥 🚫 ⚙️ 💲 👐 👉 🔗 (⚫️ 🤙 🚫 🤝 🙆 💲, ⚫️ ✔️ 🛁 `yield`). , 👥 🚫 🚮 ⚫️ *➡ 🛠️ 🔢* ✋️ *➡ 🛠️ 👨🎨* `dependencies` 🔢:
-
-```Python hl_lines="32 40 47 59 65 72"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
-```
-
-### 🔑 🔢 🎧-🔗
-
-🌐 `contextvars` 🍕 👷, 👥 💪 ⚒ 💭 👥 ✔️ 🔬 💲 `ContextVar` 🔠 📨 👈 ⚙️ 💽, & 👈 💲 🔜 ⚙️ 💽 🇵🇸 (🔗, 💵, ♒️) 🎂 📨.
-
-👈, 👥 💪 ✍ ➕1️⃣ `async` 🔗 `reset_db_state()` 👈 ⚙️ 🎧-🔗 `get_db()`. ⚫️ 🔜 ⚒ 💲 🔑 🔢 (⏮️ 🔢 `dict`) 👈 🔜 ⚙️ 💽 🇵🇸 🎂 📨. & ⤴️ 🔗 `get_db()` 🔜 🏪 ⚫️ 💽 🇵🇸 (🔗, 💵, ♒️).
-
-```Python hl_lines="18-20"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
-```
-
-**⏭ 📨**, 👥 🔜 ⏲ 👈 🔑 🔢 🔄 `async` 🔗 `reset_db_state()` & ⤴️ ✍ 🆕 🔗 `get_db()` 🔗, 👈 🆕 📨 🔜 ✔️ 🚮 👍 💽 🇵🇸 (🔗, 💵, ♒️).
-
-/// tip
-
-FastAPI 🔁 🛠️, 1️⃣ 📨 💪 ▶️ ➖ 🛠️, & ⏭ 🏁, ➕1️⃣ 📨 💪 📨 & ▶️ 🏭 👍, & ⚫️ 🌐 💪 🛠️ 🎏 🧵.
-
-✋️ 🔑 🔢 🤔 👫 🔁 ⚒,, 🏒 💽 🇵🇸 ⚒ `async` 🔗 `reset_db_state()` 🔜 🚧 🚮 👍 💽 🎂 🎂 📨.
-
- & 🎏 🕰, 🎏 🛠️ 📨 🔜 ✔️ 🚮 👍 💽 🇵🇸 👈 🔜 🔬 🎂 📨.
-
-///
-
-#### 🏒 🗳
-
-🚥 👆 ⚙️ 🏒 🗳, ☑ 💽 `db.obj`.
-
-, 👆 🔜 ⏲ ⚫️ ⏮️:
-
-```Python hl_lines="3-4"
-async def reset_db_state():
- database.db.obj._state._state.set(db_state_default.copy())
- database.db.obj._state.reset()
-```
-
-### ✍ 👆 **FastAPI** *➡ 🛠️*
-
-🔜, 😒, 📥 🐩 **FastAPI** *➡ 🛠️* 📟.
-
-```Python hl_lines="32-37 40-43 46-53 56-62 65-68 71-79"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
-```
-
-### 🔃 `def` 🆚 `async def`
-
-🎏 ⏮️ 🇸🇲, 👥 🚫 🔨 🕳 💖:
-
-```Python
-user = await models.User.select().first()
-```
-
-...✋️ ↩️ 👥 ⚙️:
-
-```Python
-user = models.User.select().first()
-```
-
-, 🔄, 👥 🔜 📣 *➡ 🛠️ 🔢* & 🔗 🍵 `async def`, ⏮️ 😐 `def`,:
-
-```Python hl_lines="2"
-# Something goes here
-def read_users(skip: int = 0, limit: int = 100):
- # Something goes here
-```
-
-## 🔬 🏒 ⏮️ 🔁
-
-👉 🖼 🔌 ➕ *➡ 🛠️* 👈 🔬 📏 🏭 📨 ⏮️ `time.sleep(sleep_time)`.
-
-⚫️ 🔜 ✔️ 💽 🔗 📂 ▶️ & 🔜 ⌛ 🥈 ⏭ 🙇 🔙. & 🔠 🆕 📨 🔜 ⌛ 🕐 🥈 🌘.
-
-👉 🔜 💪 ➡️ 👆 💯 👈 👆 📱 ⏮️ 🏒 & FastAPI 🎭 ☑ ⏮️ 🌐 💩 🔃 🧵.
-
-🚥 👆 💚 ✅ ❔ 🏒 🔜 💔 👆 📱 🚥 ⚙️ 🍵 🛠️, 🚶 `sql_app/database.py` 📁 & 🏤 ⏸:
-
-```Python
-# db._state = PeeweeConnectionState()
-```
-
-& 📁 `sql_app/main.py` 📁, 🏤 💪 `async` 🔗 `reset_db_state()` & ❎ ⚫️ ⏮️ `pass`:
-
-```Python
-async def reset_db_state():
-# database.db._state._state.set(db_state_default.copy())
-# database.db._state.reset()
- pass
-```
-
-⤴️ 🏃 👆 📱 ⏮️ Uvicorn:
-
-kwargs
. 🚥 👫 🚫 ✔️ 🔢 💲.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
## 🔢 🔬: 👑 🌘 ⚖️ 🌓
@@ -93,7 +93,7 @@
📥, ⏮️ `ge=1`, `item_id` 🔜 💪 🔢 🔢 "`g`🅾 🌘 ⚖️ `e`🅾" `1`.
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
## 🔢 🔬: 🌘 🌘 & 🌘 🌘 ⚖️ 🌓
@@ -104,7 +104,7 @@
* `le`: `l`👭 🌘 ⚖️ `e`🅾
```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
## 🔢 🔬: 🎈, 🌘 🌘 & 🌘 🌘
@@ -118,7 +118,7 @@
& 🎏 lt
.
```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
## 🌃
diff --git a/docs/em/docs/tutorial/path-params.md b/docs/em/docs/tutorial/path-params.md
index e0d51a1df..daf5417eb 100644
--- a/docs/em/docs/tutorial/path-params.md
+++ b/docs/em/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
👆 💪 📣 ➡ "🔢" ⚖️ "🔢" ⏮️ 🎏 ❕ ⚙️ 🐍 📁 🎻:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
💲 ➡ 🔢 `item_id` 🔜 🚶♀️ 👆 🔢 ❌ `item_id`.
@@ -19,7 +19,7 @@
👆 💪 📣 🆎 ➡ 🔢 🔢, ⚙️ 🐩 🐍 🆎 ✍:
```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
```
👉 💼, `item_id` 📣 `int`.
@@ -122,7 +122,7 @@
↩️ *➡ 🛠️* 🔬 ✔, 👆 💪 ⚒ 💭 👈 ➡ `/users/me` 📣 ⏭ 1️⃣ `/users/{user_id}`:
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
```
⏪, ➡ `/users/{user_id}` 🔜 🏏 `/users/me`, "💭" 👈 ⚫️ 📨 🔢 `user_id` ⏮️ 💲 `"me"`.
@@ -130,7 +130,7 @@
➡, 👆 🚫🔜 ↔ ➡ 🛠️:
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
```
🥇 🕐 🔜 🕧 ⚙️ ↩️ ➡ 🏏 🥇.
@@ -148,7 +148,7 @@
⤴️ ✍ 🎓 🔢 ⏮️ 🔧 💲, ❔ 🔜 💪 ☑ 💲:
```Python hl_lines="1 6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// info
@@ -168,7 +168,7 @@
⤴️ ✍ *➡ 🔢* ⏮️ 🆎 ✍ ⚙️ 🔢 🎓 👆 ✍ (`ModelName`):
```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
### ✅ 🩺
@@ -186,7 +186,7 @@
👆 💪 🔬 ⚫️ ⏮️ *🔢 👨🎓* 👆 ✍ 🔢 `ModelName`:
```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
#### 🤚 *🔢 💲*
@@ -194,7 +194,7 @@
👆 💪 🤚 ☑ 💲 ( `str` 👉 💼) ⚙️ `model_name.value`, ⚖️ 🏢, `your_enum_member.value`:
```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// tip
@@ -210,7 +210,7 @@
👫 🔜 🗜 👫 🔗 💲 (🎻 👉 💼) ⏭ 🛬 👫 👩💻:
```Python hl_lines="18 21 23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
👆 👩💻 👆 🔜 🤚 🎻 📨 💖:
@@ -251,7 +251,7 @@
, 👆 💪 ⚙️ ⚫️ ⏮️:
```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
```
/// tip
diff --git a/docs/em/docs/tutorial/query-params-str-validations.md b/docs/em/docs/tutorial/query-params-str-validations.md
index 23873155e..f75c0a26f 100644
--- a/docs/em/docs/tutorial/query-params-str-validations.md
+++ b/docs/em/docs/tutorial/query-params-str-validations.md
@@ -7,7 +7,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
```
////
@@ -15,7 +15,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
```
////
@@ -41,7 +41,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
```
////
@@ -49,7 +49,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="1"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
```
////
@@ -61,7 +61,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
```
////
@@ -69,7 +69,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
```
////
@@ -137,7 +137,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
```
////
@@ -145,7 +145,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
```
////
@@ -157,7 +157,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
```
////
@@ -165,7 +165,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
```
////
@@ -187,7 +187,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
➡️ 💬 👈 👆 💚 📣 `q` 🔢 🔢 ✔️ `min_length` `3`, & ✔️ 🔢 💲 `"fixedquery"`:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
```
/// note
@@ -219,7 +219,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
, 🕐❔ 👆 💪 📣 💲 ✔ ⏪ ⚙️ `Query`, 👆 💪 🎯 🚫 📣 🔢 💲:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
```
### ✔ ⏮️ ❕ (`...`)
@@ -227,7 +227,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
📤 🎛 🌌 🎯 📣 👈 💲 ✔. 👆 💪 ⚒ `default` 🔢 🔑 💲 `...`:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!../../docs_src/query_params_str_validations/tutorial006b.py!}
```
/// info
@@ -249,7 +249,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
```
////
@@ -257,7 +257,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
```
////
@@ -273,7 +273,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 & 🛠️ FastAPI, ✔️
🚥 👆 💭 😬 ⚙️ `...`, 👆 💪 🗄 & ⚙️ `Required` ⚪️➡️ Pydantic:
```Python hl_lines="2 8"
-{!../../../docs_src/query_params_str_validations/tutorial006d.py!}
+{!../../docs_src/query_params_str_validations/tutorial006d.py!}
```
/// tip
@@ -291,7 +291,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 & 🛠️ FastAPI, ✔️
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
```
////
@@ -299,7 +299,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 & 🛠️ FastAPI, ✔️
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
```
////
@@ -307,7 +307,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 & 🛠️ FastAPI, ✔️
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
```
////
@@ -348,7 +348,7 @@ http://localhost:8000/items/?q=foo&q=bar
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
```
////
@@ -356,7 +356,7 @@ http://localhost:8000/items/?q=foo&q=bar
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
```
////
@@ -383,7 +383,7 @@ http://localhost:8000/items/
👆 💪 ⚙️ `list` 🔗 ↩️ `List[str]` (⚖️ `list[str]` 🐍 3️⃣.9️⃣ ➕):
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
```
/// note
@@ -413,7 +413,7 @@ http://localhost:8000/items/
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
```
////
@@ -421,7 +421,7 @@ http://localhost:8000/items/
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
```
////
@@ -431,7 +431,7 @@ http://localhost:8000/items/
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
```
////
@@ -439,7 +439,7 @@ http://localhost:8000/items/
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
```
////
@@ -465,7 +465,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
```
////
@@ -473,7 +473,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
```
////
@@ -489,7 +489,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
```
////
@@ -497,7 +497,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
```
////
@@ -513,7 +513,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
```
////
@@ -521,7 +521,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/query-params.md b/docs/em/docs/tutorial/query-params.md
index 9bdab9e3c..c8432f182 100644
--- a/docs/em/docs/tutorial/query-params.md
+++ b/docs/em/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
🕐❔ 👆 📣 🎏 🔢 🔢 👈 🚫 🍕 ➡ 🔢, 👫 🔁 🔬 "🔢" 🔢.
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
🔢 ⚒ 🔑-💲 👫 👈 🚶 ⏮️ `?` 📛, 🎏 `&` 🦹.
@@ -66,7 +66,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
```
////
@@ -74,7 +74,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
```
////
@@ -94,7 +94,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
```
////
@@ -102,7 +102,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
```
////
@@ -151,7 +151,7 @@ http://127.0.0.1:8000/items/foo?short=yes
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
```
////
@@ -159,7 +159,7 @@ http://127.0.0.1:8000/items/foo?short=yes
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
```
////
@@ -173,7 +173,7 @@ http://127.0.0.1:8000/items/foo?short=yes
✋️ 🕐❔ 👆 💚 ⚒ 🔢 🔢 ✔, 👆 💪 🚫 📣 🙆 🔢 💲:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
📥 🔢 🔢 `needy` ✔ 🔢 🔢 🆎 `str`.
@@ -221,7 +221,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
```
////
@@ -229,7 +229,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/request-files.md b/docs/em/docs/tutorial/request-files.md
index 010aa76bf..102690f4b 100644
--- a/docs/em/docs/tutorial/request-files.md
+++ b/docs/em/docs/tutorial/request-files.md
@@ -17,7 +17,7 @@
🗄 `File` & `UploadFile` ⚪️➡️ `fastapi`:
```Python hl_lines="1"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
## 🔬 `File` 🔢
@@ -25,7 +25,7 @@
✍ 📁 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Form`:
```Python hl_lines="7"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
/// info
@@ -55,7 +55,7 @@
🔬 📁 🔢 ⏮️ 🆎 `UploadFile`:
```Python hl_lines="12"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
⚙️ `UploadFile` ✔️ 📚 📈 🤭 `bytes`:
@@ -142,7 +142,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
```
////
@@ -150,7 +150,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7 14"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
```
////
@@ -160,7 +160,7 @@ contents = myfile.file.read()
👆 💪 ⚙️ `File()` ⏮️ `UploadFile`, 🖼, ⚒ 🌖 🗃:
```Python hl_lines="13"
-{!../../../docs_src/request_files/tutorial001_03.py!}
+{!../../docs_src/request_files/tutorial001_03.py!}
```
## 💗 📁 📂
@@ -174,7 +174,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
```
////
@@ -182,7 +182,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="8 13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
```
////
@@ -204,7 +204,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
```
////
@@ -212,7 +212,7 @@ contents = myfile.file.read()
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
```
////
diff --git a/docs/em/docs/tutorial/request-forms-and-files.md b/docs/em/docs/tutorial/request-forms-and-files.md
index ab39d1b94..80793dae4 100644
--- a/docs/em/docs/tutorial/request-forms-and-files.md
+++ b/docs/em/docs/tutorial/request-forms-and-files.md
@@ -13,7 +13,7 @@
## 🗄 `File` & `Form`
```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
## 🔬 `File` & `Form` 🔢
@@ -21,7 +21,7 @@
✍ 📁 & 📨 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Query`:
```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
📁 & 📨 🏑 🔜 📂 📨 📊 & 👆 🔜 📨 📁 & 📨 🏑.
diff --git a/docs/em/docs/tutorial/request-forms.md b/docs/em/docs/tutorial/request-forms.md
index 74117c47d..cbe4e2862 100644
--- a/docs/em/docs/tutorial/request-forms.md
+++ b/docs/em/docs/tutorial/request-forms.md
@@ -15,7 +15,7 @@
🗄 `Form` ⚪️➡️ `fastapi`:
```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
```
## 🔬 `Form` 🔢
@@ -23,7 +23,7 @@
✍ 📨 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Query`:
```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
```
🖼, 1️⃣ 🌌 Oauth2️⃣ 🔧 💪 ⚙️ (🤙 "🔐 💧") ⚫️ ✔ 📨 `username` & `password` 📨 🏑.
diff --git a/docs/em/docs/tutorial/response-model.md b/docs/em/docs/tutorial/response-model.md
index 9483508aa..fb5c17dd6 100644
--- a/docs/em/docs/tutorial/response-model.md
+++ b/docs/em/docs/tutorial/response-model.md
@@ -7,7 +7,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
```
////
@@ -15,7 +15,7 @@
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
```
////
@@ -23,7 +23,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="16 21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
```
////
@@ -62,7 +62,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
```
////
@@ -70,7 +70,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
```
////
@@ -78,7 +78,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
```
////
@@ -116,7 +116,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9 11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -124,7 +124,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7 9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -143,7 +143,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -151,7 +151,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -175,7 +175,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -183,7 +183,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -193,7 +193,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -201,7 +201,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -211,7 +211,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -219,7 +219,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -249,7 +249,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9-13 15-16 20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
```
////
@@ -257,7 +257,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. & **
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7-10 13-14 18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
```
////
@@ -303,7 +303,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
🏆 ⚠ 💼 🔜 [🛬 📨 🔗 🔬 ⏪ 🏧 🩺](../advanced/response-directly.md){.internal-link target=_blank}.
```Python hl_lines="8 10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
```
👉 🙅 💼 🍵 🔁 FastAPI ↩️ 📨 🆎 ✍ 🎓 (⚖️ 🏿) `Response`.
@@ -315,7 +315,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
👆 💪 ⚙️ 🏿 `Response` 🆎 ✍:
```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
```
👉 🔜 👷 ↩️ `RedirectResponse` 🏿 `Response`, & FastAPI 🔜 🔁 🍵 👉 🙅 💼.
@@ -329,7 +329,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
```
////
@@ -337,7 +337,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
```
////
@@ -355,7 +355,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
```
////
@@ -363,7 +363,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
```
////
@@ -377,7 +377,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -385,7 +385,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -393,7 +393,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="9 11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -413,7 +413,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -421,7 +421,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -429,7 +429,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -524,7 +524,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
```
////
@@ -532,7 +532,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
```
////
@@ -552,7 +552,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
```
////
@@ -560,7 +560,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/response-status-code.md b/docs/em/docs/tutorial/response-status-code.md
index 57c44777a..cefff708f 100644
--- a/docs/em/docs/tutorial/response-status-code.md
+++ b/docs/em/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@
* ♒️.
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note
@@ -77,7 +77,7 @@ FastAPI 💭 👉, & 🔜 🏭 🗄 🩺 👈 🇵🇸 📤 🙅♂ 📨
➡️ 👀 ⏮️ 🖼 🔄:
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
`201` 👔 📟 "✍".
@@ -87,7 +87,7 @@ FastAPI 💭 👉, & 🔜 🏭 🗄 🩺 👈 🇵🇸 📤 🙅♂ 📨
👆 💪 ⚙️ 🏪 🔢 ⚪️➡️ `fastapi.status`.
```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
```
👫 🏪, 👫 🧑🤝🧑 🎏 🔢, ✋️ 👈 🌌 👆 💪 ⚙️ 👨🎨 📋 🔎 👫:
diff --git a/docs/em/docs/tutorial/schema-extra-example.md b/docs/em/docs/tutorial/schema-extra-example.md
index 8562de09c..e4f877a8e 100644
--- a/docs/em/docs/tutorial/schema-extra-example.md
+++ b/docs/em/docs/tutorial/schema-extra-example.md
@@ -11,7 +11,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="15-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
```
////
@@ -19,7 +19,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="13-21"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
```
////
@@ -43,7 +43,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="4 10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
```
////
@@ -51,7 +51,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="2 8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
```
////
@@ -83,7 +83,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="20-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
```
////
@@ -91,7 +91,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="18-23"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
```
////
@@ -118,7 +118,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
```
////
@@ -126,7 +126,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/security/first-steps.md b/docs/em/docs/tutorial/security/first-steps.md
index 538ea7b0a..6245f52ab 100644
--- a/docs/em/docs/tutorial/security/first-steps.md
+++ b/docs/em/docs/tutorial/security/first-steps.md
@@ -21,7 +21,7 @@
📁 🖼 📁 `main.py`:
```Python
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
## 🏃 ⚫️
@@ -129,7 +129,7 @@ Oauth2️⃣ 🔧 👈 👩💻 ⚖️ 🛠️ 💪 🔬 💽 👈 🔓 👩
🕐❔ 👥 ✍ 👐 `OAuth2PasswordBearer` 🎓 👥 🚶♀️ `tokenUrl` 🔢. 👉 🔢 🔌 📛 👈 👩💻 (🕸 🏃 👩💻 🖥) 🔜 ⚙️ 📨 `username` & `password` ✔ 🤚 🤝.
```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
/// tip
@@ -169,7 +169,7 @@ oauth2_scheme(some, parameters)
🔜 👆 💪 🚶♀️ 👈 `oauth2_scheme` 🔗 ⏮️ `Depends`.
```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
👉 🔗 🔜 🚚 `str` 👈 🛠️ 🔢 `token` *➡ 🛠️ 🔢*.
diff --git a/docs/em/docs/tutorial/security/get-current-user.md b/docs/em/docs/tutorial/security/get-current-user.md
index 15545f427..4e5b4ebfc 100644
--- a/docs/em/docs/tutorial/security/get-current-user.md
+++ b/docs/em/docs/tutorial/security/get-current-user.md
@@ -3,7 +3,7 @@
⏮️ 📃 💂♂ ⚙️ (❔ 🧢 🔛 🔗 💉 ⚙️) 🤝 *➡ 🛠️ 🔢* `token` `str`:
```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
✋️ 👈 🚫 👈 ⚠.
@@ -19,7 +19,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -27,7 +27,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="3 10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -45,7 +45,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -53,7 +53,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -65,7 +65,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -73,7 +73,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="17-20 24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -85,7 +85,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -93,7 +93,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -153,7 +153,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -161,7 +161,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/security/oauth2-jwt.md b/docs/em/docs/tutorial/security/oauth2-jwt.md
index 3ab8cc986..95fa58f71 100644
--- a/docs/em/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/em/docs/tutorial/security/oauth2-jwt.md
@@ -121,7 +121,7 @@ $ pip install "passlib[bcrypt]"
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -129,7 +129,7 @@ $ pip install "passlib[bcrypt]"
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="6 47 54-55 58-59 68-74"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -171,7 +171,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="6 12-14 28-30 78-86"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -179,7 +179,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="5 11-13 27-29 77-85"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -195,7 +195,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -203,7 +203,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="88-105"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -217,7 +217,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -225,7 +225,7 @@ $ openssl rand -hex 32
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="114-129"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/security/simple-oauth2.md b/docs/em/docs/tutorial/security/simple-oauth2.md
index 937546be8..43d928ce7 100644
--- a/docs/em/docs/tutorial/security/simple-oauth2.md
+++ b/docs/em/docs/tutorial/security/simple-oauth2.md
@@ -55,7 +55,7 @@ Oauth2️⃣ 👫 🎻.
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="4 76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -63,7 +63,7 @@ Oauth2️⃣ 👫 🎻.
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="2 74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -117,7 +117,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="3 77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -125,7 +125,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="1 75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -157,7 +157,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -165,7 +165,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -213,7 +213,7 @@ UserInDB(
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -221,7 +221,7 @@ UserInDB(
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -253,7 +253,7 @@ UserInDB(
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="58-66 69-72 90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -261,7 +261,7 @@ UserInDB(
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="55-64 67-70 88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
diff --git a/docs/em/docs/tutorial/sql-databases.md b/docs/em/docs/tutorial/sql-databases.md
index 2492c8708..c59d8c131 100644
--- a/docs/em/docs/tutorial/sql-databases.md
+++ b/docs/em/docs/tutorial/sql-databases.md
@@ -110,13 +110,13 @@ $ pip install sqlalchemy
### 🗄 🇸🇲 🍕
```Python hl_lines="1-3"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
### ✍ 💽 📛 🇸🇲
```Python hl_lines="5-6"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
👉 🖼, 👥 "🔗" 🗄 💽 (📂 📁 ⏮️ 🗄 💽).
@@ -146,7 +146,7 @@ SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
👥 🔜 ⏪ ⚙️ 👉 `engine` 🎏 🥉.
```Python hl_lines="8-10"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
#### 🗒
@@ -184,7 +184,7 @@ connect_args={"check_same_thread": False}
✍ `SessionLocal` 🎓, ⚙️ 🔢 `sessionmaker`:
```Python hl_lines="11"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
### ✍ `Base` 🎓
@@ -194,7 +194,7 @@ connect_args={"check_same_thread": False}
⏪ 👥 🔜 😖 ⚪️➡️ 👉 🎓 ✍ 🔠 💽 🏷 ⚖️ 🎓 (🐜 🏷):
```Python hl_lines="13"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
## ✍ 💽 🏷
@@ -220,7 +220,7 @@ connect_args={"check_same_thread": False}
👫 🎓 🇸🇲 🏷.
```Python hl_lines="4 7-8 18-19"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
```
`__tablename__` 🔢 💬 🇸🇲 📛 🏓 ⚙️ 💽 🔠 👫 🏷.
@@ -236,7 +236,7 @@ connect_args={"check_same_thread": False}
& 👥 🚶♀️ 🇸🇲 🎓 "🆎", `Integer`, `String`, & `Boolean`, 👈 🔬 🆎 💽, ❌.
```Python hl_lines="1 10-13 21-24"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
```
### ✍ 💛
@@ -248,7 +248,7 @@ connect_args={"check_same_thread": False}
👉 🔜 ▶️️, 🌅 ⚖️ 🌘, "🎱" 🔢 👈 🔜 🔌 💲 ⚪️➡️ 🎏 🏓 🔗 👉 1️⃣.
```Python hl_lines="2 15 26"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
```
🕐❔ 🔐 🔢 `items` `User`, `my_user.items`, ⚫️ 🔜 ✔️ 📇 `Item` 🇸🇲 🏷 (⚪️➡️ `items` 🏓) 👈 ✔️ 💱 🔑 ☝ 👉 ⏺ `users` 🏓.
@@ -284,7 +284,7 @@ connect_args={"check_same_thread": False}
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="3 6-8 11-12 23-24 27-28"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
```
////
@@ -292,7 +292,7 @@ connect_args={"check_same_thread": False}
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="3 6-8 11-12 23-24 27-28"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
```
////
@@ -300,7 +300,7 @@ connect_args={"check_same_thread": False}
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="1 4-6 9-10 21-22 25-26"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
```
////
@@ -334,7 +334,7 @@ name: str
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="15-17 31-34"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
```
////
@@ -342,7 +342,7 @@ name: str
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="15-17 31-34"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
```
////
@@ -350,7 +350,7 @@ name: str
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="13-15 29-32"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
```
////
@@ -372,7 +372,7 @@ name: str
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="15 19-20 31 36-37"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
```
////
@@ -380,7 +380,7 @@ name: str
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="15 19-20 31 36-37"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
```
////
@@ -388,7 +388,7 @@ name: str
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python hl_lines="13 17-18 29 34-35"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
```
////
@@ -466,7 +466,7 @@ current_user.items
* ✍ 💗 🏬.
```Python hl_lines="1 3 6-7 10-11 14-15 27-28"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
```
/// tip
@@ -487,7 +487,7 @@ current_user.items
* `refresh` 👆 👐 (👈 ⚫️ 🔌 🙆 🆕 📊 ⚪️➡️ 💽, 💖 🏗 🆔).
```Python hl_lines="18-24 31-36"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
```
/// tip
@@ -539,7 +539,7 @@ current_user.items
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="9"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
```
////
@@ -547,7 +547,7 @@ current_user.items
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="7"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
```
////
@@ -577,7 +577,7 @@ current_user.items
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="15-20"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
```
////
@@ -585,7 +585,7 @@ current_user.items
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="13-18"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
```
////
@@ -609,7 +609,7 @@ current_user.items
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="24 32 38 47 53"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
```
////
@@ -617,7 +617,7 @@ current_user.items
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="22 30 36 45 51"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
```
////
@@ -637,7 +637,7 @@ current_user.items
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="23-28 31-34 37-42 45-49 52-55"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
```
////
@@ -645,7 +645,7 @@ current_user.items
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="21-26 29-32 35-40 43-47 50-53"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
```
////
@@ -732,13 +732,13 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
* `sql_app/database.py`:
```Python
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
```
* `sql_app/models.py`:
```Python
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
```
* `sql_app/schemas.py`:
@@ -746,7 +746,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
```
////
@@ -754,7 +754,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
```
////
@@ -762,7 +762,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
```
////
@@ -770,7 +770,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
* `sql_app/crud.py`:
```Python
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
```
* `sql_app/main.py`:
@@ -778,7 +778,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
```
////
@@ -786,7 +786,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
```
////
@@ -843,7 +843,7 @@ $ uvicorn sql_app.main:app --reload
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python hl_lines="14-22"
-{!> ../../../docs_src/sql_databases/sql_app/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app/alt_main.py!}
```
////
@@ -851,7 +851,7 @@ $ uvicorn sql_app.main:app --reload
//// tab | 🐍 3️⃣.9️⃣ & 🔛
```Python hl_lines="12-20"
-{!> ../../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
```
////
diff --git a/docs/em/docs/tutorial/static-files.md b/docs/em/docs/tutorial/static-files.md
index 3305746c2..0627031b3 100644
--- a/docs/em/docs/tutorial/static-files.md
+++ b/docs/em/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@
* "🗻" `StaticFiles()` 👐 🎯 ➡.
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "📡 ℹ"
diff --git a/docs/em/docs/tutorial/testing.md b/docs/em/docs/tutorial/testing.md
index 75dd2d295..5f3d5e736 100644
--- a/docs/em/docs/tutorial/testing.md
+++ b/docs/em/docs/tutorial/testing.md
@@ -27,7 +27,7 @@
✍ 🙅 `assert` 📄 ⏮️ 🐩 🐍 🧬 👈 👆 💪 ✅ (🔄, 🐩 `pytest`).
```Python hl_lines="2 12 15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
```
/// tip
@@ -75,7 +75,7 @@
```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
```
### 🔬 📁
@@ -93,7 +93,7 @@
↩️ 👉 📁 🎏 📦, 👆 💪 ⚙️ ⚖ 🗄 🗄 🎚 `app` ⚪️➡️ `main` 🕹 (`main.py`):
```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
```
...& ✔️ 📟 💯 💖 ⏭.
@@ -125,7 +125,7 @@
//// tab | 🐍 3️⃣.6️⃣ & 🔛
```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
```
////
@@ -133,7 +133,7 @@
//// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
```
////
@@ -143,7 +143,7 @@
👆 💪 ⤴️ ℹ `test_main.py` ⏮️ ↔ 💯:
```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
```
🕐❔ 👆 💪 👩💻 🚶♀️ ℹ 📨 & 👆 🚫 💭 ❔, 👆 💪 🔎 (🇺🇸🔍) ❔ ⚫️ `httpx`, ⚖️ ❔ ⚫️ ⏮️ `requests`, 🇸🇲 🔧 ⚓️ 🔛 📨' 🔧.
diff --git a/docs/en/data/external_links.yml b/docs/en/data/external_links.yml
index 63fd3d0cf..dedbe87f4 100644
--- a/docs/en/data/external_links.yml
+++ b/docs/en/data/external_links.yml
@@ -1,5 +1,9 @@
Articles:
English:
+ - author: Balthazar Rouberol
+ author_link: https://balthazar-rouberol.com
+ link: https://blog.balthazar-rouberol.com/how-to-profile-a-fastapi-asynchronous-request
+ title: How to profile a FastAPI asynchronous request
- author: Stephen Siegert - Neon
link: https://neon.tech/blog/deploy-a-serverless-fastapi-app-with-neon-postgres-and-aws-app-runner-at-any-scale
title: Deploy a Serverless FastAPI App with Neon Postgres and AWS App Runner at any scale
diff --git a/docs/en/data/members.yml b/docs/en/data/members.yml
index 0069f8c75..a3a6b912d 100644
--- a/docs/en/data/members.yml
+++ b/docs/en/data/members.yml
@@ -11,6 +11,9 @@ members:
- login: svlandeg
avatar_url: https://avatars.githubusercontent.com/u/8796347
url: https://github.com/svlandeg
+- login: YuriiMotov
+ avatar_url: https://avatars.githubusercontent.com/u/109919500
+ url: https://github.com/YuriiMotov
- login: estebanx64
avatar_url: https://avatars.githubusercontent.com/u/10840422
url: https://github.com/estebanx64
diff --git a/docs/en/data/sponsors_badge.yml b/docs/en/data/sponsors_badge.yml
index d8a41fbcb..d45028aaa 100644
--- a/docs/en/data/sponsors_badge.yml
+++ b/docs/en/data/sponsors_badge.yml
@@ -30,3 +30,4 @@ logins:
- svix
- zuplo-oss
- Kong
+ - speakeasy-api
diff --git a/docs/en/docs/advanced/additional-responses.md b/docs/en/docs/advanced/additional-responses.md
index 4fec41213..c038096f9 100644
--- a/docs/en/docs/advanced/additional-responses.md
+++ b/docs/en/docs/advanced/additional-responses.md
@@ -27,7 +27,7 @@ Each of those response `dict`s can have a key `model`, containing a Pydantic mod
For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write:
```Python hl_lines="18 22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
```
/// note
@@ -178,7 +178,7 @@ You can use this same `responses` parameter to add different media types for the
For example, you can add an additional media type of `image/png`, declaring that your *path operation* can return a JSON object (with media type `application/json`) or a PNG image:
```Python hl_lines="19-24 28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
```
/// note
@@ -208,7 +208,7 @@ For example, you can declare a response with a status code `404` that uses a Pyd
And a response with a status code `200` that uses your `response_model`, but includes a custom `example`:
```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
```
It will all be combined and included in your OpenAPI, and shown in the API docs:
@@ -244,7 +244,7 @@ You can use that technique to reuse some predefined responses in your *path oper
For example:
```Python hl_lines="13-17 26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
```
## More information about OpenAPI responses
diff --git a/docs/en/docs/advanced/additional-status-codes.md b/docs/en/docs/advanced/additional-status-codes.md
index 99ad72b53..6105a301c 100644
--- a/docs/en/docs/advanced/additional-status-codes.md
+++ b/docs/en/docs/advanced/additional-status-codes.md
@@ -17,7 +17,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
//// tab | Python 3.10+
```Python hl_lines="4 25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
```
////
@@ -25,7 +25,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
//// tab | Python 3.9+
```Python hl_lines="4 25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
```
////
@@ -33,7 +33,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
//// tab | Python 3.8+
```Python hl_lines="4 26"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an.py!}
```
////
@@ -47,7 +47,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="2 23"
-{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!}
```
////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="4 25"
-{!> ../../../docs_src/additional_status_codes/tutorial001.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001.py!}
```
////
diff --git a/docs/en/docs/advanced/advanced-dependencies.md b/docs/en/docs/advanced/advanced-dependencies.md
index f65e1b180..b15a4fe3d 100644
--- a/docs/en/docs/advanced/advanced-dependencies.md
+++ b/docs/en/docs/advanced/advanced-dependencies.md
@@ -21,7 +21,7 @@ To do that, we declare a method `__call__`:
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -29,7 +29,7 @@ To do that, we declare a method `__call__`:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -43,7 +43,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -57,7 +57,7 @@ And now, we can use `__init__` to declare the parameters of the instance that we
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -65,7 +65,7 @@ And now, we can use `__init__` to declare the parameters of the instance that we
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -79,7 +79,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -93,7 +93,7 @@ We could create an instance of this class with:
//// tab | Python 3.9+
```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -101,7 +101,7 @@ We could create an instance of this class with:
//// tab | Python 3.8+
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -115,7 +115,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -137,7 +137,7 @@ checker(q="somequery")
//// tab | Python 3.9+
```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -145,7 +145,7 @@ checker(q="somequery")
//// tab | Python 3.8+
```Python hl_lines="21"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -159,7 +159,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
diff --git a/docs/en/docs/advanced/async-tests.md b/docs/en/docs/advanced/async-tests.md
index a528c80fe..232cd6e57 100644
--- a/docs/en/docs/advanced/async-tests.md
+++ b/docs/en/docs/advanced/async-tests.md
@@ -33,13 +33,13 @@ For a simple example, let's consider a file structure similar to the one describ
The file `main.py` would have:
```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
```
The file `test_main.py` would have the tests for `main.py`, it could look like this now:
```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
## Run it
@@ -61,7 +61,7 @@ $ pytest
The marker `@pytest.mark.anyio` tells pytest that this test function should be called asynchronously:
```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
/// tip
@@ -73,7 +73,7 @@ Note that the test function is now `async def` instead of just `def` as before w
Then we can create an `AsyncClient` with the app, and send async requests to it, using `await`.
```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
This is the equivalent to:
diff --git a/docs/en/docs/advanced/behind-a-proxy.md b/docs/en/docs/advanced/behind-a-proxy.md
index e642b1910..67718a27b 100644
--- a/docs/en/docs/advanced/behind-a-proxy.md
+++ b/docs/en/docs/advanced/behind-a-proxy.md
@@ -19,7 +19,7 @@ In this case, the original path `/app` would actually be served at `/api/v1/app`
Even though all your code is written assuming there's just `/app`.
```Python hl_lines="6"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
```
And the proxy would be **"stripping"** the **path prefix** on the fly before transmitting the request to the app server (probably Uvicorn via FastAPI CLI), keeping your application convinced that it is being served at `/app`, so that you don't have to update all your code to include the prefix `/api/v1`.
@@ -99,7 +99,7 @@ You can get the current `root_path` used by your application for each request, i
Here we are including it in the message just for demonstration purposes.
```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
```
Then, if you start Uvicorn with:
@@ -128,7 +128,7 @@ The response would be something like:
Alternatively, if you don't have a way to provide a command line option like `--root-path` or equivalent, you can set the `root_path` parameter when creating your FastAPI app:
```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
```
Passing the `root_path` to `FastAPI` would be the equivalent of passing the `--root-path` command line option to Uvicorn or Hypercorn.
@@ -310,7 +310,7 @@ If you pass a custom list of `servers` and there's a `root_path` (because your A
For example:
```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
```
Will generate an OpenAPI schema like:
@@ -359,7 +359,7 @@ The docs UI will interact with the server that you select.
If you don't want **FastAPI** to include an automatic server using the `root_path`, you can use the parameter `root_path_in_servers=False`:
```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
```
and then it won't include it in the OpenAPI schema.
diff --git a/docs/en/docs/advanced/custom-response.md b/docs/en/docs/advanced/custom-response.md
index 1cefe979f..1d6dc3f6d 100644
--- a/docs/en/docs/advanced/custom-response.md
+++ b/docs/en/docs/advanced/custom-response.md
@@ -31,7 +31,7 @@ This is because by default, FastAPI will inspect every item inside and make sure
But if you are certain that the content that you are returning is **serializable with JSON**, you can pass it directly to the response class and avoid the extra overhead that FastAPI would have by passing your return content through the `jsonable_encoder` before passing it to the response class.
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
```
/// info
@@ -58,7 +58,7 @@ To return a response with HTML directly from **FastAPI**, use `HTMLResponse`.
* Pass `HTMLResponse` as the parameter `response_class` of your *path operation decorator*.
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
```
/// info
@@ -78,7 +78,7 @@ As seen in [Return a Response directly](response-directly.md){.internal-link tar
The same example from above, returning an `HTMLResponse`, could look like:
```Python hl_lines="2 7 19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
```
/// warning
@@ -104,7 +104,7 @@ The `response_class` will then be used only to document the OpenAPI *path operat
For example, it could be something like:
```Python hl_lines="7 21 23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
```
In this example, the function `generate_html_response()` already generates and returns a `Response` instead of returning the HTML in a `str`.
@@ -145,7 +145,7 @@ It accepts the following parameters:
FastAPI (actually Starlette) will automatically include a Content-Length header. It will also include a Content-Type header, based on the `media_type` and appending a charset for text types.
```Python hl_lines="1 18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
```
### `HTMLResponse`
@@ -157,7 +157,7 @@ Takes some text or bytes and returns an HTML response, as you read above.
Takes some text or bytes and returns a plain text response.
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
```
### `JSONResponse`
@@ -193,7 +193,7 @@ This requires installing `ujson` for example with `pip install ujson`.
///
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
```
/// tip
@@ -209,7 +209,7 @@ 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!}
+{!../../docs_src/custom_response/tutorial006.py!}
```
---
@@ -218,7 +218,7 @@ Or you can use it in the `response_class` parameter:
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial006b.py!}
+{!../../docs_src/custom_response/tutorial006b.py!}
```
If you do that, then you can return the URL directly from your *path operation* function.
@@ -230,7 +230,7 @@ In this case, the `status_code` used will be the default one for the `RedirectRe
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!}
+{!../../docs_src/custom_response/tutorial006c.py!}
```
### `StreamingResponse`
@@ -238,7 +238,7 @@ You can also use the `status_code` parameter combined with the `response_class`
Takes an async generator or a normal generator/iterator and streams the response body.
```Python hl_lines="2 14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
```
#### Using `StreamingResponse` with file-like objects
@@ -250,7 +250,7 @@ That way, you don't have to read it all first in memory, and you can pass that g
This includes many libraries to interact with cloud storage, video processing, and others.
```{ .python .annotate hl_lines="2 10-12 14" }
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
```
1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
@@ -281,13 +281,13 @@ Takes a different set of arguments to instantiate than the other response types:
File responses will include appropriate `Content-Length`, `Last-Modified` and `ETag` headers.
```Python hl_lines="2 10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../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!}
+{!../../docs_src/custom_response/tutorial009b.py!}
```
In this case, you can return the file path directly from your *path operation* function.
@@ -303,7 +303,7 @@ Let's say you want it to return indented and formatted JSON, so you want to use
You could create a `CustomORJSONResponse`. The main thing you have to do is create a `Response.render(content)` method that returns the content as `bytes`:
```Python hl_lines="9-14 17"
-{!../../../docs_src/custom_response/tutorial009c.py!}
+{!../../docs_src/custom_response/tutorial009c.py!}
```
Now instead of returning:
@@ -331,7 +331,7 @@ The parameter that defines this is `default_response_class`.
In the example below, **FastAPI** will use `ORJSONResponse` by default, in all *path operations*, instead of `JSONResponse`.
```Python hl_lines="2 4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
```
/// tip
diff --git a/docs/en/docs/advanced/dataclasses.md b/docs/en/docs/advanced/dataclasses.md
index 252ab6fa5..efc07eab2 100644
--- a/docs/en/docs/advanced/dataclasses.md
+++ b/docs/en/docs/advanced/dataclasses.md
@@ -5,7 +5,7 @@ FastAPI is built on top of **Pydantic**, and I have been showing you how to use
But FastAPI also supports using `dataclasses` the same way:
```Python hl_lines="1 7-12 19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
```
This is still supported thanks to **Pydantic**, as it has internal support for `dataclasses`.
@@ -35,7 +35,7 @@ But if you have a bunch of dataclasses laying around, this is a nice trick to us
You can also use `dataclasses` in the `response_model` parameter:
```Python hl_lines="1 7-13 19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
```
The dataclass will be automatically converted to a Pydantic dataclass.
@@ -53,7 +53,7 @@ In some cases, you might still have to use Pydantic's version of `dataclasses`.
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!}
+{!../../docs_src/dataclasses/tutorial003.py!}
```
1. We still import `field` from standard `dataclasses`.
diff --git a/docs/en/docs/advanced/events.md b/docs/en/docs/advanced/events.md
index 7fd934344..efce492f4 100644
--- a/docs/en/docs/advanced/events.md
+++ b/docs/en/docs/advanced/events.md
@@ -31,7 +31,7 @@ Let's start with an example and then see it in detail.
We create an async function `lifespan()` with `yield` like this:
```Python hl_lines="16 19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
Here we are simulating the expensive *startup* operation of loading the model by putting the (fake) model function in the dictionary with machine learning models before the `yield`. This code will be executed **before** the application **starts taking requests**, during the *startup*.
@@ -51,7 +51,7 @@ Maybe you need to start a new version, or you just got tired of running it. 🤷
The first thing to notice, is that we are defining an async function with `yield`. This is very similar to Dependencies with `yield`.
```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
The first part of the function, before the `yield`, will be executed **before** the application starts.
@@ -65,7 +65,7 @@ If you check, the function is decorated with an `@asynccontextmanager`.
That converts the function into something called an "**async context manager**".
```Python hl_lines="1 13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
A **context manager** in Python is something that you can use in a `with` statement, for example, `open()` can be used as a context manager:
@@ -89,7 +89,7 @@ In our code example above, we don't use it directly, but we pass it to FastAPI f
The `lifespan` parameter of the `FastAPI` app takes an **async context manager**, so we can pass our new `lifespan` async context manager to it.
```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
```
## Alternative Events (deprecated)
@@ -113,7 +113,7 @@ These functions can be declared with `async def` or normal `def`.
To add a function that should be run before the application starts, declare it with the event `"startup"`:
```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
```
In this case, the `startup` event handler function will initialize the items "database" (just a `dict`) with some values.
@@ -127,7 +127,7 @@ And your application won't start receiving requests until all the `startup` even
To add a function that should be run when the application is shutting down, declare it with the event `"shutdown"`:
```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
```
Here, the `shutdown` event handler function will write a text line `"Application shutdown"` to a file `log.txt`.
diff --git a/docs/en/docs/advanced/generate-clients.md b/docs/en/docs/advanced/generate-clients.md
index faa7c323f..7872103c3 100644
--- a/docs/en/docs/advanced/generate-clients.md
+++ b/docs/en/docs/advanced/generate-clients.md
@@ -35,7 +35,7 @@ Let's start with a simple FastAPI application:
//// tab | Python 3.9+
```Python hl_lines="7-9 12-13 16-17 21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
```
////
@@ -43,7 +43,7 @@ Let's start with a simple FastAPI application:
//// tab | Python 3.8+
```Python hl_lines="9-11 14-15 18 19 23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
```
////
@@ -154,7 +154,7 @@ For example, you could have a section for **items** and another section for **us
//// tab | Python 3.9+
```Python hl_lines="21 26 34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
```
////
@@ -162,7 +162,7 @@ For example, you could have a section for **items** and another section for **us
//// tab | Python 3.8+
```Python hl_lines="23 28 36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
```
////
@@ -215,7 +215,7 @@ You can then pass that custom function to **FastAPI** as the `generate_unique_id
//// tab | Python 3.9+
```Python hl_lines="6-7 10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
```
////
@@ -223,7 +223,7 @@ You can then pass that custom function to **FastAPI** as the `generate_unique_id
//// tab | Python 3.8+
```Python hl_lines="8-9 12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
```
////
@@ -251,7 +251,7 @@ We could download the OpenAPI JSON to a file `openapi.json` and then we could **
//// tab | Python
```Python
-{!> ../../../docs_src/generate_clients/tutorial004.py!}
+{!> ../../docs_src/generate_clients/tutorial004.py!}
```
////
@@ -259,7 +259,7 @@ We could download the OpenAPI JSON to a file `openapi.json` and then we could **
//// tab | Node.js
```Javascript
-{!> ../../../docs_src/generate_clients/tutorial004.js!}
+{!> ../../docs_src/generate_clients/tutorial004.js!}
```
////
diff --git a/docs/en/docs/advanced/middleware.md b/docs/en/docs/advanced/middleware.md
index ab7778db0..07deac716 100644
--- a/docs/en/docs/advanced/middleware.md
+++ b/docs/en/docs/advanced/middleware.md
@@ -58,7 +58,7 @@ Enforces that all incoming requests must either be `https` or `wss`.
Any incoming request to `http` or `ws` will be redirected to the secure scheme instead.
```Python hl_lines="2 6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
```
## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ Any incoming request to `http` or `ws` will be redirected to the secure scheme i
Enforces that all incoming requests have a correctly set `Host` header, in order to guard against HTTP Host Header attacks.
```Python hl_lines="2 6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
```
The following arguments are supported:
@@ -82,7 +82,7 @@ Handles GZip responses for any request that includes `"gzip"` in the `Accept-Enc
The middleware will handle both standard and streaming responses.
```Python hl_lines="2 6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
```
The following arguments are supported:
diff --git a/docs/en/docs/advanced/openapi-callbacks.md b/docs/en/docs/advanced/openapi-callbacks.md
index 7fead2ed9..82069a950 100644
--- a/docs/en/docs/advanced/openapi-callbacks.md
+++ b/docs/en/docs/advanced/openapi-callbacks.md
@@ -32,7 +32,7 @@ It will have a *path operation* that will receive an `Invoice` body, and a query
This part is pretty normal, most of the code is probably already familiar to you:
```Python hl_lines="9-13 36-53"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
/// tip
@@ -93,7 +93,7 @@ Temporarily adopting this point of view (of the *external developer*) can help y
First create a new `APIRouter` that will contain one or more callbacks.
```Python hl_lines="3 25"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
### Create the callback *path operation*
@@ -106,7 +106,7 @@ It should look just like a normal FastAPI *path operation*:
* And it could also have a declaration of the response it should return, e.g. `response_model=InvoiceEventReceived`.
```Python hl_lines="16-18 21-22 28-32"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
There are 2 main differences from a normal *path operation*:
@@ -176,7 +176,7 @@ At this point you have the *callback path operation(s)* needed (the one(s) that
Now use the parameter `callbacks` in *your API's path operation decorator* to pass the attribute `.routes` (that's actually just a `list` of routes/*path operations*) from that callback router:
```Python hl_lines="35"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
```
/// tip
diff --git a/docs/en/docs/advanced/openapi-webhooks.md b/docs/en/docs/advanced/openapi-webhooks.md
index 5ee321e2a..eaaa48a37 100644
--- a/docs/en/docs/advanced/openapi-webhooks.md
+++ b/docs/en/docs/advanced/openapi-webhooks.md
@@ -33,7 +33,7 @@ Webhooks are available in OpenAPI 3.1.0 and above, supported by FastAPI `0.99.0`
When you create a **FastAPI** application, there is a `webhooks` attribute that you can use to define *webhooks*, the same way you would define *path operations*, for example with `@app.webhooks.post()`.
```Python hl_lines="9-13 36-53"
-{!../../../docs_src/openapi_webhooks/tutorial001.py!}
+{!../../docs_src/openapi_webhooks/tutorial001.py!}
```
The webhooks that you define will end up in the **OpenAPI** schema and the automatic **docs UI**.
diff --git a/docs/en/docs/advanced/path-operation-advanced-configuration.md b/docs/en/docs/advanced/path-operation-advanced-configuration.md
index d599006d2..a61e3f19b 100644
--- a/docs/en/docs/advanced/path-operation-advanced-configuration.md
+++ b/docs/en/docs/advanced/path-operation-advanced-configuration.md
@@ -13,7 +13,7 @@ You can set the OpenAPI `operationId` to be used in your *path operation* with t
You would have to make sure that it is unique for each operation.
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### Using the *path operation function* name as the operationId
@@ -23,7 +23,7 @@ If you want to use your APIs' function names as `operationId`s, you can iterate
You should do it after adding all your *path operations*.
```Python hl_lines="2 12-21 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
/// tip
@@ -45,7 +45,7 @@ Even if they are in different modules (Python files).
To exclude a *path operation* from the generated OpenAPI schema (and thus, from the automatic documentation systems), use the parameter `include_in_schema` and set it to `False`:
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## Advanced description from docstring
@@ -57,7 +57,7 @@ Adding an `\f` (an escaped "form feed" character) causes **FastAPI** to truncate
It won't show up in the documentation, but other tools (such as Sphinx) will be able to use the rest.
```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```
## Additional Responses
@@ -101,7 +101,7 @@ You can extend the OpenAPI schema for a *path operation* using the parameter `op
This `openapi_extra` can be helpful, for example, to declare [OpenAPI Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions):
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
```
If you open the automatic API docs, your extension will show up at the bottom of the specific *path operation*.
@@ -150,7 +150,7 @@ For example, you could decide to read and validate the request with your own cod
You could do that with `openapi_extra`:
```Python hl_lines="19-36 39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
```
In this example, we didn't declare any Pydantic model. In fact, the request body is not even parsed as JSON, it is read directly as `bytes`, and the function `magic_data_reader()` would be in charge of parsing it in some way.
@@ -168,7 +168,7 @@ For example, in this application we don't use FastAPI's integrated functionality
//// tab | Pydantic v2
```Python hl_lines="17-22 24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
```
////
@@ -176,7 +176,7 @@ For example, in this application we don't use FastAPI's integrated functionality
//// tab | Pydantic v1
```Python hl_lines="17-22 24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
```
////
@@ -196,7 +196,7 @@ And then in our code, we parse that YAML content directly, and then we are again
//// tab | Pydantic v2
```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
```
////
@@ -204,7 +204,7 @@ And then in our code, we parse that YAML content directly, and then we are again
//// tab | Pydantic v1
```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
```
////
diff --git a/docs/en/docs/advanced/response-change-status-code.md b/docs/en/docs/advanced/response-change-status-code.md
index b88d74a8a..fc041f7de 100644
--- a/docs/en/docs/advanced/response-change-status-code.md
+++ b/docs/en/docs/advanced/response-change-status-code.md
@@ -21,7 +21,7 @@ You can declare a parameter of type `Response` in your *path operation function*
And then you can set the `status_code` in that *temporal* response object.
```Python hl_lines="1 9 12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
```
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
diff --git a/docs/en/docs/advanced/response-cookies.md b/docs/en/docs/advanced/response-cookies.md
index 85e423f42..4467779ba 100644
--- a/docs/en/docs/advanced/response-cookies.md
+++ b/docs/en/docs/advanced/response-cookies.md
@@ -7,7 +7,7 @@ You can declare a parameter of type `Response` in your *path operation function*
And then you can set cookies in that *temporal* response object.
```Python hl_lines="1 8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
```
And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
@@ -27,7 +27,7 @@ To do that, you can create a response as described in [Return a Response Directl
Then set Cookies in it, and then return it:
```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
```
/// tip
diff --git a/docs/en/docs/advanced/response-directly.md b/docs/en/docs/advanced/response-directly.md
index 092aeceb1..8246b9674 100644
--- a/docs/en/docs/advanced/response-directly.md
+++ b/docs/en/docs/advanced/response-directly.md
@@ -35,7 +35,7 @@ For example, you cannot put a Pydantic model in a `JSONResponse` without first c
For those cases, you can use the `jsonable_encoder` to convert your data before passing it to a response:
```Python hl_lines="6-7 21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
```
/// note | "Technical Details"
@@ -57,7 +57,7 @@ Let's say that you want to return an ../../../docs_src/security/tutorial006_an_py39.py!}
+{!> ../../docs_src/security/tutorial006_an_py39.py!}
```
////
@@ -31,7 +31,7 @@ Then, when you type that username and password, the browser sends them in the he
//// tab | Python 3.8+
```Python hl_lines="2 7 11"
-{!> ../../../docs_src/security/tutorial006_an.py!}
+{!> ../../docs_src/security/tutorial006_an.py!}
```
////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="2 6 10"
-{!> ../../../docs_src/security/tutorial006.py!}
+{!> ../../docs_src/security/tutorial006.py!}
```
////
@@ -71,7 +71,7 @@ Then we can use `secrets.compare_digest()` to ensure that `credentials.username`
//// tab | Python 3.9+
```Python hl_lines="1 12-24"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
```
////
@@ -79,7 +79,7 @@ Then we can use `secrets.compare_digest()` to ensure that `credentials.username`
//// tab | Python 3.8+
```Python hl_lines="1 12-24"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
```
////
@@ -93,7 +93,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1 11-21"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
```
////
@@ -163,7 +163,7 @@ After detecting that the credentials are incorrect, return an `HTTPException` wi
//// tab | Python 3.9+
```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
```
////
@@ -171,7 +171,7 @@ After detecting that the credentials are incorrect, return an `HTTPException` wi
//// tab | Python 3.8+
```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
```
////
@@ -185,7 +185,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="23-27"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
```
////
diff --git a/docs/en/docs/advanced/security/oauth2-scopes.md b/docs/en/docs/advanced/security/oauth2-scopes.md
index fdd8db7b9..3db284d02 100644
--- a/docs/en/docs/advanced/security/oauth2-scopes.md
+++ b/docs/en/docs/advanced/security/oauth2-scopes.md
@@ -65,7 +65,7 @@ First, let's quickly see the parts that change from the examples in the main **T
//// tab | Python 3.10+
```Python hl_lines="5 9 13 47 65 106 108-116 122-125 129-135 140 156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -73,7 +73,7 @@ First, let's quickly see the parts that change from the examples in the main **T
//// tab | Python 3.9+
```Python hl_lines="2 5 9 13 47 65 106 108-116 122-125 129-135 140 156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -81,7 +81,7 @@ First, let's quickly see the parts that change from the examples in the main **T
//// tab | Python 3.8+
```Python hl_lines="2 5 9 13 48 66 107 109-117 123-126 130-136 141 157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -95,7 +95,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="4 8 12 46 64 105 107-115 121-124 128-134 139 155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -109,7 +109,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="2 5 9 13 47 65 106 108-116 122-125 129-135 140 156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -123,7 +123,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="2 5 9 13 47 65 106 108-116 122-125 129-135 140 156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -139,7 +139,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
//// tab | Python 3.10+
```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -147,7 +147,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
//// tab | Python 3.9+
```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -155,7 +155,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
//// tab | Python 3.8+
```Python hl_lines="64-67"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -169,7 +169,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -197,7 +197,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -229,7 +229,7 @@ But in your application, for security, you should make sure you only add the sco
//// tab | Python 3.10+
```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -237,7 +237,7 @@ But in your application, for security, you should make sure you only add the sco
//// tab | Python 3.9+
```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -245,7 +245,7 @@ But in your application, for security, you should make sure you only add the sco
//// tab | Python 3.8+
```Python hl_lines="157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -287,7 +287,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -319,7 +319,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
//// tab | Python 3.10+
```Python hl_lines="5 140 171"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -327,7 +327,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
//// tab | Python 3.9+
```Python hl_lines="5 140 171"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -335,7 +335,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
//// tab | Python 3.8+
```Python hl_lines="5 141 172"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -349,7 +349,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="4 139 168"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -363,7 +363,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="5 140 169"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -377,7 +377,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="5 140 169"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -409,7 +409,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
//// tab | Python 3.10+
```Python hl_lines="9 106"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -417,7 +417,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
//// tab | Python 3.9+
```Python hl_lines="9 106"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -425,7 +425,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
//// tab | Python 3.8+
```Python hl_lines="9 107"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -439,7 +439,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8 105"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -453,7 +453,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9 106"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -467,7 +467,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9 106"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -487,7 +487,7 @@ In this exception, we include the scopes required (if any) as a string separated
//// tab | Python 3.10+
```Python hl_lines="106 108-116"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -495,7 +495,7 @@ In this exception, we include the scopes required (if any) as a string separated
//// tab | Python 3.9+
```Python hl_lines="106 108-116"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -503,7 +503,7 @@ In this exception, we include the scopes required (if any) as a string separated
//// tab | Python 3.8+
```Python hl_lines="107 109-117"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -517,7 +517,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="105 107-115"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -531,7 +531,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="106 108-116"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -545,7 +545,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="106 108-116"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -567,7 +567,7 @@ We also verify that we have a user with that username, and if not, we raise that
//// tab | Python 3.10+
```Python hl_lines="47 117-128"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -575,7 +575,7 @@ We also verify that we have a user with that username, and if not, we raise that
//// tab | Python 3.9+
```Python hl_lines="47 117-128"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -583,7 +583,7 @@ We also verify that we have a user with that username, and if not, we raise that
//// tab | Python 3.8+
```Python hl_lines="48 118-129"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -597,7 +597,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="46 116-127"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -611,7 +611,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="47 117-128"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -625,7 +625,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="47 117-128"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
@@ -639,7 +639,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
//// tab | Python 3.10+
```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
```
////
@@ -647,7 +647,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
//// tab | Python 3.9+
```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
```
////
@@ -655,7 +655,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
//// tab | Python 3.8+
```Python hl_lines="130-136"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
```
////
@@ -669,7 +669,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
```
////
@@ -683,7 +683,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
```
////
@@ -697,7 +697,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
```
////
diff --git a/docs/en/docs/advanced/settings.md b/docs/en/docs/advanced/settings.md
index 8c04d2507..01810c438 100644
--- a/docs/en/docs/advanced/settings.md
+++ b/docs/en/docs/advanced/settings.md
@@ -63,7 +63,7 @@ You can use all the same validation features and tools you use for Pydantic mode
//// tab | Pydantic v2
```Python hl_lines="2 5-8 11"
-{!> ../../../docs_src/settings/tutorial001.py!}
+{!> ../../docs_src/settings/tutorial001.py!}
```
////
@@ -77,7 +77,7 @@ In Pydantic v1 you would import `BaseSettings` directly from `pydantic` instead
///
```Python hl_lines="2 5-8 11"
-{!> ../../../docs_src/settings/tutorial001_pv1.py!}
+{!> ../../docs_src/settings/tutorial001_pv1.py!}
```
////
@@ -97,7 +97,7 @@ Next it will convert and validate the data. So, when you use that `settings` obj
Then you can use the new `settings` object in your application:
```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
```
### Run the server
@@ -133,13 +133,13 @@ You could put those settings in another module file as you saw in [Bigger Applic
For example, you could have a file `config.py` with:
```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
```
And then use it in a file `main.py`:
```Python hl_lines="3 11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
```
/// tip
@@ -159,7 +159,7 @@ This could be especially useful during testing, as it's very easy to override a
Coming from the previous example, your `config.py` file could look like:
```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
```
Notice that now we don't create a default instance `settings = Settings()`.
@@ -171,7 +171,7 @@ Now we create a dependency that returns a new `config.Settings()`.
//// tab | Python 3.9+
```Python hl_lines="6 12-13"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
```
////
@@ -179,7 +179,7 @@ Now we create a dependency that returns a new `config.Settings()`.
//// tab | Python 3.8+
```Python hl_lines="6 12-13"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
```
////
@@ -193,7 +193,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="5 11-12"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
```
////
@@ -211,7 +211,7 @@ And then we can require it from the *path operation function* as a dependency an
//// tab | Python 3.9+
```Python hl_lines="17 19-21"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
```
////
@@ -219,7 +219,7 @@ And then we can require it from the *path operation function* as a dependency an
//// tab | Python 3.8+
```Python hl_lines="17 19-21"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
```
////
@@ -233,7 +233,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="16 18-20"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
```
////
@@ -243,7 +243,7 @@ Prefer to use the `Annotated` version if possible.
Then it would be very easy to provide a different settings object during testing by creating a dependency override for `get_settings`:
```Python hl_lines="9-10 13 21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
```
In the dependency override we set a new value for the `admin_email` when creating the new `Settings` object, and then we return that new object.
@@ -288,7 +288,7 @@ And then update your `config.py` with:
//// tab | Pydantic v2
```Python hl_lines="9"
-{!> ../../../docs_src/settings/app03_an/config.py!}
+{!> ../../docs_src/settings/app03_an/config.py!}
```
/// tip
@@ -302,7 +302,7 @@ The `model_config` attribute is used just for Pydantic configuration. You can re
//// tab | Pydantic v1
```Python hl_lines="9-10"
-{!> ../../../docs_src/settings/app03_an/config_pv1.py!}
+{!> ../../docs_src/settings/app03_an/config_pv1.py!}
```
/// tip
@@ -347,7 +347,7 @@ But as we are using the `@lru_cache` decorator on top, the `Settings` object wil
//// tab | Python 3.9+
```Python hl_lines="1 11"
-{!> ../../../docs_src/settings/app03_an_py39/main.py!}
+{!> ../../docs_src/settings/app03_an_py39/main.py!}
```
////
@@ -355,7 +355,7 @@ But as we are using the `@lru_cache` decorator on top, the `Settings` object wil
//// tab | Python 3.8+
```Python hl_lines="1 11"
-{!> ../../../docs_src/settings/app03_an/main.py!}
+{!> ../../docs_src/settings/app03_an/main.py!}
```
////
@@ -369,7 +369,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1 10"
-{!> ../../../docs_src/settings/app03/main.py!}
+{!> ../../docs_src/settings/app03/main.py!}
```
////
diff --git a/docs/en/docs/advanced/sub-applications.md b/docs/en/docs/advanced/sub-applications.md
index 568a9deca..befa9908a 100644
--- a/docs/en/docs/advanced/sub-applications.md
+++ b/docs/en/docs/advanced/sub-applications.md
@@ -11,7 +11,7 @@ If you need to have two independent FastAPI applications, with their own indepen
First, create the main, top-level, **FastAPI** application, and its *path operations*:
```Python hl_lines="3 6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### Sub-application
@@ -21,7 +21,7 @@ Then, create your sub-application, and its *path operations*.
This sub-application is just another standard FastAPI application, but this is the one that will be "mounted":
```Python hl_lines="11 14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### Mount the sub-application
@@ -31,7 +31,7 @@ In your top-level application, `app`, mount the sub-application, `subapi`.
In this case, it will be mounted at the path `/subapi`:
```Python hl_lines="11 19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
```
### Check the automatic API docs
diff --git a/docs/en/docs/advanced/templates.md b/docs/en/docs/advanced/templates.md
index 416540ba4..d688c5cb7 100644
--- a/docs/en/docs/advanced/templates.md
+++ b/docs/en/docs/advanced/templates.md
@@ -28,7 +28,7 @@ $ pip install jinja2
* Use the `templates` you created to render and return a `TemplateResponse`, pass the name of the template, the request object, and a "context" dictionary with key-value pairs to be used inside of the Jinja2 template.
```Python hl_lines="4 11 15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
```
/// note
@@ -58,7 +58,7 @@ You could also use `from starlette.templating import Jinja2Templates`.
Then you can write a template at `templates/item.html` with, for example:
```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
```
### Template Context Values
@@ -112,13 +112,13 @@ For example, with an ID of `42`, this would render:
You can also use `url_for()` inside of the template, and use it, for example, with the `StaticFiles` you mounted with the `name="static"`.
```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
```
In this example, it would link to a CSS file at `static/styles.css` with:
```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
```
And because you are using `StaticFiles`, that CSS file would be served automatically by your **FastAPI** application at the URL `/static/styles.css`.
diff --git a/docs/en/docs/advanced/testing-database.md b/docs/en/docs/advanced/testing-database.md
deleted file mode 100644
index 974cf4caa..000000000
--- a/docs/en/docs/advanced/testing-database.md
+++ /dev/null
@@ -1,111 +0,0 @@
-# Testing a Database
-
-/// info
-
-These docs are about to be updated. 🎉
-
-The current version assumes Pydantic v1, and SQLAlchemy versions less than 2.0.
-
-The new docs will include Pydantic v2 and will use SQLModel (which is also based on SQLAlchemy) once it is updated to use Pydantic v2 as well.
-
-///
-
-You can use the same dependency overrides from [Testing Dependencies with Overrides](testing-dependencies.md){.internal-link target=_blank} to alter a database for testing.
-
-You could want to set up a different database for testing, rollback the data after the tests, pre-fill it with some testing data, etc.
-
-The main idea is exactly the same you saw in that previous chapter.
-
-## Add tests for the SQL app
-
-Let's update the example from [SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank} to use a testing database.
-
-All the app code is the same, you can go back to that chapter check how it was.
-
-The only changes here are in the new testing file.
-
-Your normal dependency `get_db()` would return a database session.
-
-In the test, you could use a dependency override to return your *custom* database session instead of the one that would be used normally.
-
-In this example we'll create a temporary database only for the tests.
-
-## File structure
-
-We create a new file at `sql_app/tests/test_sql_app.py`.
-
-So the new file structure looks like:
-
-``` hl_lines="9-11"
-.
-└── sql_app
- ├── __init__.py
- ├── crud.py
- ├── database.py
- ├── main.py
- ├── models.py
- ├── schemas.py
- └── tests
- ├── __init__.py
- └── test_sql_app.py
-```
-
-## Create the new database session
-
-First, we create a new database session with the new database.
-
-We'll use an in-memory database that persists during the tests instead of the local file `sql_app.db`.
-
-But the rest of the session code is more or less the same, we just copy it.
-
-```Python hl_lines="8-13"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-/// tip
-
-You could reduce duplication in that code by putting it in a function and using it from both `database.py` and `tests/test_sql_app.py`.
-
-For simplicity and to focus on the specific testing code, we are just copying it.
-
-///
-
-## Create the database
-
-Because now we are going to use a new database in a new file, we need to make sure we create the database with:
-
-```Python
-Base.metadata.create_all(bind=engine)
-```
-
-That is normally called in `main.py`, but the line in `main.py` uses the database file `sql_app.db`, and we need to make sure we create `test.db` for the tests.
-
-So we add that line here, with the new file.
-
-```Python hl_lines="16"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-## Dependency override
-
-Now we create the dependency override and add it to the overrides for our app.
-
-```Python hl_lines="19-24 27"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-/// tip
-
-The code for `override_get_db()` is almost exactly the same as for `get_db()`, but in `override_get_db()` we use the `TestingSessionLocal` for the testing database instead.
-
-///
-
-## Test the app
-
-Then we can just test the app as normally.
-
-```Python hl_lines="32-47"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
-```
-
-And all the modifications we made in the database during the tests will be in the `test.db` database instead of the main `sql_app.db`.
diff --git a/docs/en/docs/advanced/testing-dependencies.md b/docs/en/docs/advanced/testing-dependencies.md
index 92e25f88d..1cc4313a1 100644
--- a/docs/en/docs/advanced/testing-dependencies.md
+++ b/docs/en/docs/advanced/testing-dependencies.md
@@ -31,7 +31,7 @@ And then **FastAPI** will call that override instead of the original dependency.
//// tab | Python 3.10+
```Python hl_lines="26-27 30"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py310.py!}
```
////
@@ -39,7 +39,7 @@ And then **FastAPI** will call that override instead of the original dependency.
//// tab | Python 3.9+
```Python hl_lines="28-29 32"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py39.py!}
```
////
@@ -47,7 +47,7 @@ And then **FastAPI** will call that override instead of the original dependency.
//// tab | Python 3.8+
```Python hl_lines="29-30 33"
-{!> ../../../docs_src/dependency_testing/tutorial001_an.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an.py!}
```
////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="24-25 28"
-{!> ../../../docs_src/dependency_testing/tutorial001_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_py310.py!}
```
////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="28-29 32"
-{!> ../../../docs_src/dependency_testing/tutorial001.py!}
+{!> ../../docs_src/dependency_testing/tutorial001.py!}
```
////
diff --git a/docs/en/docs/advanced/testing-events.md b/docs/en/docs/advanced/testing-events.md
index b24a2ccfe..f48907c7c 100644
--- a/docs/en/docs/advanced/testing-events.md
+++ b/docs/en/docs/advanced/testing-events.md
@@ -3,5 +3,5 @@
When you need your event handlers (`startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement:
```Python hl_lines="9-12 20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
```
diff --git a/docs/en/docs/advanced/testing-websockets.md b/docs/en/docs/advanced/testing-websockets.md
index 6c071bc19..ab08c90fe 100644
--- a/docs/en/docs/advanced/testing-websockets.md
+++ b/docs/en/docs/advanced/testing-websockets.md
@@ -5,7 +5,7 @@ You can use the same `TestClient` to test WebSockets.
For this, you use the `TestClient` in a `with` statement, connecting to the WebSocket:
```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
```
/// note
diff --git a/docs/en/docs/advanced/using-request-directly.md b/docs/en/docs/advanced/using-request-directly.md
index 5473db5cb..917d77a95 100644
--- a/docs/en/docs/advanced/using-request-directly.md
+++ b/docs/en/docs/advanced/using-request-directly.md
@@ -30,7 +30,7 @@ Let's imagine you want to get the client's IP address/host inside of your *path
For that you need to access the request directly.
```Python hl_lines="1 7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
```
By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
diff --git a/docs/en/docs/advanced/websockets.md b/docs/en/docs/advanced/websockets.md
index 44c6c7428..8947f32e7 100644
--- a/docs/en/docs/advanced/websockets.md
+++ b/docs/en/docs/advanced/websockets.md
@@ -39,7 +39,7 @@ In production you would have one of the options above.
But it's the simplest way to focus on the server-side of WebSockets and have a working example:
```Python hl_lines="2 6-38 41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
## Create a `websocket`
@@ -47,7 +47,7 @@ But it's the simplest way to focus on the server-side of WebSockets and have a w
In your **FastAPI** application, create a `websocket`:
```Python hl_lines="1 46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
/// note | "Technical Details"
@@ -63,7 +63,7 @@ You could also use `from starlette.websockets import WebSocket`.
In your WebSocket route you can `await` for messages and send messages.
```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
You can receive and send binary, text, and JSON data.
@@ -118,7 +118,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
//// tab | Python 3.10+
```Python hl_lines="68-69 82"
-{!> ../../../docs_src/websockets/tutorial002_an_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py310.py!}
```
////
@@ -126,7 +126,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
//// tab | Python 3.9+
```Python hl_lines="68-69 82"
-{!> ../../../docs_src/websockets/tutorial002_an_py39.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py39.py!}
```
////
@@ -134,7 +134,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
//// tab | Python 3.8+
```Python hl_lines="69-70 83"
-{!> ../../../docs_src/websockets/tutorial002_an.py!}
+{!> ../../docs_src/websockets/tutorial002_an.py!}
```
////
@@ -148,7 +148,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="66-67 79"
-{!> ../../../docs_src/websockets/tutorial002_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_py310.py!}
```
////
@@ -162,7 +162,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="68-69 81"
-{!> ../../../docs_src/websockets/tutorial002.py!}
+{!> ../../docs_src/websockets/tutorial002.py!}
```
////
@@ -213,7 +213,7 @@ When a WebSocket connection is closed, the `await websocket.receive_text()` will
//// tab | Python 3.9+
```Python hl_lines="79-81"
-{!> ../../../docs_src/websockets/tutorial003_py39.py!}
+{!> ../../docs_src/websockets/tutorial003_py39.py!}
```
////
@@ -221,7 +221,7 @@ When a WebSocket connection is closed, the `await websocket.receive_text()` will
//// tab | Python 3.8+
```Python hl_lines="81-83"
-{!> ../../../docs_src/websockets/tutorial003.py!}
+{!> ../../docs_src/websockets/tutorial003.py!}
```
////
diff --git a/docs/en/docs/advanced/wsgi.md b/docs/en/docs/advanced/wsgi.md
index f07609ed6..3974d491c 100644
--- a/docs/en/docs/advanced/wsgi.md
+++ b/docs/en/docs/advanced/wsgi.md
@@ -13,7 +13,7 @@ Then wrap the WSGI (e.g. Flask) app with the middleware.
And then mount that under a path.
```Python hl_lines="2-3 23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
```
## Check it
diff --git a/docs/en/docs/alternatives.md b/docs/en/docs/alternatives.md
index e98c0475a..f596232d3 100644
--- a/docs/en/docs/alternatives.md
+++ b/docs/en/docs/alternatives.md
@@ -321,7 +321,7 @@ This actually inspired updating parts of Pydantic, to support the same validatio
///
-### Hug
+### Hug
Hug was one of the first frameworks to implement the declaration of API parameter types using Python type hints. This was a great idea that inspired other tools to do the same.
diff --git a/docs/en/docs/how-to/async-sql-encode-databases.md b/docs/en/docs/how-to/async-sql-encode-databases.md
deleted file mode 100644
index a75f8ef58..000000000
--- a/docs/en/docs/how-to/async-sql-encode-databases.md
+++ /dev/null
@@ -1,201 +0,0 @@
-# ~~Async SQL (Relational) Databases with Encode/Databases~~ (deprecated)
-
-/// info
-
-These docs are about to be updated. 🎉
-
-The current version assumes Pydantic v1.
-
-The new docs will include Pydantic v2 and will use SQLModel once it is updated to use Pydantic v2 as well.
-
-///
-
-/// warning | "Deprecated"
-
-This tutorial is deprecated and will be removed in a future version.
-
-///
-
-You can also use `encode/databases` with **FastAPI** to connect to databases using `async` and `await`.
-
-It is compatible with:
-
-* PostgreSQL
-* MySQL
-* SQLite
-
-In this example, we'll use **SQLite**, because it uses a single file and Python has integrated support. So, you can copy this example and run it as is.
-
-Later, for your production application, you might want to use a database server like **PostgreSQL**.
-
-/// tip
-
-You could adopt ideas from the section about SQLAlchemy ORM ([SQL (Relational) Databases](../tutorial/sql-databases.md){.internal-link target=_blank}), like using utility functions to perform operations in the database, independent of your **FastAPI** code.
-
-This section doesn't apply those ideas, to be equivalent to the counterpart in Starlette.
-
-///
-
-## Import and set up `SQLAlchemy`
-
-* Import `SQLAlchemy`.
-* Create a `metadata` object.
-* Create a table `notes` using the `metadata` object.
-
-```Python hl_lines="4 14 16-22"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-/// tip
-
-Notice that all this code is pure SQLAlchemy Core.
-
-`databases` is not doing anything here yet.
-
-///
-
-## Import and set up `databases`
-
-* Import `databases`.
-* Create a `DATABASE_URL`.
-* Create a `database` object.
-
-```Python hl_lines="3 9 12"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-/// tip
-
-If you were connecting to a different database (e.g. PostgreSQL), you would need to change the `DATABASE_URL`.
-
-///
-
-## Create the tables
-
-In this case, we are creating the tables in the same Python file, but in production, you would probably want to create them with Alembic, integrated with migrations, etc.
-
-Here, this section would run directly, right before starting your **FastAPI** application.
-
-* Create an `engine`.
-* Create all the tables from the `metadata` object.
-
-```Python hl_lines="25-28"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-## Create models
-
-Create Pydantic models for:
-
-* Notes to be created (`NoteIn`).
-* Notes to be returned (`Note`).
-
-```Python hl_lines="31-33 36-39"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-By creating these Pydantic models, the input data will be validated, serialized (converted), and annotated (documented).
-
-So, you will be able to see it all in the interactive API docs.
-
-## Connect and disconnect
-
-* Create your `FastAPI` application.
-* Create event handlers to connect and disconnect from the database.
-
-```Python hl_lines="42 45-47 50-52"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-## Read notes
-
-Create the *path operation function* to read notes:
-
-```Python hl_lines="55-58"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-/// note
-
-Notice that as we communicate with the database using `await`, the *path operation function* is declared with `async`.
-
-///
-
-### Notice the `response_model=List[Note]`
-
-It uses `typing.List`.
-
-That documents (and validates, serializes, filters) the output data, as a `list` of `Note`s.
-
-## Create notes
-
-Create the *path operation function* to create notes:
-
-```Python hl_lines="61-65"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
-```
-
-/// info
-
-In Pydantic v1 the method was called `.dict()`, it was deprecated (but still supported) in Pydantic v2, and renamed to `.model_dump()`.
-
-The examples here use `.dict()` for compatibility with Pydantic v1, but you should use `.model_dump()` instead if you can use Pydantic v2.
-
-///
-
-/// note
-
-Notice that as we communicate with the database using `await`, the *path operation function* is declared with `async`.
-
-///
-
-### About `{**note.dict(), "id": last_record_id}`
-
-`note` is a Pydantic `Note` object.
-
-`note.dict()` returns a `dict` with its data, something like:
-
-```Python
-{
- "text": "Some note",
- "completed": False,
-}
-```
-
-but it doesn't have the `id` field.
-
-So we create a new `dict`, that contains the key-value pairs from `note.dict()` with:
-
-```Python
-{**note.dict()}
-```
-
-`**note.dict()` "unpacks" the key value pairs directly, so, `{**note.dict()}` would be, more or less, a copy of `note.dict()`.
-
-And then, we extend that copy `dict`, adding another key-value pair: `"id": last_record_id`:
-
-```Python
-{**note.dict(), "id": last_record_id}
-```
-
-So, the final result returned would be something like:
-
-```Python
-{
- "id": 1,
- "text": "Some note",
- "completed": False,
-}
-```
-
-## Check it
-
-You can copy this code as is, and see the docs at http://127.0.0.1:8000/docs.
-
-There you can see all your API documented and interact with it:
-
-await
support, we should declare our function with normal `def` instead of `async def`.
-
-Also, Couchbase recommends not using a single `Bucket` object in multiple "threads", so, we can just get the bucket directly and pass it to our utility functions:
-
-```Python hl_lines="49-53"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
-```
-
-## Recap
-
-You can integrate any third party NoSQL database, just using their standard packages.
-
-The same applies to any other external tool, system or API.
diff --git a/docs/en/docs/how-to/separate-openapi-schemas.md b/docs/en/docs/how-to/separate-openapi-schemas.md
index 0ab5b1337..75fd3f9b6 100644
--- a/docs/en/docs/how-to/separate-openapi-schemas.md
+++ b/docs/en/docs/how-to/separate-openapi-schemas.md
@@ -13,7 +13,7 @@ Let's say you have a Pydantic model with default values, like this one:
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
# Code below omitted 👇
```
@@ -22,7 +22,7 @@ Let's say you have a Pydantic model with default values, like this one:
kwargs
. Even if they don't have a default value.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
### Better with `Annotated`
@@ -220,7 +220,7 @@ Keep in mind that if you use `Annotated`, as you are not using function paramete
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
```
////
@@ -228,7 +228,7 @@ Keep in mind that if you use `Annotated`, as you are not using function paramete
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
```
////
@@ -242,7 +242,7 @@ Here, with `ge=1`, `item_id` will need to be an integer number "`g`reater than o
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
```
////
@@ -250,7 +250,7 @@ Here, with `ge=1`, `item_id` will need to be an integer number "`g`reater than o
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
```
////
@@ -264,7 +264,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
////
@@ -279,7 +279,7 @@ The same applies for:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
```
////
@@ -287,7 +287,7 @@ The same applies for:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
```
////
@@ -301,7 +301,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
////
@@ -319,7 +319,7 @@ And the same for lt
.
//// tab | Python 3.9+
```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
```
////
@@ -327,7 +327,7 @@ And the same for lt
.
//// tab | Python 3.8+
```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
```
////
@@ -341,7 +341,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
////
diff --git a/docs/en/docs/tutorial/path-params.md b/docs/en/docs/tutorial/path-params.md
index a87a29e08..fd9e74585 100644
--- a/docs/en/docs/tutorial/path-params.md
+++ b/docs/en/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
You can declare path "parameters" or "variables" with the same syntax used by Python format strings:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
The value of the path parameter `item_id` will be passed to your function as the argument `item_id`.
@@ -19,7 +19,7 @@ So, if you run this example and go to ../../../docs_src/query_param_models/tutorial001_an_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an_py310.py!}
```
////
@@ -25,7 +25,7 @@ Declare the **query parameters** that you need in a **Pydantic model**, and then
//// tab | Python 3.9+
```Python hl_lines="8-12 16"
-{!> ../../../docs_src/query_param_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an_py39.py!}
```
////
@@ -33,7 +33,7 @@ Declare the **query parameters** that you need in a **Pydantic model**, and then
//// tab | Python 3.8+
```Python hl_lines="10-14 18"
-{!> ../../../docs_src/query_param_models/tutorial001_an.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an.py!}
```
////
@@ -47,7 +47,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9-13 17"
-{!> ../../../docs_src/query_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
```
////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8-12 16"
-{!> ../../../docs_src/query_param_models/tutorial001_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py39.py!}
```
////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9-13 17"
-{!> ../../../docs_src/query_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
```
////
@@ -99,7 +99,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_param_models/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an_py310.py!}
```
////
@@ -107,7 +107,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_param_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an_py39.py!}
```
////
@@ -115,7 +115,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_param_models/tutorial002_an.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an.py!}
```
////
@@ -129,7 +129,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_param_models/tutorial002_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial002_py310.py!}
```
////
@@ -143,7 +143,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_param_models/tutorial002_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial002_py39.py!}
```
////
@@ -157,7 +157,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_param_models/tutorial002.py!}
+{!> ../../docs_src/query_param_models/tutorial002.py!}
```
////
diff --git a/docs/en/docs/tutorial/query-params-str-validations.md b/docs/en/docs/tutorial/query-params-str-validations.md
index dd101a2a6..12778d7fe 100644
--- a/docs/en/docs/tutorial/query-params-str-validations.md
+++ b/docs/en/docs/tutorial/query-params-str-validations.md
@@ -7,7 +7,7 @@ Let's take this application as example:
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
```
////
@@ -15,7 +15,7 @@ Let's take this application as example:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
```
////
@@ -46,7 +46,7 @@ To achieve that, first import:
In Python 3.9 or above, `Annotated` is part of the standard library, so you can import it from `typing`.
```Python hl_lines="1 3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -58,7 +58,7 @@ In versions of Python below Python 3.9 you import `Annotated` from `typing_exten
It will already be installed with FastAPI.
```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -126,7 +126,7 @@ Now that we have this `Annotated` where we can put more information (in this cas
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -134,7 +134,7 @@ Now that we have this `Annotated` where we can put more information (in this cas
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -170,7 +170,7 @@ This is how you would use `Query()` as the default value of your function parame
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
```
////
@@ -178,7 +178,7 @@ This is how you would use `Query()` as the default value of your function parame
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
```
////
@@ -284,7 +284,7 @@ You can also add a parameter `min_length`:
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
```
////
@@ -292,7 +292,7 @@ You can also add a parameter `min_length`:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
```
////
@@ -300,7 +300,7 @@ You can also add a parameter `min_length`:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
```
////
@@ -314,7 +314,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
```
////
@@ -328,7 +328,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
```
////
@@ -340,7 +340,7 @@ You can define a ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
```
////
@@ -348,7 +348,7 @@ You can define a ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
```
////
@@ -356,7 +356,7 @@ You can define a ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
```
////
@@ -370,7 +370,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
```
////
@@ -384,7 +384,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
```
////
@@ -408,7 +408,7 @@ You could still see some code using it:
//// tab | Python 3.10+ Pydantic v1
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
```
////
@@ -424,7 +424,7 @@ Let's say that you want to declare the `q` query parameter to have a `min_length
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
```
////
@@ -432,7 +432,7 @@ Let's say that you want to declare the `q` query parameter to have a `min_length
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
```
////
@@ -446,7 +446,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
```
////
@@ -494,7 +494,7 @@ So, when you need to declare a value as required while using `Query`, you can si
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
```
////
@@ -502,7 +502,7 @@ So, when you need to declare a value as required while using `Query`, you can si
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
```
////
@@ -516,7 +516,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// tip
@@ -536,7 +536,7 @@ There's an alternative way to explicitly declare that a value is required. You c
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
```
////
@@ -544,7 +544,7 @@ There's an alternative way to explicitly declare that a value is required. You c
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
```
////
@@ -558,7 +558,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
```
////
@@ -582,7 +582,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
```
////
@@ -590,7 +590,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
```
////
@@ -598,7 +598,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
```
////
@@ -612,7 +612,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
```
////
@@ -626,7 +626,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
```
////
@@ -652,7 +652,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
```
////
@@ -660,7 +660,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
```
////
@@ -668,7 +668,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
```
////
@@ -682,7 +682,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
```
////
@@ -696,7 +696,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
```
////
@@ -710,7 +710,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
```
////
@@ -751,7 +751,7 @@ And you can also define a default `list` of values if none are provided:
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
```
////
@@ -759,7 +759,7 @@ And you can also define a default `list` of values if none are provided:
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
```
////
@@ -773,7 +773,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
```
////
@@ -787,7 +787,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
```
////
@@ -816,7 +816,7 @@ You can also use `list` directly instead of `List[str]` (or `list[str]` in Pytho
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
```
////
@@ -824,7 +824,7 @@ You can also use `list` directly instead of `List[str]` (or `list[str]` in Pytho
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
```
////
@@ -838,7 +838,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
```
////
@@ -870,7 +870,7 @@ You can add a `title`:
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
```
////
@@ -878,7 +878,7 @@ You can add a `title`:
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
```
////
@@ -886,7 +886,7 @@ You can add a `title`:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
```
////
@@ -900,7 +900,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
```
////
@@ -914,7 +914,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
```
////
@@ -924,7 +924,7 @@ And a `description`:
//// tab | Python 3.10+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
```
////
@@ -932,7 +932,7 @@ And a `description`:
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
```
////
@@ -940,7 +940,7 @@ And a `description`:
//// tab | Python 3.8+
```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
```
////
@@ -954,7 +954,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
```
////
@@ -968,7 +968,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
```
////
@@ -994,7 +994,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
```
////
@@ -1002,7 +1002,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
```
////
@@ -1010,7 +1010,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
```
////
@@ -1024,7 +1024,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
```
////
@@ -1038,7 +1038,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
```
////
@@ -1054,7 +1054,7 @@ Then pass the parameter `deprecated=True` to `Query`:
//// tab | Python 3.10+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
```
////
@@ -1062,7 +1062,7 @@ Then pass the parameter `deprecated=True` to `Query`:
//// tab | Python 3.9+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
```
////
@@ -1070,7 +1070,7 @@ Then pass the parameter `deprecated=True` to `Query`:
//// tab | Python 3.8+
```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
```
////
@@ -1084,7 +1084,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
```
////
@@ -1098,7 +1098,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
```
////
@@ -1114,7 +1114,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
```
////
@@ -1122,7 +1122,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
```
////
@@ -1130,7 +1130,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
```
////
@@ -1144,7 +1144,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
```
////
@@ -1158,7 +1158,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
```
////
diff --git a/docs/en/docs/tutorial/query-params.md b/docs/en/docs/tutorial/query-params.md
index a98ac9b28..0d31d453d 100644
--- a/docs/en/docs/tutorial/query-params.md
+++ b/docs/en/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
When you declare other function parameters that are not part of the path parameters, they are automatically interpreted as "query" parameters.
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
The query is the set of key-value pairs that go after the `?` in a URL, separated by `&` characters.
@@ -66,7 +66,7 @@ The same way, you can declare optional query parameters, by setting their defaul
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
```
////
@@ -74,7 +74,7 @@ The same way, you can declare optional query parameters, by setting their defaul
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
```
////
@@ -94,7 +94,7 @@ You can also declare `bool` types, and they will be converted:
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
```
////
@@ -102,7 +102,7 @@ You can also declare `bool` types, and they will be converted:
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
```
////
@@ -151,7 +151,7 @@ They will be detected by name:
//// tab | Python 3.10+
```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
```
////
@@ -159,7 +159,7 @@ They will be detected by name:
//// tab | Python 3.8+
```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
```
////
@@ -173,7 +173,7 @@ If you don't want to add a specific value but just make it optional, set the def
But when you want to make a query parameter required, you can just not declare any default value:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
Here the query parameter `needy` is a required query parameter of type `str`.
@@ -223,7 +223,7 @@ And of course, you can define some parameters as required, some as having a defa
//// tab | Python 3.10+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
```
////
@@ -231,7 +231,7 @@ And of course, you can define some parameters as required, some as having a defa
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
```
////
diff --git a/docs/en/docs/tutorial/request-files.md b/docs/en/docs/tutorial/request-files.md
index 9f19596a8..f3f1eb103 100644
--- a/docs/en/docs/tutorial/request-files.md
+++ b/docs/en/docs/tutorial/request-files.md
@@ -23,7 +23,7 @@ Import `File` and `UploadFile` from `fastapi`:
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -31,7 +31,7 @@ Import `File` and `UploadFile` from `fastapi`:
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -57,7 +57,7 @@ Create file parameters the same way you would for `Body` or `Form`:
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -65,7 +65,7 @@ Create file parameters the same way you would for `Body` or `Form`:
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -79,7 +79,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -113,7 +113,7 @@ Define a file parameter with a type of `UploadFile`:
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -121,7 +121,7 @@ Define a file parameter with a type of `UploadFile`:
//// tab | Python 3.8+
```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -135,7 +135,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -224,7 +224,7 @@ You can make a file optional by using standard type annotations and setting a de
//// tab | Python 3.10+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
```
////
@@ -232,7 +232,7 @@ You can make a file optional by using standard type annotations and setting a de
//// tab | Python 3.9+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
```
////
@@ -240,7 +240,7 @@ You can make a file optional by using standard type annotations and setting a de
//// tab | Python 3.8+
```Python hl_lines="10 18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
```
////
@@ -254,7 +254,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7 15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
```
////
@@ -268,7 +268,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
```
////
@@ -280,7 +280,7 @@ You can also use `File()` with `UploadFile`, for example, to set additional meta
//// tab | Python 3.9+
```Python hl_lines="9 15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
```
////
@@ -288,7 +288,7 @@ You can also use `File()` with `UploadFile`, for example, to set additional meta
//// tab | Python 3.8+
```Python hl_lines="8 14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
```
////
@@ -302,7 +302,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7 13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
```
////
@@ -318,7 +318,7 @@ To use that, declare a list of `bytes` or `UploadFile`:
//// tab | Python 3.9+
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
```
////
@@ -326,7 +326,7 @@ To use that, declare a list of `bytes` or `UploadFile`:
//// tab | Python 3.8+
```Python hl_lines="11 16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
```
////
@@ -340,7 +340,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8 13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
```
////
@@ -354,7 +354,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
```
////
@@ -376,7 +376,7 @@ And the same way as before, you can use `File()` to set additional parameters, e
//// tab | Python 3.9+
```Python hl_lines="11 18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
```
////
@@ -384,7 +384,7 @@ And the same way as before, you can use `File()` to set additional parameters, e
//// tab | Python 3.8+
```Python hl_lines="12 19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
```
////
@@ -398,7 +398,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="9 16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
```
////
@@ -412,7 +412,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="11 18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
```
////
diff --git a/docs/en/docs/tutorial/request-form-models.md b/docs/en/docs/tutorial/request-form-models.md
index 1440d17b8..f1142877a 100644
--- a/docs/en/docs/tutorial/request-form-models.md
+++ b/docs/en/docs/tutorial/request-form-models.md
@@ -27,7 +27,7 @@ You just need to declare a **Pydantic model** with the fields you want to receiv
//// tab | Python 3.9+
```Python hl_lines="9-11 15"
-{!> ../../../docs_src/request_form_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an_py39.py!}
```
////
@@ -35,7 +35,7 @@ You just need to declare a **Pydantic model** with the fields you want to receiv
//// tab | Python 3.8+
```Python hl_lines="8-10 14"
-{!> ../../../docs_src/request_form_models/tutorial001_an.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an.py!}
```
////
@@ -49,7 +49,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7-9 13"
-{!> ../../../docs_src/request_form_models/tutorial001.py!}
+{!> ../../docs_src/request_form_models/tutorial001.py!}
```
////
@@ -79,7 +79,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/request_form_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an_py39.py!}
```
////
@@ -87,7 +87,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/request_form_models/tutorial002_an.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an.py!}
```
////
@@ -101,7 +101,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/request_form_models/tutorial002.py!}
+{!> ../../docs_src/request_form_models/tutorial002.py!}
```
////
diff --git a/docs/en/docs/tutorial/request-forms-and-files.md b/docs/en/docs/tutorial/request-forms-and-files.md
index 7830a2ba4..d60fc4c00 100644
--- a/docs/en/docs/tutorial/request-forms-and-files.md
+++ b/docs/en/docs/tutorial/request-forms-and-files.md
@@ -19,7 +19,7 @@ $ pip install python-multipart
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -27,7 +27,7 @@ $ pip install python-multipart
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -41,7 +41,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
@@ -53,7 +53,7 @@ Create file and form parameters the same way you would for `Body` or `Query`:
//// tab | Python 3.9+
```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -61,7 +61,7 @@ Create file and form parameters the same way you would for `Body` or `Query`:
//// tab | Python 3.8+
```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
diff --git a/docs/en/docs/tutorial/request-forms.md b/docs/en/docs/tutorial/request-forms.md
index 87cfdefbc..2ccc6886e 100644
--- a/docs/en/docs/tutorial/request-forms.md
+++ b/docs/en/docs/tutorial/request-forms.md
@@ -21,7 +21,7 @@ Import `Form` from `fastapi`:
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -29,7 +29,7 @@ Import `Form` from `fastapi`:
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -43,7 +43,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
@@ -55,7 +55,7 @@ Create form parameters the same way you would for `Body` or `Query`:
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -63,7 +63,7 @@ Create form parameters the same way you would for `Body` or `Query`:
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -77,7 +77,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
diff --git a/docs/en/docs/tutorial/response-model.md b/docs/en/docs/tutorial/response-model.md
index 6a2093e6d..36ccfc4ce 100644
--- a/docs/en/docs/tutorial/response-model.md
+++ b/docs/en/docs/tutorial/response-model.md
@@ -7,7 +7,7 @@ You can use **type annotations** the same way you would for input data in functi
//// tab | Python 3.10+
```Python hl_lines="16 21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
```
////
@@ -15,7 +15,7 @@ You can use **type annotations** the same way you would for input data in functi
//// tab | Python 3.9+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
```
////
@@ -23,7 +23,7 @@ You can use **type annotations** the same way you would for input data in functi
//// tab | Python 3.8+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
```
////
@@ -62,7 +62,7 @@ You can use the `response_model` parameter in any of the *path operations*:
//// tab | Python 3.10+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
```
////
@@ -70,7 +70,7 @@ You can use the `response_model` parameter in any of the *path operations*:
//// tab | Python 3.9+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
```
////
@@ -78,7 +78,7 @@ You can use the `response_model` parameter in any of the *path operations*:
//// tab | Python 3.8+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
```
////
@@ -116,7 +116,7 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
//// tab | Python 3.10+
```Python hl_lines="7 9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -124,7 +124,7 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
//// tab | Python 3.8+
```Python hl_lines="9 11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -152,7 +152,7 @@ And we are using this model to declare our input and the same model to declare o
//// tab | Python 3.10+
```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -160,7 +160,7 @@ And we are using this model to declare our input and the same model to declare o
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -184,7 +184,7 @@ We can instead create an input model with the plaintext password and an output m
//// tab | Python 3.10+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -192,7 +192,7 @@ We can instead create an input model with the plaintext password and an output m
//// tab | Python 3.8+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -202,7 +202,7 @@ Here, even though our *path operation function* is returning the same input user
//// tab | Python 3.10+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -210,7 +210,7 @@ Here, even though our *path operation function* is returning the same input user
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -220,7 +220,7 @@ Here, even though our *path operation function* is returning the same input user
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -228,7 +228,7 @@ Here, even though our *path operation function* is returning the same input user
//// tab | Python 3.8+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -258,7 +258,7 @@ And in those cases, we can use classes and inheritance to take advantage of func
//// tab | Python 3.10+
```Python hl_lines="7-10 13-14 18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
```
////
@@ -266,7 +266,7 @@ And in those cases, we can use classes and inheritance to take advantage of func
//// tab | Python 3.8+
```Python hl_lines="9-13 15-16 20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
```
////
@@ -312,7 +312,7 @@ There might be cases where you return something that is not a valid Pydantic fie
The most common case would be [returning a Response directly as explained later in the advanced docs](../advanced/response-directly.md){.internal-link target=_blank}.
```Python hl_lines="8 10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
```
This simple case is handled automatically by FastAPI because the return type annotation is the class (or a subclass of) `Response`.
@@ -324,7 +324,7 @@ And tools will also be happy because both `RedirectResponse` and `JSONResponse`
You can also use a subclass of `Response` in the type annotation:
```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
```
This will also work because `RedirectResponse` is a subclass of `Response`, and FastAPI will automatically handle this simple case.
@@ -338,7 +338,7 @@ The same would happen if you had something like a ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
```
////
@@ -364,7 +364,7 @@ In this case, you can disable the response model generation by setting `response
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
```
////
@@ -372,7 +372,7 @@ In this case, you can disable the response model generation by setting `response
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
```
////
@@ -386,7 +386,7 @@ Your response model could have default values, like:
//// tab | Python 3.10+
```Python hl_lines="9 11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -394,7 +394,7 @@ Your response model could have default values, like:
//// tab | Python 3.9+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -402,7 +402,7 @@ Your response model could have default values, like:
//// tab | Python 3.8+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -422,7 +422,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -430,7 +430,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
//// tab | Python 3.9+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -438,7 +438,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -541,7 +541,7 @@ This also applies to `response_model_by_alias` that works similarly.
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
```
////
@@ -549,7 +549,7 @@ This also applies to `response_model_by_alias` that works similarly.
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
```
////
@@ -569,7 +569,7 @@ If you forget to use a `set` and use a `list` or `tuple` instead, FastAPI will s
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
```
////
@@ -577,7 +577,7 @@ If you forget to use a `set` and use a `list` or `tuple` instead, FastAPI will s
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
```
////
diff --git a/docs/en/docs/tutorial/response-status-code.md b/docs/en/docs/tutorial/response-status-code.md
index 2613bf73d..73af62aed 100644
--- a/docs/en/docs/tutorial/response-status-code.md
+++ b/docs/en/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@ The same way you can specify a response model, you can also declare the HTTP sta
* etc.
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note
@@ -77,7 +77,7 @@ To know more about each status code and which code is for what, check the ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
```
////
@@ -19,7 +19,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
//// tab | Python 3.10+ Pydantic v1
```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
```
////
@@ -27,7 +27,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
//// tab | Python 3.8+ Pydantic v2
```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
```
////
@@ -35,7 +35,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
//// tab | Python 3.8+ Pydantic v1
```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
```
////
@@ -83,7 +83,7 @@ When using `Field()` with Pydantic models, you can also declare additional `exam
//// tab | Python 3.10+
```Python hl_lines="2 8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
```
////
@@ -91,7 +91,7 @@ When using `Field()` with Pydantic models, you can also declare additional `exam
//// tab | Python 3.8+
```Python hl_lines="4 10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
```
////
@@ -117,7 +117,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
//// tab | Python 3.10+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
```
////
@@ -125,7 +125,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
//// tab | Python 3.9+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
```
////
@@ -133,7 +133,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
//// tab | Python 3.8+
```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
```
////
@@ -147,7 +147,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
```
////
@@ -161,7 +161,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
```
////
@@ -179,7 +179,7 @@ You can of course also pass multiple `examples`:
//// tab | Python 3.10+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
```
////
@@ -187,7 +187,7 @@ You can of course also pass multiple `examples`:
//// tab | Python 3.9+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
```
////
@@ -195,7 +195,7 @@ You can of course also pass multiple `examples`:
//// tab | Python 3.8+
```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
```
////
@@ -209,7 +209,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
```
////
@@ -223,7 +223,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
```
////
@@ -270,7 +270,7 @@ You can use it like this:
//// tab | Python 3.10+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
```
////
@@ -278,7 +278,7 @@ You can use it like this:
//// tab | Python 3.9+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
```
////
@@ -286,7 +286,7 @@ You can use it like this:
//// tab | Python 3.8+
```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
```
////
@@ -300,7 +300,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
```
////
@@ -314,7 +314,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
```
////
diff --git a/docs/en/docs/tutorial/security/first-steps.md b/docs/en/docs/tutorial/security/first-steps.md
index d1fe0163e..ead2aa799 100644
--- a/docs/en/docs/tutorial/security/first-steps.md
+++ b/docs/en/docs/tutorial/security/first-steps.md
@@ -23,7 +23,7 @@ Copy the example in a file `main.py`:
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -31,7 +31,7 @@ Copy the example in a file `main.py`:
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -163,7 +163,7 @@ When we create an instance of the `OAuth2PasswordBearer` class we pass in the `t
//// tab | Python 3.9+
```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -171,7 +171,7 @@ When we create an instance of the `OAuth2PasswordBearer` class we pass in the `t
//// tab | Python 3.8+
```Python hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -185,7 +185,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -229,7 +229,7 @@ Now you can pass that `oauth2_scheme` in a dependency with `Depends`.
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -237,7 +237,7 @@ Now you can pass that `oauth2_scheme` in a dependency with `Depends`.
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -251,7 +251,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
diff --git a/docs/en/docs/tutorial/security/get-current-user.md b/docs/en/docs/tutorial/security/get-current-user.md
index 7faaa3e13..069806621 100644
--- a/docs/en/docs/tutorial/security/get-current-user.md
+++ b/docs/en/docs/tutorial/security/get-current-user.md
@@ -5,7 +5,7 @@ In the previous chapter the security system (which is based on the dependency in
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -13,7 +13,7 @@ In the previous chapter the security system (which is based on the dependency in
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -27,7 +27,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -45,7 +45,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
//// tab | Python 3.10+
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -53,7 +53,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
//// tab | Python 3.9+
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -61,7 +61,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
//// tab | Python 3.8+
```Python hl_lines="5 13-17"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="3 10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -89,7 +89,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -107,7 +107,7 @@ The same as we were doing before in the *path operation* directly, our new depen
//// tab | Python 3.10+
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -115,7 +115,7 @@ The same as we were doing before in the *path operation* directly, our new depen
//// tab | Python 3.9+
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -123,7 +123,7 @@ The same as we were doing before in the *path operation* directly, our new depen
//// tab | Python 3.8+
```Python hl_lines="26"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -137,7 +137,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -151,7 +151,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -163,7 +163,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.10+
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -171,7 +171,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.9+
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -179,7 +179,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.8+
```Python hl_lines="20-23 27-28"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -193,7 +193,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="17-20 24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -207,7 +207,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -219,7 +219,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
//// tab | Python 3.10+
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -227,7 +227,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
//// tab | Python 3.9+
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -235,7 +235,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
//// tab | Python 3.8+
```Python hl_lines="32"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -249,7 +249,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -263,7 +263,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -323,7 +323,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
//// tab | Python 3.10+
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
```
////
@@ -331,7 +331,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
//// tab | Python 3.9+
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
```
////
@@ -339,7 +339,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
//// tab | Python 3.8+
```Python hl_lines="31-33"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
```
////
@@ -353,7 +353,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -367,7 +367,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
diff --git a/docs/en/docs/tutorial/security/oauth2-jwt.md b/docs/en/docs/tutorial/security/oauth2-jwt.md
index ba2bfef29..f454a8b28 100644
--- a/docs/en/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/en/docs/tutorial/security/oauth2-jwt.md
@@ -119,7 +119,7 @@ And another one to authenticate and return a user.
//// tab | Python 3.10+
```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -127,7 +127,7 @@ And another one to authenticate and return a user.
//// tab | Python 3.9+
```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -135,7 +135,7 @@ And another one to authenticate and return a user.
//// tab | Python 3.8+
```Python hl_lines="8 50 57-58 61-62 71-77"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -149,7 +149,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -163,7 +163,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8 49 56-57 60-61 70-76"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -205,7 +205,7 @@ Create a utility function to generate a new access token.
//// tab | Python 3.10+
```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -213,7 +213,7 @@ Create a utility function to generate a new access token.
//// tab | Python 3.9+
```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -221,7 +221,7 @@ Create a utility function to generate a new access token.
//// tab | Python 3.8+
```Python hl_lines="4 7 14-16 30-32 80-88"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -235,7 +235,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="3 6 12-14 28-30 78-86"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -249,7 +249,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="4 7 13-15 29-31 79-87"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -265,7 +265,7 @@ If the token is invalid, return an HTTP error right away.
//// tab | Python 3.10+
```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -273,7 +273,7 @@ If the token is invalid, return an HTTP error right away.
//// tab | Python 3.9+
```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -281,7 +281,7 @@ If the token is invalid, return an HTTP error right away.
//// tab | Python 3.8+
```Python hl_lines="91-108"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -295,7 +295,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -309,7 +309,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
@@ -323,7 +323,7 @@ Create a real JWT access token and return it.
//// tab | Python 3.10+
```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
```
////
@@ -331,7 +331,7 @@ Create a real JWT access token and return it.
//// tab | Python 3.9+
```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
```
////
@@ -339,7 +339,7 @@ Create a real JWT access token and return it.
//// tab | Python 3.8+
```Python hl_lines="119-134"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
```
////
@@ -353,7 +353,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
```
////
@@ -367,7 +367,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="116-131"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
```
////
diff --git a/docs/en/docs/tutorial/security/simple-oauth2.md b/docs/en/docs/tutorial/security/simple-oauth2.md
index c9f6a1382..dc15bef20 100644
--- a/docs/en/docs/tutorial/security/simple-oauth2.md
+++ b/docs/en/docs/tutorial/security/simple-oauth2.md
@@ -55,7 +55,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
//// tab | Python 3.10+
```Python hl_lines="4 78"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -63,7 +63,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
//// tab | Python 3.9+
```Python hl_lines="4 78"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -71,7 +71,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
//// tab | Python 3.8+
```Python hl_lines="4 79"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -85,7 +85,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="2 74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -99,7 +99,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="4 76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -153,7 +153,7 @@ For the error, we use the exception `HTTPException`:
//// tab | Python 3.10+
```Python hl_lines="3 79-81"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -161,7 +161,7 @@ For the error, we use the exception `HTTPException`:
//// tab | Python 3.9+
```Python hl_lines="3 79-81"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -169,7 +169,7 @@ For the error, we use the exception `HTTPException`:
//// tab | Python 3.8+
```Python hl_lines="3 80-82"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1 75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -197,7 +197,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="3 77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -229,7 +229,7 @@ So, the thief won't be able to try to use those same passwords in another system
//// tab | Python 3.10+
```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -237,7 +237,7 @@ So, the thief won't be able to try to use those same passwords in another system
//// tab | Python 3.9+
```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -245,7 +245,7 @@ So, the thief won't be able to try to use those same passwords in another system
//// tab | Python 3.8+
```Python hl_lines="83-86"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -321,7 +321,7 @@ But for now, let's focus on the specific details we need.
//// tab | Python 3.10+
```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -329,7 +329,7 @@ But for now, let's focus on the specific details we need.
//// tab | Python 3.9+
```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -337,7 +337,7 @@ But for now, let's focus on the specific details we need.
//// tab | Python 3.8+
```Python hl_lines="88"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -351,7 +351,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -365,7 +365,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -397,7 +397,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
//// tab | Python 3.10+
```Python hl_lines="58-66 69-74 94"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
```
////
@@ -405,7 +405,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
//// tab | Python 3.9+
```Python hl_lines="58-66 69-74 94"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
```
////
@@ -413,7 +413,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
//// tab | Python 3.8+
```Python hl_lines="59-67 70-75 95"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
```
////
@@ -427,7 +427,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="56-64 67-70 88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -441,7 +441,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="58-66 69-72 90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
diff --git a/docs/en/docs/tutorial/sql-databases.md b/docs/en/docs/tutorial/sql-databases.md
index 56971bf9d..972eb9308 100644
--- a/docs/en/docs/tutorial/sql-databases.md
+++ b/docs/en/docs/tutorial/sql-databases.md
@@ -1,22 +1,18 @@
# SQL (Relational) Databases
-/// info
+**FastAPI** doesn't require you to use a SQL (relational) database. But you can use **any database** that you want.
-These docs are about to be updated. 🎉
+Here we'll see an example using SQLModel.
-The current version assumes Pydantic v1, and SQLAlchemy versions less than 2.0.
+**SQLModel** is built on top of SQLAlchemy and Pydantic. It was made by the same author of **FastAPI** to be the perfect match for FastAPI applications that need to use **SQL databases**.
-The new docs will include Pydantic v2 and will use SQLModel (which is also based on SQLAlchemy) once it is updated to use Pydantic v2 as well.
-
-///
-
-**FastAPI** doesn't require you to use a SQL (relational) database.
+/// tip
-But you can use any relational database that you want.
+You could use any other SQL or NoSQL database library you want (in some cases called "ORMs"), FastAPI doesn't force you to use anything. 😎
-Here we'll see an example using SQLAlchemy.
+///
-You can easily adapt it to any database supported by SQLAlchemy, like:
+As SQLModel is based on SQLAlchemy, you can easily use **any database supported** by SQLAlchemy (which makes them also supported by SQLModel), like:
* PostgreSQL
* MySQL
@@ -30,891 +26,335 @@ Later, for your production application, you might want to use a database server
/// tip
-There is an official project generator with **FastAPI** and **PostgreSQL**, all based on **Docker**, including a frontend and more tools: https://github.com/tiangolo/full-stack-fastapi-postgresql
-
-///
-
-/// note
-
-Notice that most of the code is the standard `SQLAlchemy` code you would use with any framework.
-
-The **FastAPI** specific code is as small as always.
-
-///
-
-## ORMs
-
-**FastAPI** works with any database and any style of library to talk to the database.
-
-A common pattern is to use an "ORM": an "object-relational mapping" library.
-
-An ORM has tools to convert ("*map*") between *objects* in code and database tables ("*relations*").
-
-With an ORM, you normally create a class that represents a table in a SQL database, each attribute of the class represents a column, with a name and a type.
-
-For example a class `Pet` could represent a SQL table `pets`.
-
-And each *instance* object of that class represents a row in the database.
-
-For example an object `orion_cat` (an instance of `Pet`) could have an attribute `orion_cat.type`, for the column `type`. And the value of that attribute could be, e.g. `"cat"`.
-
-These ORMs also have tools to make the connections or relations between tables or entities.
-
-This way, you could also have an attribute `orion_cat.owner` and the owner would contain the data for this pet's owner, taken from the table *owners*.
-
-So, `orion_cat.owner.name` could be the name (from the `name` column in the `owners` table) of this pet's owner.
-
-It could have a value like `"Arquilian"`.
-
-And the ORM will do all the work to get the information from the corresponding table *owners* when you try to access it from your pet object.
-
-Common ORMs are for example: Django-ORM (part of the Django framework), SQLAlchemy ORM (part of SQLAlchemy, independent of framework) and Peewee (independent of framework), among others.
-
-Here we will see how to work with **SQLAlchemy ORM**.
-
-In a similar way you could use any other ORM.
-
-/// tip
-
-There's an equivalent article using Peewee here in the docs.
+There is an official project generator with **FastAPI** and **PostgreSQL** including a frontend and more tools: https://github.com/fastapi/full-stack-fastapi-template
///
-## File structure
-
-For these examples, let's say you have a directory named `my_super_project` that contains a sub-directory called `sql_app` with a structure like this:
-
-```
-.
-└── sql_app
- ├── __init__.py
- ├── crud.py
- ├── database.py
- ├── main.py
- ├── models.py
- └── schemas.py
-```
-
-The file `__init__.py` is just an empty file, but it tells Python that `sql_app` with all its modules (Python files) is a package.
-
-Now let's see what each file/module does.
-
-## Install `SQLAlchemy`
+This is a very simple and short tutorial, if you want to learn about databases in general, about SQL, or more advanced features, go to the SQLModel docs.
-First you need to install `SQLAlchemy`.
+## Install `SQLModel`
-Make sure you create a [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install it, for example:
+First, make sure you create your [virtual environment](../virtual-environments.md){.internal-link target=_blank}, activate it, and then install `sqlmodel`:
kwargs
. Même s'ils n'ont pas de valeur par défaut.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
# Avec `Annotated`
@@ -220,7 +220,7 @@ Gardez à l'esprit que si vous utilisez `Annotated`, comme vous n'utilisez pas l
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
```
////
@@ -228,7 +228,7 @@ Gardez à l'esprit que si vous utilisez `Annotated`, comme vous n'utilisez pas l
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
```
////
@@ -242,7 +242,7 @@ Ici, avec `ge=1`, `item_id` devra être un nombre entier "`g`reater than or `e`q
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
```
////
@@ -250,7 +250,7 @@ Ici, avec `ge=1`, `item_id` devra être un nombre entier "`g`reater than or `e`q
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
```
////
@@ -264,7 +264,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
////
@@ -279,7 +279,7 @@ La même chose s'applique pour :
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
```
////
@@ -287,7 +287,7 @@ La même chose s'applique pour :
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
```
////
@@ -301,7 +301,7 @@ Préférez utiliser la version `Annotated` si possible.
///
```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
////
@@ -316,7 +316,7 @@ La même chose s'applique pour :
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
```
////
@@ -324,7 +324,7 @@ La même chose s'applique pour :
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
```
////
@@ -338,7 +338,7 @@ Préférez utiliser la version `Annotated` si possible.
///
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
////
@@ -356,7 +356,7 @@ Et la même chose pour lt
.
//// tab | Python 3.9+
```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
```
////
@@ -364,7 +364,7 @@ Et la même chose pour lt
.
//// tab | Python 3.8+
```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
```
////
@@ -378,7 +378,7 @@ Préférez utiliser la version `Annotated` si possible.
///
```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
////
diff --git a/docs/fr/docs/tutorial/path-params.md b/docs/fr/docs/tutorial/path-params.md
index 94c36a20d..34012c278 100644
--- a/docs/fr/docs/tutorial/path-params.md
+++ b/docs/fr/docs/tutorial/path-params.md
@@ -5,7 +5,7 @@ Vous pouvez déclarer des "paramètres" ou "variables" de chemin avec la même s
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
La valeur du paramètre `item_id` sera transmise à la fonction dans l'argument `item_id`.
@@ -23,7 +23,7 @@ Vous pouvez déclarer le type d'un paramètre de chemin dans la fonction, en uti
```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
```
Ici, `item_id` est déclaré comme `int`.
@@ -132,7 +132,7 @@ Et vous avez un second chemin : `/users/{user_id}` pour récupérer de la donné
Les *fonctions de chemin* étant évaluées dans l'ordre, il faut s'assurer que la fonction correspondant à `/users/me` est déclarée avant celle de `/users/{user_id}` :
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
```
Sinon, le chemin `/users/{user_id}` correspondrait aussi à `/users/me`, la fonction "croyant" qu'elle a reçu un paramètre `user_id` avec pour valeur `"me"`.
@@ -150,7 +150,7 @@ En héritant de `str` la documentation sera capable de savoir que les valeurs do
Créez ensuite des attributs de classe avec des valeurs fixes, qui seront les valeurs autorisées pour cette énumération.
```Python hl_lines="1 6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// info
@@ -170,7 +170,7 @@ Pour ceux qui se demandent, "AlexNet", "ResNet", et "LeNet" sont juste des noms
Créez ensuite un *paramètre de chemin* avec une annotation de type désignant l'énumération créée précédemment (`ModelName`) :
```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
### Documentation
@@ -188,7 +188,7 @@ La valeur du *paramètre de chemin* sera un des "membres" de l'énumération.
Vous pouvez comparer ce paramètre avec les membres de votre énumération `ModelName` :
```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
#### Récupérer la *valeur de l'énumération*
@@ -196,7 +196,7 @@ Vous pouvez comparer ce paramètre avec les membres de votre énumération `Mode
Vous pouvez obtenir la valeur réel d'un membre (une chaîne de caractères ici), avec `model_name.value`, ou en général, `votre_membre_d'enum.value` :
```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// tip | "Astuce"
@@ -212,7 +212,7 @@ Vous pouvez retourner des *membres d'énumération* dans vos *fonctions de chemi
Ils seront convertis vers leurs valeurs correspondantes (chaînes de caractères ici) avant d'être transmis au client :
```Python hl_lines="18 21 23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
Le client recevra une réponse JSON comme celle-ci :
@@ -253,7 +253,7 @@ Dans ce cas, le nom du paramètre est `file_path`, et la dernière partie, `:pat
Vous pouvez donc l'utilisez comme tel :
```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
```
/// tip | "Astuce"
diff --git a/docs/fr/docs/tutorial/query-params-str-validations.md b/docs/fr/docs/tutorial/query-params-str-validations.md
index 63578ec40..b71d1548a 100644
--- a/docs/fr/docs/tutorial/query-params-str-validations.md
+++ b/docs/fr/docs/tutorial/query-params-str-validations.md
@@ -5,7 +5,7 @@
Commençons avec cette application pour exemple :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
```
Le paramètre de requête `q` a pour type `Union[str, None]` (ou `str | None` en Python 3.10), signifiant qu'il est de type `str` mais pourrait aussi être égal à `None`, et bien sûr, la valeur par défaut est `None`, donc **FastAPI** saura qu'il n'est pas requis.
@@ -27,7 +27,7 @@ Nous allons imposer que bien que `q` soit un paramètre optionnel, dès qu'il es
Pour cela, importez d'abord `Query` depuis `fastapi` :
```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
## Utiliser `Query` comme valeur par défaut
@@ -35,7 +35,7 @@ Pour cela, importez d'abord `Query` depuis `fastapi` :
Construisez ensuite la valeur par défaut de votre paramètre avec `Query`, en choisissant 50 comme `max_length` :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
Comme nous devons remplacer la valeur par défaut `None` dans la fonction par `Query()`, nous pouvons maintenant définir la valeur par défaut avec le paramètre `Query(default=None)`, il sert le même objectif qui est de définir cette valeur par défaut.
@@ -87,7 +87,7 @@ Cela va valider les données, montrer une erreur claire si ces dernières ne son
Vous pouvez aussi rajouter un second paramètre `min_length` :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
```
## Ajouter des validations par expressions régulières
@@ -95,7 +95,7 @@ Vous pouvez aussi rajouter un second paramètre `min_length` :
On peut définir une expression régulière à laquelle le paramètre doit correspondre :
```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
```
Cette expression régulière vérifie que la valeur passée comme paramètre :
@@ -115,7 +115,7 @@ De la même façon que vous pouvez passer `None` comme premier argument pour l'u
Disons que vous déclarez le paramètre `q` comme ayant une longueur minimale de `3`, et une valeur par défaut étant `"fixedquery"` :
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
```
/// note | "Rappel"
@@ -147,7 +147,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
Donc pour déclarer une valeur comme requise tout en utilisant `Query`, il faut utiliser `...` comme premier argument :
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// info
@@ -165,7 +165,7 @@ Quand on définit un paramètre de requête explicitement avec `Query` on peut a
Par exemple, pour déclarer un paramètre de requête `q` qui peut apparaître plusieurs fois dans une URL, on écrit :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
```
Ce qui fait qu'avec une URL comme :
@@ -202,7 +202,7 @@ La documentation sera donc mise à jour automatiquement pour autoriser plusieurs
Et l'on peut aussi définir une liste de valeurs par défaut si aucune n'est fournie :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
```
Si vous allez à :
@@ -229,7 +229,7 @@ et la réponse sera :
Il est aussi possible d'utiliser directement `list` plutôt que `List[str]` :
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
```
/// note
@@ -257,13 +257,13 @@ Il se peut donc que certains d'entre eux n'utilisent pas toutes les métadonnée
Vous pouvez ajouter un `title` :
```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
```
Et une `description` :
```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
```
## Alias de paramètres
@@ -285,7 +285,7 @@ Mais vous avez vraiment envie que ce soit exactement `item-query`...
Pour cela vous pouvez déclarer un `alias`, et cet alias est ce qui sera utilisé pour trouver la valeur du paramètre :
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
```
## Déprécier des paramètres
@@ -297,7 +297,7 @@ Il faut qu'il continue à exister pendant un certain temps car vos clients l'uti
On utilise alors l'argument `deprecated=True` de `Query` :
```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
```
La documentation le présentera comme il suit :
diff --git a/docs/fr/docs/tutorial/query-params.md b/docs/fr/docs/tutorial/query-params.md
index b9f1540c9..c847a8f5b 100644
--- a/docs/fr/docs/tutorial/query-params.md
+++ b/docs/fr/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
Quand vous déclarez des paramètres dans votre fonction de chemin qui ne font pas partie des paramètres indiqués dans le chemin associé, ces paramètres sont automatiquement considérés comme des paramètres de "requête".
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
La partie appelée requête (ou **query**) dans une URL est l'ensemble des paires clés-valeurs placées après le `?` , séparées par des `&`.
@@ -64,7 +64,7 @@ Les valeurs des paramètres de votre fonction seront :
De la même façon, vous pouvez définir des paramètres de requête comme optionnels, en leur donnant comme valeur par défaut `None` :
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
```
Ici, le paramètre `q` sera optionnel, et aura `None` comme valeur par défaut.
@@ -88,7 +88,7 @@ Le `Optional` dans `Optional[str]` n'est pas utilisé par **FastAPI** (**FastAPI
Vous pouvez aussi déclarer des paramètres de requête comme booléens (`bool`), **FastAPI** les convertira :
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
```
Avec ce code, en allant sur :
@@ -132,7 +132,7 @@ Et vous n'avez pas besoin de les déclarer dans un ordre spécifique.
Ils seront détectés par leurs noms :
```Python hl_lines="8 10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
```
## Paramètres de requête requis
@@ -144,7 +144,7 @@ Si vous ne voulez pas leur donner de valeur par défaut mais juste les rendre op
Mais si vous voulez rendre un paramètre de requête obligatoire, vous pouvez juste ne pas y affecter de valeur par défaut :
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
Ici le paramètre `needy` est un paramètre requis (ou obligatoire) de type `str`.
@@ -190,7 +190,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
Et bien sur, vous pouvez définir certains paramètres comme requis, certains avec des valeurs par défaut et certains entièrement optionnels :
```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
```
Ici, on a donc 3 paramètres de requête :
diff --git a/docs/he/docs/index.md b/docs/he/docs/index.md
index 23a2eb824..6498d15e1 100644
--- a/docs/he/docs/index.md
+++ b/docs/he/docs/index.md
@@ -94,7 +94,7 @@ FastAPI היא תשתית רשת מודרנית ומהירה (ביצועים ג
"_Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted **Hug** to be - it's really inspiring to see someone build that._"
-
+
---
diff --git a/docs/hu/docs/index.md b/docs/hu/docs/index.md
index 8e326a78b..c6f596650 100644
--- a/docs/hu/docs/index.md
+++ b/docs/hu/docs/index.md
@@ -87,7 +87,7 @@ Kulcs funkciók:
"_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._"
-
+
---
diff --git a/docs/it/docs/index.md b/docs/it/docs/index.md
index 57940f0ed..8a1039bc5 100644
--- a/docs/it/docs/index.md
+++ b/docs/it/docs/index.md
@@ -1,6 +1,3 @@
-{!../../../docs/missing-translation.md!}
-
-
@@ -87,7 +84,7 @@ Le sue caratteristiche principali sono:
"_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._"
-
+
---
diff --git a/docs/ja/docs/advanced/additional-status-codes.md b/docs/ja/docs/advanced/additional-status-codes.md
index 622affa6e..904d539e7 100644
--- a/docs/ja/docs/advanced/additional-status-codes.md
+++ b/docs/ja/docs/advanced/additional-status-codes.md
@@ -15,7 +15,7 @@
これを達成するには、 `JSONResponse` をインポートし、 `status_code` を設定して直接内容を返します。
```Python hl_lines="4 25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
```
/// warning | "注意"
diff --git a/docs/ja/docs/advanced/custom-response.md b/docs/ja/docs/advanced/custom-response.md
index a7ce6b54d..88269700e 100644
--- a/docs/ja/docs/advanced/custom-response.md
+++ b/docs/ja/docs/advanced/custom-response.md
@@ -25,7 +25,7 @@
使いたい `Response` クラス (サブクラス) をインポートし、 *path operationデコレータ* に宣言します。
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
```
/// info | "情報"
@@ -52,7 +52,7 @@
* *path operation* のパラメータ `content_type` に `HTMLResponse` を渡す。
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
```
/// info | "情報"
@@ -72,7 +72,7 @@
上記と同じ例において、 `HTMLResponse` を返すと、このようになります:
```Python hl_lines="2 7 19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
```
/// warning | "注意"
@@ -98,7 +98,7 @@
例えば、このようになります:
```Python hl_lines="7 21 23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
```
この例では、関数 `generate_html_response()` は、`str` のHTMLを返すのではなく `Response` を生成して返しています。
@@ -139,7 +139,7 @@
FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含みます。また、media_typeに基づいたContent-Typeヘッダーを含み、テキストタイプのためにcharsetを追加します。
```Python hl_lines="1 18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
```
### `HTMLResponse`
@@ -151,7 +151,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
テキストやバイトを受け取り、プレーンテキストのレスポンスを返します。
```Python hl_lines="2 7 9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
```
### `JSONResponse`
@@ -175,7 +175,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
///
```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
```
/// tip | "豆知識"
@@ -189,7 +189,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
HTTPリダイレクトを返します。デフォルトでは307ステータスコード (Temporary Redirect) となります。
```Python hl_lines="2 9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
```
### `StreamingResponse`
@@ -197,7 +197,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
非同期なジェネレータか通常のジェネレータ・イテレータを受け取り、レスポンスボディをストリームします。
```Python hl_lines="2 14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
```
#### `StreamingResponse` をファイルライクなオブジェクトとともに使う
@@ -207,7 +207,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
これにはクラウドストレージとの連携や映像処理など、多くのライブラリが含まれています。
```Python hl_lines="2 10-12 14"
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
```
/// tip | "豆知識"
@@ -230,7 +230,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
ファイルレスポンスには、適切な `Content-Length` 、 `Last-Modified` 、 `ETag` ヘッダーが含まれます。
```Python hl_lines="2 10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
```
## デフォルトレスポンスクラス
@@ -242,7 +242,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
以下の例では、 **FastAPI** は、全ての *path operation* で `JSONResponse` の代わりに `ORJSONResponse` をデフォルトとして利用します。
```Python hl_lines="2 4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
```
/// tip | "豆知識"
diff --git a/docs/ja/docs/advanced/path-operation-advanced-configuration.md b/docs/ja/docs/advanced/path-operation-advanced-configuration.md
index ae60126cb..2dab4aec1 100644
--- a/docs/ja/docs/advanced/path-operation-advanced-configuration.md
+++ b/docs/ja/docs/advanced/path-operation-advanced-configuration.md
@@ -13,7 +13,7 @@
`operation_id` は各オペレーションで一意にする必要があります。
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
```
### *path operation関数* の名前をoperationIdとして使用する
@@ -23,7 +23,7 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
そうする場合は、すべての *path operation* を追加した後に行う必要があります。
```Python hl_lines="2 12-21 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
```
/// tip | "豆知識"
@@ -45,7 +45,7 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
生成されるOpenAPIスキーマ (つまり、自動ドキュメント生成の仕組み) から *path operation* を除外するには、 `include_in_schema` パラメータを `False` にします。
```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
```
## docstringによる説明の高度な設定
@@ -57,5 +57,5 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
ドキュメントには表示されませんが、他のツール (例えばSphinx) では残りの部分を利用できるでしょう。
```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
```
diff --git a/docs/ja/docs/advanced/response-directly.md b/docs/ja/docs/advanced/response-directly.md
index 5c25471b1..167d15589 100644
--- a/docs/ja/docs/advanced/response-directly.md
+++ b/docs/ja/docs/advanced/response-directly.md
@@ -35,7 +35,7 @@
このようなケースでは、レスポンスにデータを含める前に `jsonable_encoder` を使ってデータを変換できます。
```Python hl_lines="6-7 21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
```
/// note | "技術詳細"
@@ -57,7 +57,7 @@
XMLを文字列にし、`Response` に含め、それを返します。
```Python hl_lines="1 18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
```
## 備考
diff --git a/docs/ja/docs/advanced/websockets.md b/docs/ja/docs/advanced/websockets.md
index 615f9d17c..f7bcb6af3 100644
--- a/docs/ja/docs/advanced/websockets.md
+++ b/docs/ja/docs/advanced/websockets.md
@@ -39,7 +39,7 @@ $ pip install websockets
しかし、これはWebSocketのサーバーサイドに焦点を当て、実用的な例を示す最も簡単な方法です。
```Python hl_lines="2 6-38 41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
## `websocket` を作成する
@@ -47,7 +47,7 @@ $ pip install websockets
**FastAPI** アプリケーションで、`websocket` を作成します。
```Python hl_lines="1 46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
/// note | "技術詳細"
@@ -63,7 +63,7 @@ $ pip install websockets
WebSocketルートでは、 `await` を使ってメッセージの送受信ができます。
```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
```
バイナリやテキストデータ、JSONデータを送受信できます。
@@ -116,7 +116,7 @@ WebSocketエンドポイントでは、`fastapi` から以下をインポート
これらは、他のFastAPI エンドポイント/*path operation* の場合と同じように機能します。
```Python hl_lines="58-65 68-83"
-{!../../../docs_src/websockets/tutorial002.py!}
+{!../../docs_src/websockets/tutorial002.py!}
```
/// info | "情報"
@@ -165,7 +165,7 @@ $ uvicorn main:app --reload
WebSocket接続が閉じられると、 `await websocket.receive_text()` は例外 `WebSocketDisconnect` を発生させ、この例のようにキャッチして処理することができます。
```Python hl_lines="81-83"
-{!../../../docs_src/websockets/tutorial003.py!}
+{!../../docs_src/websockets/tutorial003.py!}
```
試してみるには、
diff --git a/docs/ja/docs/how-to/conditional-openapi.md b/docs/ja/docs/how-to/conditional-openapi.md
index b892ed6c6..053d481f7 100644
--- a/docs/ja/docs/how-to/conditional-openapi.md
+++ b/docs/ja/docs/how-to/conditional-openapi.md
@@ -30,7 +30,7 @@
例えば、
```Python hl_lines="6 11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
```
ここでは `openapi_url` の設定を、デフォルトの `"/openapi.json"` のまま宣言しています。
diff --git a/docs/ja/docs/index.md b/docs/ja/docs/index.md
index 72a0e98bc..682c94e83 100644
--- a/docs/ja/docs/index.md
+++ b/docs/ja/docs/index.md
@@ -91,7 +91,7 @@ FastAPI は、Pythonの標準である型ヒントに基づいてPython 以降
"_正直、超堅実で洗練されているように見えます。いろんな意味で、それは私がハグしたかったものです。_"
-
+
---
diff --git a/docs/ja/docs/python-types.md b/docs/ja/docs/python-types.md
index 730a209ab..7af6ce0c0 100644
--- a/docs/ja/docs/python-types.md
+++ b/docs/ja/docs/python-types.md
@@ -23,7 +23,7 @@
簡単な例から始めてみましょう:
```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
このプログラムを実行すると以下が出力されます:
@@ -39,7 +39,7 @@ John Doe
* 真ん中にスペースを入れて連結します。
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### 編集
@@ -83,7 +83,7 @@ John Doe
それが「型ヒント」です:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
これは、以下のようにデフォルト値を宣言するのと同じではありません:
@@ -113,7 +113,7 @@ John Doe
この関数を見てください。すでに型ヒントを持っています:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
エディタは変数の型を知っているので、補完だけでなく、エラーチェックをすることもできます。
@@ -123,7 +123,7 @@ John Doe
これで`age`を`str(age)`で文字列に変換して修正する必要があることがわかります:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## 型の宣言
@@ -144,7 +144,7 @@ John Doe
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### 型パラメータを持つジェネリック型
@@ -162,7 +162,7 @@ John Doe
`typing`から`List`をインポートします(大文字の`L`を含む):
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
同じようにコロン(`:`)の構文で変数を宣言します。
@@ -172,7 +172,7 @@ John Doe
リストはいくつかの内部の型を含む型なので、それらを角括弧で囲んでいます。
```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
/// tip | "豆知識"
@@ -200,7 +200,7 @@ John Doe
`tuple`と`set`の宣言も同様です:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
```
つまり:
@@ -218,7 +218,7 @@ John Doe
2番目の型パラメータは`dict`の値です。
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
```
つまり:
@@ -232,7 +232,7 @@ John Doe
また、`Optional`を使用して、変数が`str`のような型を持つことを宣言することもできますが、それは「オプション」であり、`None`にすることもできます。
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
ただの`str`の代わりに`Optional[str]`を使用することで、エディタは値が常に`str`であると仮定している場合に実際には`None`である可能性があるエラーを検出するのに役立ちます。
@@ -257,13 +257,13 @@ John Doe
例えば、`Person`クラスという名前のクラスがあるとしましょう:
```Python hl_lines="1 2 3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
変数の型を`Person`として宣言することができます:
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
そして、再び、すべてのエディタのサポートを得ることができます:
@@ -285,7 +285,7 @@ John Doe
Pydanticの公式ドキュメントから引用:
```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
```
/// info | "情報"
diff --git a/docs/ja/docs/tutorial/background-tasks.md b/docs/ja/docs/tutorial/background-tasks.md
index 6094c370f..6f9340817 100644
--- a/docs/ja/docs/tutorial/background-tasks.md
+++ b/docs/ja/docs/tutorial/background-tasks.md
@@ -16,7 +16,7 @@
まず初めに、`BackgroundTasks` をインポートし、` BackgroundTasks` の型宣言と共に、*path operation 関数* のパラメーターを定義します:
```Python hl_lines="1 13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
**FastAPI** は、`BackgroundTasks` 型のオブジェクトを作成し、そのパラメーターに渡します。
@@ -34,7 +34,7 @@
また、書き込み操作では `async` と `await` を使用しないため、通常の `def` で関数を定義します。
```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
## バックグラウンドタスクの追加
@@ -42,7 +42,7 @@
*path operations 関数* 内で、`.add_task()` メソッドを使用してタスク関数を *background tasks* オブジェクトに渡します。
```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
`.add_task()` は以下の引数を受け取ります:
@@ -58,7 +58,7 @@
**FastAPI** は、それぞれの場合の処理方法と同じオブジェクトの再利用方法を知っているため、すべてのバックグラウンドタスクがマージされ、バックグラウンドで後で実行されます。
```Python hl_lines="13 15 22 25"
-{!../../../docs_src/background_tasks/tutorial002.py!}
+{!../../docs_src/background_tasks/tutorial002.py!}
```
この例では、レスポンスが送信された *後* にメッセージが `log.txt` ファイルに書き込まれます。
diff --git a/docs/ja/docs/tutorial/body-fields.md b/docs/ja/docs/tutorial/body-fields.md
index b9f6d694b..1d386040a 100644
--- a/docs/ja/docs/tutorial/body-fields.md
+++ b/docs/ja/docs/tutorial/body-fields.md
@@ -7,7 +7,7 @@
まず、以下のようにインポートします:
```Python hl_lines="4"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
```
/// warning | "注意"
@@ -21,7 +21,7 @@
以下のように`Field`をモデルの属性として使用することができます:
```Python hl_lines="11 12 13 14"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
```
`Field`は`Query`や`Path`、`Body`と同じように動作し、全く同様のパラメータなどを持ちます。
diff --git a/docs/ja/docs/tutorial/body-multiple-params.md b/docs/ja/docs/tutorial/body-multiple-params.md
index c051fde24..647143ee5 100644
--- a/docs/ja/docs/tutorial/body-multiple-params.md
+++ b/docs/ja/docs/tutorial/body-multiple-params.md
@@ -9,7 +9,7 @@
また、デフォルトの`None`を設定することで、ボディパラメータをオプションとして宣言することもできます:
```Python hl_lines="19 20 21"
-{!../../../docs_src/body_multiple_params/tutorial001.py!}
+{!../../docs_src/body_multiple_params/tutorial001.py!}
```
/// note | "備考"
@@ -34,7 +34,7 @@
しかし、`item`と`user`のように複数のボディパラメータを宣言することもできます:
```Python hl_lines="22"
-{!../../../docs_src/body_multiple_params/tutorial002.py!}
+{!../../docs_src/body_multiple_params/tutorial002.py!}
```
この場合、**FastAPI**は関数内に複数のボディパラメータ(Pydanticモデルである2つのパラメータ)があることに気付きます。
@@ -78,7 +78,7 @@
```Python hl_lines="23"
-{!../../../docs_src/body_multiple_params/tutorial003.py!}
+{!../../docs_src/body_multiple_params/tutorial003.py!}
```
この場合、**FastAPI** は以下のようなボディを期待します:
@@ -115,7 +115,7 @@ q: str = None
以下において:
```Python hl_lines="27"
-{!../../../docs_src/body_multiple_params/tutorial004.py!}
+{!../../docs_src/body_multiple_params/tutorial004.py!}
```
/// info | "情報"
@@ -139,7 +139,7 @@ item: Item = Body(..., embed=True)
以下において:
```Python hl_lines="17"
-{!../../../docs_src/body_multiple_params/tutorial005.py!}
+{!../../docs_src/body_multiple_params/tutorial005.py!}
```
この場合、**FastAPI** は以下のようなボディを期待します:
diff --git a/docs/ja/docs/tutorial/body-nested-models.md b/docs/ja/docs/tutorial/body-nested-models.md
index 59ee67295..8703a40e7 100644
--- a/docs/ja/docs/tutorial/body-nested-models.md
+++ b/docs/ja/docs/tutorial/body-nested-models.md
@@ -7,7 +7,7 @@
属性をサブタイプとして定義することができます。例えば、Pythonの`list`は以下のように定義できます:
```Python hl_lines="12"
-{!../../../docs_src/body_nested_models/tutorial001.py!}
+{!../../docs_src/body_nested_models/tutorial001.py!}
```
これにより、各項目の型は宣言されていませんが、`tags`はある項目のリストになります。
@@ -21,7 +21,7 @@
まず、Pythonの標準の`typing`モジュールから`List`をインポートします:
```Python hl_lines="1"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
```
### タイプパラメータを持つ`List`の宣言
@@ -44,7 +44,7 @@ my_list: List[str]
そのため、以下の例では`tags`を具体的な「文字列のリスト」にすることができます:
```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
```
## セット型
@@ -56,7 +56,7 @@ my_list: List[str]
そのため、以下のように、`Set`をインポートして`str`の`set`として`tags`を宣言することができます:
```Python hl_lines="1 14"
-{!../../../docs_src/body_nested_models/tutorial003.py!}
+{!../../docs_src/body_nested_models/tutorial003.py!}
```
これを使えば、データが重複しているリクエストを受けた場合でも、ユニークな項目のセットに変換されます。
@@ -80,7 +80,7 @@ Pydanticモデルの各属性には型があります。
例えば、`Image`モデルを定義することができます:
```Python hl_lines="9 10 11"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
```
### サブモデルを型として使用
@@ -88,7 +88,7 @@ Pydanticモデルの各属性には型があります。
そして、それを属性の型として使用することができます:
```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
```
これは **FastAPI** が以下のようなボディを期待することを意味します:
@@ -123,7 +123,7 @@ Pydanticモデルの各属性には型があります。
例えば、`Image`モデルのように`url`フィールドがある場合、`str`の代わりにPydanticの`HttpUrl`を指定することができます:
```Python hl_lines="4 10"
-{!../../../docs_src/body_nested_models/tutorial005.py!}
+{!../../docs_src/body_nested_models/tutorial005.py!}
```
文字列は有効なURLであることが確認され、そのようにJSONスキーマ・OpenAPIで文書化されます。
@@ -133,7 +133,7 @@ Pydanticモデルの各属性には型があります。
Pydanticモデルを`list`や`set`などのサブタイプとして使用することもできます:
```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial006.py!}
+{!../../docs_src/body_nested_models/tutorial006.py!}
```
これは、次のようなJSONボディを期待します(変換、検証、ドキュメントなど):
@@ -173,7 +173,7 @@ Pydanticモデルを`list`や`set`などのサブタイプとして使用する
深くネストされた任意のモデルを定義することができます:
```Python hl_lines="9 14 20 23 27"
-{!../../../docs_src/body_nested_models/tutorial007.py!}
+{!../../docs_src/body_nested_models/tutorial007.py!}
```
/// info | "情報"
@@ -193,7 +193,7 @@ images: List[Image]
以下のように:
```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial008.py!}
+{!../../docs_src/body_nested_models/tutorial008.py!}
```
## あらゆる場所でのエディタサポート
@@ -225,7 +225,7 @@ Pydanticモデルではなく、`dict`を直接使用している場合はこの
この場合、`int`のキーと`float`の値を持つものであれば、どんな`dict`でも受け入れることができます:
```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial009.py!}
+{!../../docs_src/body_nested_models/tutorial009.py!}
```
/// tip | "豆知識"
diff --git a/docs/ja/docs/tutorial/body-updates.md b/docs/ja/docs/tutorial/body-updates.md
index 672a03a64..fde9f4f5e 100644
--- a/docs/ja/docs/tutorial/body-updates.md
+++ b/docs/ja/docs/tutorial/body-updates.md
@@ -7,7 +7,7 @@
`jsonable_encoder`を用いて、入力データをJSON形式で保存できるデータに変換することができます(例:NoSQLデータベース)。例えば、`datetime`を`str`に変換します。
```Python hl_lines="30 31 32 33 34 35"
-{!../../../docs_src/body_updates/tutorial001.py!}
+{!../../docs_src/body_updates/tutorial001.py!}
```
既存のデータを置き換えるべきデータを受け取るために`PUT`は使用されます。
@@ -57,7 +57,7 @@
これを使うことで、デフォルト値を省略して、設定された(リクエストで送られた)データのみを含む`dict`を生成することができます:
```Python hl_lines="34"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
```
### Pydanticの`update`パラメータ
@@ -67,7 +67,7 @@
`stored_item_model.copy(update=update_data)`のように:
```Python hl_lines="35"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
```
### 部分的更新のまとめ
@@ -86,7 +86,7 @@
* 更新されたモデルを返します。
```Python hl_lines="30 31 32 33 34 35 36 37"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
```
/// tip | "豆知識"
diff --git a/docs/ja/docs/tutorial/body.md b/docs/ja/docs/tutorial/body.md
index 017ff8986..888d4388a 100644
--- a/docs/ja/docs/tutorial/body.md
+++ b/docs/ja/docs/tutorial/body.md
@@ -23,7 +23,7 @@ GET リクエストでボディを送信することは、仕様では未定義
ます初めに、 `pydantic` から `BaseModel` をインポートする必要があります:
```Python hl_lines="2"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
```
## データモデルの作成
@@ -33,7 +33,7 @@ GET リクエストでボディを送信することは、仕様では未定義
すべての属性にpython標準の型を使用します:
```Python hl_lines="5-9"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
```
クエリパラメータの宣言と同様に、モデル属性がデフォルト値をもつとき、必須な属性ではなくなります。それ以外は必須になります。オプショナルな属性にしたい場合は `None` を使用してください。
@@ -63,7 +63,7 @@ GET リクエストでボディを送信することは、仕様では未定義
*パスオペレーション* に加えるために、パスパラメータやクエリパラメータと同じ様に宣言します:
```Python hl_lines="16"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
```
...そして、作成したモデル `Item` で型を宣言します。
@@ -132,7 +132,7 @@ GET リクエストでボディを送信することは、仕様では未定義
関数内部で、モデルの全ての属性に直接アクセスできます:
```Python hl_lines="19"
-{!../../../docs_src/body/tutorial002.py!}
+{!../../docs_src/body/tutorial002.py!}
```
## リクエストボディ + パスパラメータ
@@ -142,7 +142,7 @@ GET リクエストでボディを送信することは、仕様では未定義
**FastAPI** はパスパラメータである関数パラメータは**パスから受け取り**、Pydanticモデルによって宣言された関数パラメータは**リクエストボディから受け取る**ということを認識します。
```Python hl_lines="15-16"
-{!../../../docs_src/body/tutorial003.py!}
+{!../../docs_src/body/tutorial003.py!}
```
## リクエストボディ + パスパラメータ + クエリパラメータ
@@ -152,7 +152,7 @@ GET リクエストでボディを送信することは、仕様では未定義
**FastAPI** はそれぞれを認識し、適切な場所からデータを取得します。
```Python hl_lines="16"
-{!../../../docs_src/body/tutorial004.py!}
+{!../../docs_src/body/tutorial004.py!}
```
関数パラメータは以下の様に認識されます:
diff --git a/docs/ja/docs/tutorial/cookie-params.md b/docs/ja/docs/tutorial/cookie-params.md
index 212885209..1f45db17c 100644
--- a/docs/ja/docs/tutorial/cookie-params.md
+++ b/docs/ja/docs/tutorial/cookie-params.md
@@ -7,7 +7,7 @@
まず、`Cookie`をインポートします:
```Python hl_lines="3"
-{!../../../docs_src/cookie_params/tutorial001.py!}
+{!../../docs_src/cookie_params/tutorial001.py!}
```
## `Cookie`のパラメータを宣言
@@ -17,7 +17,7 @@
最初の値がデフォルト値で、追加の検証パラメータや注釈パラメータをすべて渡すことができます:
```Python hl_lines="9"
-{!../../../docs_src/cookie_params/tutorial001.py!}
+{!../../docs_src/cookie_params/tutorial001.py!}
```
/// note | "技術詳細"
diff --git a/docs/ja/docs/tutorial/cors.md b/docs/ja/docs/tutorial/cors.md
index 738240342..9530c51bf 100644
--- a/docs/ja/docs/tutorial/cors.md
+++ b/docs/ja/docs/tutorial/cors.md
@@ -47,7 +47,7 @@
* 特定のHTTPヘッダー、またはワイルドカード `"*"`を使用してすべて許可。
```Python hl_lines="2 6-11 13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
```
`CORSMiddleware` 実装のデフォルトのパラメータはCORSに関して制限を与えるものになっているので、ブラウザにドメインを跨いで特定のオリジン、メソッド、またはヘッダーを使用可能にするためには、それらを明示的に有効にする必要があります
diff --git a/docs/ja/docs/tutorial/debugging.md b/docs/ja/docs/tutorial/debugging.md
index 06b8ad277..be0ff81d4 100644
--- a/docs/ja/docs/tutorial/debugging.md
+++ b/docs/ja/docs/tutorial/debugging.md
@@ -7,7 +7,7 @@ Visual Studio CodeやPyCharmなどを使用して、エディター上でデバ
FastAPIアプリケーション上で、`uvicorn` を直接インポートして実行します:
```Python hl_lines="1 15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
```
### `__name__ == "__main__"` について
diff --git a/docs/ja/docs/tutorial/dependencies/classes-as-dependencies.md b/docs/ja/docs/tutorial/dependencies/classes-as-dependencies.md
index 69b67d042..fb23a7b2b 100644
--- a/docs/ja/docs/tutorial/dependencies/classes-as-dependencies.md
+++ b/docs/ja/docs/tutorial/dependencies/classes-as-dependencies.md
@@ -7,7 +7,7 @@
前の例では、依存関係("dependable")から`dict`を返していました:
```Python hl_lines="9"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
```
しかし、*path operation関数*のパラメータ`commons`に`dict`が含まれています。
@@ -72,19 +72,19 @@ FastAPIが実際にチェックしているのは、それが「呼び出し可
そこで、上で紹介した依存関係の`common_parameters`を`CommonQueryParams`クラスに変更します:
```Python hl_lines="11 12 13 14 15"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
```
クラスのインスタンスを作成するために使用される`__init__`メソッドに注目してください:
```Python hl_lines="12"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
```
...以前の`common_parameters`と同じパラメータを持っています:
```Python hl_lines="8"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
```
これらのパラメータは **FastAPI** が依存関係を「解決」するために使用するものです。
@@ -102,7 +102,7 @@ FastAPIが実際にチェックしているのは、それが「呼び出し可
これで、このクラスを使用して依存関係を宣言することができます。
```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
```
**FastAPI** は`CommonQueryParams`クラスを呼び出します。これにより、そのクラスの「インスタンス」が作成され、インスタンスはパラメータ`commons`として関数に渡されます。
@@ -144,7 +144,7 @@ commons = Depends(CommonQueryParams)
以下にあるように:
```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial003.py!}
+{!../../docs_src/dependencies/tutorial003.py!}
```
しかし、型を宣言することは推奨されています。そうすれば、エディタは`commons`のパラメータとして何が渡されるかを知ることができ、コードの補完や型チェックなどを行うのに役立ちます:
@@ -180,7 +180,7 @@ commons: CommonQueryParams = Depends()
同じ例では以下のようになります:
```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial004.py!}
+{!../../docs_src/dependencies/tutorial004.py!}
```
...そして **FastAPI** は何をすべきか知っています。
diff --git a/docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md b/docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
index c6472cab5..59f21c3df 100644
--- a/docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
+++ b/docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
@@ -15,7 +15,7 @@
それは`Depends()`の`list`であるべきです:
```Python hl_lines="17"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
```
これらの依存関係は、通常の依存関係と同様に実行・解決されます。しかし、それらの値(何かを返す場合)は*path operation関数*には渡されません。
@@ -39,7 +39,7 @@
これらはリクエストの要件(ヘッダのようなもの)やその他のサブ依存関係を宣言することができます:
```Python hl_lines="6 11"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
```
### 例外の発生
@@ -47,7 +47,7 @@
これらの依存関係は通常の依存関係と同じように、例外を`raise`発生させることができます:
```Python hl_lines="8 13"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
```
### 戻り値
@@ -57,7 +57,7 @@
つまり、すでにどこかで使っている通常の依存関係(値を返すもの)を再利用することができ、値は使われなくても依存関係は実行されます:
```Python hl_lines="9 14"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
```
## *path operations*のグループに対する依存関係
diff --git a/docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md b/docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
index 3f22a7a7b..7ef1caf0d 100644
--- a/docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
+++ b/docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
@@ -42,19 +42,19 @@ pip install async-exit-stack async-generator
レスポンスを送信する前に`yield`文を含む前のコードのみが実行されます。
```Python hl_lines="2 3 4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
```
生成された値は、*path operations*や他の依存関係に注入されるものです:
```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
```
`yield`文に続くコードは、レスポンスが送信された後に実行されます:
```Python hl_lines="5 6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
```
/// tip | "豆知識"
@@ -76,7 +76,7 @@ pip install async-exit-stack async-generator
同様に、`finally`を用いて例外があったかどうかにかかわらず、終了ステップを確実に実行することができます。
```Python hl_lines="3 5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
```
## `yield`を持つサブ依存関係
@@ -88,7 +88,7 @@ pip install async-exit-stack async-generator
例えば、`dependency_c`は`dependency_b`と`dependency_b`に依存する`dependency_a`に、依存することができます:
```Python hl_lines="4 12 20"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
```
そして、それらはすべて`yield`を使用することができます。
@@ -98,7 +98,7 @@ pip install async-exit-stack async-generator
そして、`dependency_b`は`dependency_a`(ここでは`dep_a`という名前)の値を終了コードで利用できるようにする必要があります。
```Python hl_lines="16 17 24 25"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
```
同様に、`yield`と`return`が混在した依存関係を持つこともできます。
@@ -234,7 +234,7 @@ Pythonでは、`typing.Union`を使用します:
```Python hl_lines="1 14 15 18 19 20 33"
-{!../../../docs_src/extra_models/tutorial003.py!}
+{!../../docs_src/extra_models/tutorial003.py!}
```
## モデルのリスト
@@ -179,7 +179,7 @@ OpenAPIでは`anyOf`で定義されます。
そのためには、標準のPythonの`typing.List`を使用する:
```Python hl_lines="1 20"
-{!../../../docs_src/extra_models/tutorial004.py!}
+{!../../docs_src/extra_models/tutorial004.py!}
```
## 任意の`dict`を持つレスポンス
@@ -191,7 +191,7 @@ OpenAPIでは`anyOf`で定義されます。
この場合、`typing.Dict`を使用することができます:
```Python hl_lines="1 8"
-{!../../../docs_src/extra_models/tutorial005.py!}
+{!../../docs_src/extra_models/tutorial005.py!}
```
## まとめ
diff --git a/docs/ja/docs/tutorial/first-steps.md b/docs/ja/docs/tutorial/first-steps.md
index dbe8e4518..77f3b5fbe 100644
--- a/docs/ja/docs/tutorial/first-steps.md
+++ b/docs/ja/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
最もシンプルなFastAPIファイルは以下のようになります:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
これを`main.py`にコピーします。
@@ -134,7 +134,7 @@ OpenAPIスキーマは、FastAPIに含まれている2つのインタラクテ
### Step 1: `FastAPI`をインポート
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI`は、APIのすべての機能を提供するPythonクラスです。
@@ -150,7 +150,7 @@ OpenAPIスキーマは、FastAPIに含まれている2つのインタラクテ
### Step 2: `FastAPI`の「インスタンス」を生成
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
ここで、`app`変数が`FastAPI`クラスの「インスタンス」になります。
@@ -171,7 +171,7 @@ $ uvicorn main:app --reload
以下のようなアプリを作成したとき:
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
```
そして、それを`main.py`ファイルに置き、次のように`uvicorn`を呼び出します:
@@ -250,7 +250,7 @@ APIを構築するときは、通常、これらの特定のHTTPメソッドを
#### *パスオペレーションデコレータ*を定義
```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`@app.get("/")`は直下の関数が下記のリクエストの処理を担当することを**FastAPI**に伝えます:
@@ -305,7 +305,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
* **関数**: 「デコレータ」の直下にある関数 (`@app.get("/")`の直下) です。
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
これは、Pythonの関数です。
@@ -319,7 +319,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
`async def`の代わりに通常の関数として定義することもできます:
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
```
/// note | "備考"
@@ -331,7 +331,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
### Step 5: コンテンツの返信
```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`dict`、`list`、`str`、`int`などを返すことができます。
diff --git a/docs/ja/docs/tutorial/handling-errors.md b/docs/ja/docs/tutorial/handling-errors.md
index 8be054858..e94f16b21 100644
--- a/docs/ja/docs/tutorial/handling-errors.md
+++ b/docs/ja/docs/tutorial/handling-errors.md
@@ -26,7 +26,7 @@ HTTPレスポンスをエラーでクライアントに返すには、`HTTPExcep
### `HTTPException`のインポート
```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
```
### コード内での`HTTPException`の発生
@@ -42,7 +42,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
この例では、クライアントが存在しないIDでアイテムを要求した場合、`404`のステータスコードを持つ例外を発生させます:
```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
```
### レスポンス結果
@@ -82,7 +82,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
しかし、高度なシナリオのために必要な場合には、カスタムヘッダーを追加することができます:
```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
```
## カスタム例外ハンドラのインストール
@@ -96,7 +96,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
カスタム例外ハンドラを`@app.exception_handler()`で追加することができます:
```Python hl_lines="5 6 7 13 14 15 16 17 18 24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
```
ここで、`/unicorns/yolo`をリクエストすると、*path operation*は`UnicornException`を`raise`します。
@@ -136,7 +136,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
この例外ハンドラは`Requset`と例外を受け取ります。
```Python hl_lines="2 14 15 16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
```
これで、`/items/foo`にアクセスすると、デフォルトのJSONエラーの代わりに以下が返されます:
@@ -189,7 +189,7 @@ path -> item_id
例えば、これらのエラーに対しては、JSONではなくプレーンテキストを返すようにすることができます:
```Python hl_lines="3 4 9 10 11 22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
```
/// note | "技術詳細"
@@ -207,7 +207,7 @@ path -> item_id
アプリ開発中に本体のログを取ってデバッグしたり、ユーザーに返したりなどに使用することができます。
```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
```
ここで、以下のような無効な項目を送信してみてください:
@@ -269,7 +269,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
デフォルトの例外ハンドラを`fastapi.exception_handlers`からインポートして再利用することができます:
```Python hl_lines="2 3 4 5 15 21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
```
この例では、非常に表現力のあるメッセージでエラーを`print`しています。
diff --git a/docs/ja/docs/tutorial/header-params.md b/docs/ja/docs/tutorial/header-params.md
index 4fab3d423..3180b78b5 100644
--- a/docs/ja/docs/tutorial/header-params.md
+++ b/docs/ja/docs/tutorial/header-params.md
@@ -7,7 +7,7 @@
まず、`Header`をインポートします:
```Python hl_lines="3"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
```
## `Header`のパラメータの宣言
@@ -17,7 +17,7 @@
最初の値がデフォルト値で、追加の検証パラメータや注釈パラメータをすべて渡すことができます。
```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
```
/// note | "技術詳細"
@@ -51,7 +51,7 @@
もしなんらかの理由でアンダースコアからハイフンへの自動変換を無効にする必要がある場合は、`Header`の`convert_underscores`に`False`を設定してください:
```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial002.py!}
+{!../../docs_src/header_params/tutorial002.py!}
```
/// warning | "注意"
@@ -71,7 +71,7 @@
例えば、複数回出現する可能性のある`X-Token`のヘッダを定義するには、以下のように書くことができます:
```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial003.py!}
+{!../../docs_src/header_params/tutorial003.py!}
```
もし、その*path operation*で通信する場合は、次のように2つのHTTPヘッダーを送信します:
diff --git a/docs/ja/docs/tutorial/metadata.md b/docs/ja/docs/tutorial/metadata.md
index eb85dc389..8285b479e 100644
--- a/docs/ja/docs/tutorial/metadata.md
+++ b/docs/ja/docs/tutorial/metadata.md
@@ -14,7 +14,7 @@
これらを設定するには、パラメータ `title`、`description`、`version` を使用します:
```Python hl_lines="4-6"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
```
この設定では、自動APIドキュメントは以下の様になります:
@@ -42,7 +42,7 @@
タグのためのメタデータを作成し、それを `openapi_tags` パラメータに渡します。
```Python hl_lines="3-16 18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
```
説明文 (description) の中で Markdown を使用できることに注意してください。たとえば、「login」は太字 (**login**) で表示され、「fancy」は斜体 (_fancy_) で表示されます。
@@ -58,7 +58,7 @@
`tags` パラメーターを使用して、それぞれの *path operations* (および `APIRouter`) を異なるタグに割り当てます:
```Python hl_lines="21 26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
```
/// info | "情報"
@@ -88,7 +88,7 @@
たとえば、`/api/v1/openapi.json` で提供されるように設定するには:
```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
```
OpenAPIスキーマを完全に無効にする場合は、`openapi_url=None` を設定できます。これにより、それを使用するドキュメントUIも無効になります。
@@ -107,5 +107,5 @@ OpenAPIスキーマを完全に無効にする場合は、`openapi_url=None` を
たとえば、`/documentation` でSwagger UIが提供されるように設定し、ReDocを無効にするには:
```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
```
diff --git a/docs/ja/docs/tutorial/middleware.md b/docs/ja/docs/tutorial/middleware.md
index 05e1b7a8c..f4a503720 100644
--- a/docs/ja/docs/tutorial/middleware.md
+++ b/docs/ja/docs/tutorial/middleware.md
@@ -32,7 +32,7 @@
* その後、`response` を返す前にさらに `response` を変更することもできます。
```Python hl_lines="8-9 11 14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
```
/// tip | "豆知識"
@@ -60,7 +60,7 @@
例えば、リクエストの処理とレスポンスの生成にかかった秒数を含むカスタムヘッダー `X-Process-Time` を追加できます:
```Python hl_lines="10 12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
```
## その他のミドルウェア
diff --git a/docs/ja/docs/tutorial/path-operation-configuration.md b/docs/ja/docs/tutorial/path-operation-configuration.md
index def12bd08..7eceb377d 100644
--- a/docs/ja/docs/tutorial/path-operation-configuration.md
+++ b/docs/ja/docs/tutorial/path-operation-configuration.md
@@ -17,7 +17,7 @@
しかし、それぞれの番号コードが何のためのものか覚えていない場合は、`status`のショートカット定数を使用することができます:
```Python hl_lines="3 17"
-{!../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_configuration/tutorial001.py!}
```
そのステータスコードはレスポンスで使用され、OpenAPIスキーマに追加されます。
@@ -35,7 +35,7 @@
`tags`パラメータを`str`の`list`(通常は1つの`str`)と一緒に渡すと、*path operation*にタグを追加できます:
```Python hl_lines="17 22 27"
-{!../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_configuration/tutorial002.py!}
```
これらはOpenAPIスキーマに追加され、自動ドキュメントのインターフェースで使用されます:
@@ -47,7 +47,7 @@
`summary`と`description`を追加できます:
```Python hl_lines="20-21"
-{!../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_configuration/tutorial003.py!}
```
## docstringを用いた説明
@@ -57,7 +57,7 @@
docstringにMarkdownを記述すれば、正しく解釈されて表示されます。(docstringのインデントを考慮して)
```Python hl_lines="19-27"
-{!../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_configuration/tutorial004.py!}
```
これは対話的ドキュメントで使用されます:
@@ -69,7 +69,7 @@ docstringにdeprecatedとしてマークする必要があるが、それを削除しない場合は、`deprecated`パラメータを渡します:
```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
```
対話的ドキュメントでは非推奨と明記されます:
diff --git a/docs/ja/docs/tutorial/path-params-numeric-validations.md b/docs/ja/docs/tutorial/path-params-numeric-validations.md
index 9f0b72585..42fbb2ee2 100644
--- a/docs/ja/docs/tutorial/path-params-numeric-validations.md
+++ b/docs/ja/docs/tutorial/path-params-numeric-validations.md
@@ -7,7 +7,7 @@
まず初めに、`fastapi`から`Path`をインポートします:
```Python hl_lines="1"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
## メタデータの宣言
@@ -17,7 +17,7 @@
例えば、パスパラメータ`item_id`に対して`title`のメタデータを宣言するには以下のようにします:
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
/// note | "備考"
@@ -47,7 +47,7 @@ Pythonは「デフォルト」を持たない値の前に「デフォルト」
そのため、以下のように関数を宣言することができます:
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
```
## 必要に応じてパラメータを並び替えるトリック
@@ -59,7 +59,7 @@ Pythonは「デフォルト」を持たない値の前に「デフォルト」
Pythonはその`*`で何かをすることはありませんが、それ以降のすべてのパラメータがキーワード引数(キーと値のペア)として呼ばれるべきものであると知っているでしょう。それはkwargs
としても知られています。たとえデフォルト値がなくても。
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
## 数値の検証: 以上
@@ -69,7 +69,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
ここで、`ge=1`の場合、`item_id`は`1`「より大きい`g`か、同じ`e`」整数でなれけばなりません。
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
## 数値の検証: より大きいと小なりイコール
@@ -80,7 +80,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
* `le`: 小なりイコール(`l`ess than or `e`qual)
```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
## 数値の検証: 浮動小数点、 大なり小なり
@@ -94,7 +94,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
これはlt
も同じです。
```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
## まとめ
diff --git a/docs/ja/docs/tutorial/path-params.md b/docs/ja/docs/tutorial/path-params.md
index 0a7916012..e1cb67a13 100644
--- a/docs/ja/docs/tutorial/path-params.md
+++ b/docs/ja/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
Pythonのformat文字列と同様のシンタックスで「パスパラメータ」や「パス変数」を宣言できます:
```Python hl_lines="6 7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
パスパラメータ `item_id` の値は、引数 `item_id` として関数に渡されます。
@@ -19,7 +19,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
標準のPythonの型アノテーションを使用して、関数内のパスパラメータの型を宣言できます:
```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
```
ここでは、 `item_id` は `int` として宣言されています。
@@ -122,7 +122,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
*path operations* は順に評価されるので、 `/users/me` が `/users/{user_id}` よりも先に宣言されているか確認する必要があります:
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
```
それ以外の場合、 `/users/{users_id}` は `/users/me` としてもマッチします。値が「"me"」であるパラメータ `user_id` を受け取ると「考え」ます。
@@ -140,7 +140,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
そして、固定値のクラス属性を作ります。すると、その値が使用可能な値となります:
```Python hl_lines="1 6 7 8 9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// info | "情報"
@@ -160,7 +160,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
次に、作成したenumクラスである`ModelName`を使用した型アノテーションをもつ*パスパラメータ*を作成します:
```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
### ドキュメントの確認
@@ -178,7 +178,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
これは、作成した列挙型 `ModelName` の*列挙型メンバ*と比較できます:
```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
#### *列挙値*の取得
@@ -186,7 +186,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
`model_name.value` 、もしくは一般に、 `your_enum_member.value` を使用して実際の値 (この場合は `str`) を取得できます。
```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// tip | "豆知識"
@@ -202,7 +202,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
それらはクライアントに返される前に適切な値 (この場合は文字列) に変換されます。
```Python hl_lines="18 21 23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
クライアントは以下の様なJSONレスポンスを得ます:
@@ -243,7 +243,7 @@ Starletteのオプションを直接使用することで、以下のURLの様
したがって、以下の様に使用できます:
```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
```
/// tip | "豆知識"
diff --git a/docs/ja/docs/tutorial/query-params-str-validations.md b/docs/ja/docs/tutorial/query-params-str-validations.md
index ada048844..9e54a6f55 100644
--- a/docs/ja/docs/tutorial/query-params-str-validations.md
+++ b/docs/ja/docs/tutorial/query-params-str-validations.md
@@ -5,7 +5,7 @@
以下のアプリケーションを例にしてみましょう:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
```
クエリパラメータ `q` は `Optional[str]` 型で、`None` を許容する `str` 型を意味しており、デフォルトは `None` です。そのため、FastAPIはそれが必須ではないと理解します。
@@ -27,7 +27,7 @@ FastAPIは、 `q` はデフォルト値が `=None` であるため、必須で
そのために、まずは`fastapi`から`Query`をインポートします:
```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
## デフォルト値として`Query`を使用
@@ -35,7 +35,7 @@ FastAPIは、 `q` はデフォルト値が `=None` であるため、必須で
パラメータのデフォルト値として使用し、パラメータ`max_length`を50に設定します:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
デフォルト値`None`を`Query(default=None)`に置き換える必要があるので、`Query`の最初の引数はデフォルト値を定義するのと同じです。
@@ -87,7 +87,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
パラメータ`min_length`も追加することができます:
```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
```
## 正規表現の追加
@@ -95,7 +95,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
パラメータが一致するべき正規表現を定義することができます:
```Python hl_lines="11"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
```
この特定の正規表現は受け取ったパラメータの値をチェックします:
@@ -115,7 +115,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
クエリパラメータ`q`の`min_length`を`3`とし、デフォルト値を`fixedquery`としてみましょう:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
```
/// note | "備考"
@@ -147,7 +147,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
そのため、`Query`を使用して必須の値を宣言する必要がある場合は、第一引数に`...`を使用することができます:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// info | "情報"
@@ -165,7 +165,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
例えば、URL内に複数回出現するクエリパラメータ`q`を宣言するには以下のように書きます:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
```
そしてURLは以下です:
@@ -202,7 +202,7 @@ http://localhost:8000/items/?q=foo&q=bar
また、値が指定されていない場合はデフォルトの`list`を定義することもできます。
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
```
以下のURLを開くと:
@@ -227,7 +227,7 @@ http://localhost:8000/items/
`List[str]`の代わりに直接`list`を使うこともできます:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
```
/// note | "備考"
@@ -255,13 +255,13 @@ http://localhost:8000/items/
`title`を追加できます:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
```
`description`を追加できます:
```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
```
## エイリアスパラメータ
@@ -283,7 +283,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
それならば、`alias`を宣言することができます。エイリアスはパラメータの値を見つけるのに使用されます:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
```
## 非推奨パラメータ
@@ -295,7 +295,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
その場合、`Query`にパラメータ`deprecated=True`を渡します:
```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
```
ドキュメントは以下のようになります:
diff --git a/docs/ja/docs/tutorial/query-params.md b/docs/ja/docs/tutorial/query-params.md
index c0eb2d096..6d41d3742 100644
--- a/docs/ja/docs/tutorial/query-params.md
+++ b/docs/ja/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
パスパラメータではない関数パラメータを宣言すると、それらは自動的に "クエリ" パラメータとして解釈されます。
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
クエリはURL内で `?` の後に続くキーとバリューの組で、 `&` で区切られています。
@@ -64,7 +64,7 @@ http://127.0.0.1:8000/items/?skip=20
同様に、デフォルト値を `None` とすることで、オプショナルなクエリパラメータを宣言できます:
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
```
この場合、関数パラメータ `q` はオプショナルとなり、デフォルトでは `None` になります。
@@ -80,7 +80,7 @@ http://127.0.0.1:8000/items/?skip=20
`bool` 型も宣言できます。これは以下の様に変換されます:
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
```
この場合、以下にアクセスすると:
@@ -124,7 +124,7 @@ http://127.0.0.1:8000/items/foo?short=yes
名前で判別されます:
```Python hl_lines="8 10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
```
## 必須のクエリパラメータ
@@ -136,7 +136,7 @@ http://127.0.0.1:8000/items/foo?short=yes
しかしクエリパラメータを必須にしたい場合は、ただデフォルト値を宣言しなければよいです:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
ここで、クエリパラメータ `needy` は `str` 型の必須のクエリパラメータです
@@ -182,7 +182,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
そして当然、あるパラメータを必須に、別のパラメータにデフォルト値を設定し、また別のパラメータをオプショナルにできます:
```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
```
この場合、3つのクエリパラメータがあります。:
diff --git a/docs/ja/docs/tutorial/request-forms-and-files.md b/docs/ja/docs/tutorial/request-forms-and-files.md
index d8effc219..e03b9166d 100644
--- a/docs/ja/docs/tutorial/request-forms-and-files.md
+++ b/docs/ja/docs/tutorial/request-forms-and-files.md
@@ -13,7 +13,7 @@
## `File`と`Form`のインポート
```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
## `File`と`Form`のパラメータの定義
@@ -21,7 +21,7 @@
ファイルやフォームのパラメータは`Body`や`Query`の場合と同じように作成します:
```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
ファイルとフォームフィールドがフォームデータとしてアップロードされ、ファイルとフォームフィールドを受け取ります。
diff --git a/docs/ja/docs/tutorial/request-forms.md b/docs/ja/docs/tutorial/request-forms.md
index d04dc810b..eb453c04a 100644
--- a/docs/ja/docs/tutorial/request-forms.md
+++ b/docs/ja/docs/tutorial/request-forms.md
@@ -15,7 +15,7 @@ JSONの代わりにフィールドを受け取る場合は、`Form`を使用し
`fastapi`から`Form`をインポートします:
```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
```
## `Form`のパラメータの定義
@@ -23,7 +23,7 @@ JSONの代わりにフィールドを受け取る場合は、`Form`を使用し
`Body`や`Query`の場合と同じようにフォームパラメータを作成します:
```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
```
例えば、OAuth2仕様が使用できる方法の1つ(「パスワードフロー」と呼ばれる)では、フォームフィールドとして`username`と`password`を送信する必要があります。
diff --git a/docs/ja/docs/tutorial/response-model.md b/docs/ja/docs/tutorial/response-model.md
index 7bb5e2825..973f893de 100644
--- a/docs/ja/docs/tutorial/response-model.md
+++ b/docs/ja/docs/tutorial/response-model.md
@@ -9,7 +9,7 @@
* など。
```Python hl_lines="17"
-{!../../../docs_src/response_model/tutorial001.py!}
+{!../../docs_src/response_model/tutorial001.py!}
```
/// note | "備考"
@@ -42,13 +42,13 @@ FastAPIは`response_model`を使って以下のことをします:
ここでは`UserIn`モデルを宣言しています。それには平文のパスワードが含まれています:
```Python hl_lines="9 11"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
```
そして、このモデルを使用して入力を宣言し、同じモデルを使って出力を宣言しています:
```Python hl_lines="17 18"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
```
これで、ブラウザがパスワードを使ってユーザーを作成する際に、APIがレスポンスで同じパスワードを返すようになりました。
@@ -68,19 +68,19 @@ FastAPIは`response_model`を使って以下のことをします:
代わりに、平文のパスワードを持つ入力モデルと、パスワードを持たない出力モデルを作成することができます:
```Python hl_lines="9 11 16"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
ここでは、*path operation関数*がパスワードを含む同じ入力ユーザーを返しているにもかかわらず:
```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
...`response_model`を`UserOut`と宣言したことで、パスワードが含まれていません:
```Python hl_lines="22"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
そのため、**FastAPI** は出力モデルで宣言されていない全てのデータをフィルタリングしてくれます(Pydanticを使用)。
@@ -100,7 +100,7 @@ FastAPIは`response_model`を使って以下のことをします:
レスポンスモデルにはデフォルト値を設定することができます:
```Python hl_lines="11 13 14"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
```
* `description: str = None`は`None`がデフォルト値です。
@@ -116,7 +116,7 @@ FastAPIは`response_model`を使って以下のことをします:
*path operation デコレータ*に`response_model_exclude_unset=True`パラメータを設定することができます:
```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
```
そして、これらのデフォルト値はレスポンスに含まれず、実際に設定された値のみが含まれます。
@@ -206,7 +206,7 @@ FastAPIは十分に賢いので(実際には、Pydanticが十分に賢い)`d
///
```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial005.py!}
+{!../../docs_src/response_model/tutorial005.py!}
```
/// tip | "豆知識"
@@ -222,7 +222,7 @@ FastAPIは十分に賢いので(実際には、Pydanticが十分に賢い)`d
もし`set`を使用することを忘れて、代わりに`list`や`tuple`を使用しても、FastAPIはそれを`set`に変換して正しく動作します:
```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial006.py!}
+{!../../docs_src/response_model/tutorial006.py!}
```
## まとめ
diff --git a/docs/ja/docs/tutorial/response-status-code.md b/docs/ja/docs/tutorial/response-status-code.md
index 945767894..90b290887 100644
--- a/docs/ja/docs/tutorial/response-status-code.md
+++ b/docs/ja/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@
* など。
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note | "備考"
@@ -77,7 +77,7 @@ HTTPでは、レスポンスの一部として3桁の数字のステータス
先ほどの例をもう一度見てみましょう:
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
`201`は「作成完了」のためのステータスコードです。
@@ -87,7 +87,7 @@ HTTPでは、レスポンスの一部として3桁の数字のステータス
`fastapi.status`の便利な変数を利用することができます。
```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
```
それらは便利です。それらは同じ番号を保持しており、その方法ではエディタの自動補完を使用してそれらを見つけることができます。
diff --git a/docs/ja/docs/tutorial/schema-extra-example.md b/docs/ja/docs/tutorial/schema-extra-example.md
index a3cd5eb54..baf1bbedd 100644
--- a/docs/ja/docs/tutorial/schema-extra-example.md
+++ b/docs/ja/docs/tutorial/schema-extra-example.md
@@ -11,7 +11,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
Pydanticのドキュメント: スキーマのカスタマイズで説明されているように、`Config`と`schema_extra`を使ってPydanticモデルの例を宣言することができます:
```Python hl_lines="15 16 17 18 19 20 21 22 23"
-{!../../../docs_src/schema_extra_example/tutorial001.py!}
+{!../../docs_src/schema_extra_example/tutorial001.py!}
```
その追加情報はそのまま出力され、JSON Schemaに追加されます。
@@ -21,7 +21,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
後述する`Field`、`Path`、`Query`、`Body`などでは、任意の引数を関数に渡すことでJSON Schemaの追加情報を宣言することもできます:
```Python hl_lines="4 10 11 12 13"
-{!../../../docs_src/schema_extra_example/tutorial002.py!}
+{!../../docs_src/schema_extra_example/tutorial002.py!}
```
/// warning | "注意"
@@ -37,7 +37,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
例えば、`Body`にボディリクエストの`example`を渡すことができます:
```Python hl_lines="21 22 23 24 25 26"
-{!../../../docs_src/schema_extra_example/tutorial003.py!}
+{!../../docs_src/schema_extra_example/tutorial003.py!}
```
## ドキュメントのUIの例
diff --git a/docs/ja/docs/tutorial/security/first-steps.md b/docs/ja/docs/tutorial/security/first-steps.md
index c78a3755e..51f7bf829 100644
--- a/docs/ja/docs/tutorial/security/first-steps.md
+++ b/docs/ja/docs/tutorial/security/first-steps.md
@@ -21,7 +21,7 @@
`main.py`に、下記の例をコピーします:
```Python
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
## 実行
@@ -129,7 +129,7 @@ OAuth2は、バックエンドやAPIがユーザーを認証するサーバー
`OAuth2PasswordBearer` クラスのインスタンスを作成する時に、パラメーター`tokenUrl`を渡します。このパラメーターには、クライアント (ユーザーのブラウザで動作するフロントエンド) がトークンを取得するために`ユーザー名`と`パスワード`を送信するURLを指定します。
```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
/// tip | "豆知識"
@@ -169,7 +169,7 @@ oauth2_scheme(some, parameters)
これで`oauth2_scheme`を`Depends`で依存関係に渡すことができます。
```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
この依存関係は、*path operation function*のパラメーター`token`に代入される`str`を提供します。
diff --git a/docs/ja/docs/tutorial/security/get-current-user.md b/docs/ja/docs/tutorial/security/get-current-user.md
index 250f66b81..0edbd983f 100644
--- a/docs/ja/docs/tutorial/security/get-current-user.md
+++ b/docs/ja/docs/tutorial/security/get-current-user.md
@@ -3,7 +3,7 @@
一つ前の章では、(依存性注入システムに基づいた)セキュリティシステムは、 *path operation関数* に `str` として `token` を与えていました:
```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
しかし、それはまだそんなに有用ではありません。
@@ -17,7 +17,7 @@
ボディを宣言するのにPydanticを使用するのと同じやり方で、Pydanticを別のどんなところでも使うことができます:
```Python hl_lines="5 12-16"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
```
## 依存関係 `get_current_user` を作成
@@ -31,7 +31,7 @@
以前直接 *path operation* の中でしていたのと同じように、新しい依存関係である `get_current_user` は `str` として `token` を受け取るようになります:
```Python hl_lines="25"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
```
## ユーザーの取得
@@ -39,7 +39,7 @@
`get_current_user` は作成した(偽物の)ユーティリティ関数を使って、 `str` としてトークンを受け取り、先ほどのPydanticの `User` モデルを返却します:
```Python hl_lines="19-22 26-27"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
```
## 現在のユーザーの注入
@@ -47,7 +47,7 @@
ですので、 `get_current_user` に対して同様に *path operation* の中で `Depends` を利用できます。
```Python hl_lines="31"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
```
Pydanticモデルの `User` として、 `current_user` の型を宣言することに注意してください。
@@ -104,7 +104,7 @@ Pydanticモデルの `User` として、 `current_user` の型を宣言するこ
さらに、こうした何千もの *path operations* は、たった3行で表現できるのです:
```Python hl_lines="30-32"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
```
## まとめ
diff --git a/docs/ja/docs/tutorial/security/oauth2-jwt.md b/docs/ja/docs/tutorial/security/oauth2-jwt.md
index 4f6aebd4c..b2f511610 100644
--- a/docs/ja/docs/tutorial/security/oauth2-jwt.md
+++ b/docs/ja/docs/tutorial/security/oauth2-jwt.md
@@ -119,7 +119,7 @@ PassLibのcontextには、検証だけが許された非推奨の古いハッシ
さらに、ユーザーを認証して返す関数も作成します。
```Python hl_lines="7 48 55-56 59-60 69-75"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
```
/// note | "備考"
@@ -157,7 +157,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
新しいアクセストークンを生成するユーティリティ関数を作成します。
```Python hl_lines="6 12-14 28-30 78-86"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
```
## 依存関係の更新
@@ -169,7 +169,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
トークンが無効な場合は、すぐにHTTPエラーを返します。
```Python hl_lines="89-106"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
```
## `/token` パスオペレーションの更新
@@ -179,7 +179,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
JWTアクセストークンを作成し、それを返します。
```Python hl_lines="115-130"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
```
### JWTの"subject" `sub` についての技術的な詳細
diff --git a/docs/ja/docs/tutorial/static-files.md b/docs/ja/docs/tutorial/static-files.md
index c9d95bc34..e6002a1fb 100644
--- a/docs/ja/docs/tutorial/static-files.md
+++ b/docs/ja/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@
* `StaticFiles()` インスタンスを生成し、特定のパスに「マウント」。
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "技術詳細"
diff --git a/docs/ja/docs/tutorial/testing.md b/docs/ja/docs/tutorial/testing.md
index 3ed03ebea..6c5e712e8 100644
--- a/docs/ja/docs/tutorial/testing.md
+++ b/docs/ja/docs/tutorial/testing.md
@@ -19,7 +19,7 @@
チェックしたい Python の標準的な式と共に、シンプルに `assert` 文を記述します。
```Python hl_lines="2 12 15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
```
/// tip | "豆知識"
@@ -57,7 +57,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
**FastAPI** アプリに `main.py` ファイルがあるとします:
```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
```
### テストファイル
@@ -65,7 +65,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
次に、テストを含む `test_main.py` ファイルを作成し、`main` モジュール (`main.py`) から `app` をインポートします:
```Python
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
```
## テスト: 例の拡張
@@ -86,7 +86,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
//// tab | Python 3.10+
```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
```
////
@@ -94,7 +94,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
//// tab | Python 3.6+
```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
```
////
@@ -104,7 +104,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
次に、先程のものに拡張版のテストを加えた、`test_main_b.py` を作成します。
```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
```
リクエストに情報を渡せるクライアントが必要で、その方法がわからない場合はいつでも、`httpx` での実現方法を検索 (Google) できます。
diff --git a/docs/ko/docs/advanced/events.md b/docs/ko/docs/advanced/events.md
index e155f41f1..94867c198 100644
--- a/docs/ko/docs/advanced/events.md
+++ b/docs/ko/docs/advanced/events.md
@@ -15,7 +15,7 @@
응용 프로그램을 시작하기 전에 실행하려는 함수를 "startup" 이벤트로 선언합니다:
```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
```
이 경우 `startup` 이벤트 핸들러 함수는 단순히 몇 가지 값으로 구성된 `dict` 형식의 "데이터베이스"를 초기화합니다.
@@ -29,7 +29,7 @@
응용 프로그램이 종료될 때 실행하려는 함수를 추가하려면 `"shutdown"` 이벤트로 선언합니다:
```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
```
이 예제에서 `shutdown` 이벤트 핸들러 함수는 `"Application shutdown"`이라는 텍스트가 적힌 `log.txt` 파일을 추가할 것입니다.
diff --git a/docs/ko/docs/project-generation.md b/docs/ko/docs/project-generation.md
index 019919f77..dd11fca70 100644
--- a/docs/ko/docs/project-generation.md
+++ b/docs/ko/docs/project-generation.md
@@ -13,10 +13,10 @@ GitHub 저장소: 연결합니다.
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### 코드 수정
@@ -83,7 +83,7 @@ John Doe
이게 "타입 힌트"입니다:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
타입힌트는 다음과 같이 기본 값을 선언하는 것과는 다릅니다:
@@ -113,7 +113,7 @@ John Doe
아래 함수를 보면, 이미 타입 힌트가 적용되어 있는 걸 볼 수 있습니다:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
편집기가 변수의 타입을 알고 있기 때문에, 자동완성 뿐 아니라 에러도 확인할 수 있습니다:
@@ -123,7 +123,7 @@ John Doe
이제 고쳐야하는 걸 알기 때문에, `age`를 `str(age)`과 같이 문자열로 바꾸게 됩니다:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## 타입 선언
@@ -144,7 +144,7 @@ John Doe
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### 타입 매개변수를 활용한 Generic(제네릭) 타입
@@ -162,7 +162,7 @@ John Doe
`typing`에서 `List`(대문자 `L`)를 import 합니다.
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
콜론(`:`) 문법을 이용하여 변수를 선언합니다.
@@ -172,7 +172,7 @@ John Doe
이때 배열은 내부 타입을 포함하는 타입이기 때문에 대괄호 안에 넣어줍니다.
```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
/// tip | "팁"
@@ -200,7 +200,7 @@ John Doe
`tuple`과 `set`도 동일하게 선언할 수 있습니다.
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
```
이 뜻은 아래와 같습니다:
@@ -217,7 +217,7 @@ John Doe
두 번째 매개변수는 `dict`의 값(value)입니다.
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
```
이 뜻은 아래와 같습니다:
@@ -231,7 +231,7 @@ John Doe
`str`과 같이 타입을 선언할 때 `Optional`을 쓸 수도 있는데, "선택적(Optional)"이기때문에 `None`도 될 수 있습니다:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
`Optional[str]`을 `str` 대신 쓰게 되면, 특정 값이 실제로는 `None`이 될 수도 있는데 항상 `str`이라고 가정하는 상황에서 에디터가 에러를 찾게 도와줄 수 있습니다.
@@ -256,13 +256,13 @@ John Doe
이름(name)을 가진 `Person` 클래스가 있다고 해봅시다.
```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
그렇게 하면 변수를 `Person`이라고 선언할 수 있게 됩니다.
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
그리고 역시나 모든 에디터 도움을 받게 되겠죠.
@@ -284,7 +284,7 @@ John Doe
Pydantic 공식 문서 예시:
```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
```
/// info | "정보"
diff --git a/docs/ko/docs/tutorial/background-tasks.md b/docs/ko/docs/tutorial/background-tasks.md
index 880a1c198..376c52524 100644
--- a/docs/ko/docs/tutorial/background-tasks.md
+++ b/docs/ko/docs/tutorial/background-tasks.md
@@ -16,7 +16,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
먼저 아래와 같이 `BackgroundTasks`를 임포트하고, `BackgroundTasks`를 _경로 작동 함수_ 에서 매개변수로 가져오고 정의합니다.
```Python hl_lines="1 13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
**FastAPI** 는 `BackgroundTasks` 개체를 생성하고, 매개 변수로 전달합니다.
@@ -34,7 +34,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
그리고 이 작업은 `async`와 `await`를 사용하지 않으므로 일반 `def` 함수로 선언합니다.
```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
## 백그라운드 작업 추가
@@ -42,7 +42,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
_경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _백그라운드 작업_ 개체에 전달합니다.
```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
```
`.add_task()` 함수는 다음과 같은 인자를 받습니다 :
@@ -60,7 +60,7 @@ _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _
//// tab | Python 3.6 and above
```Python hl_lines="13 15 22 25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
```
////
@@ -68,7 +68,7 @@ _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _
//// tab | Python 3.10 and above
```Python hl_lines="11 13 20 23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
```
////
diff --git a/docs/ko/docs/tutorial/body-fields.md b/docs/ko/docs/tutorial/body-fields.md
index b74722e26..a13159c27 100644
--- a/docs/ko/docs/tutorial/body-fields.md
+++ b/docs/ko/docs/tutorial/body-fields.md
@@ -9,7 +9,7 @@
//// tab | Python 3.10+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
```
////
@@ -53,7 +53,7 @@
///
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
```
////
@@ -71,7 +71,7 @@
//// tab | Python 3.10+
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
```
////
@@ -79,7 +79,7 @@
//// tab | Python 3.9+
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
```
////
@@ -87,7 +87,7 @@
//// tab | Python 3.8+
```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
```
////
@@ -101,7 +101,7 @@
///
```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
```
////
@@ -115,7 +115,7 @@
///
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
```
////
diff --git a/docs/ko/docs/tutorial/body-multiple-params.md b/docs/ko/docs/tutorial/body-multiple-params.md
index 023575e1b..0a0f34585 100644
--- a/docs/ko/docs/tutorial/body-multiple-params.md
+++ b/docs/ko/docs/tutorial/body-multiple-params.md
@@ -11,7 +11,7 @@
또한, 기본 값을 `None`으로 설정해 본문 매개변수를 선택사항으로 선언할 수 있습니다.
```Python hl_lines="19-21"
-{!../../../docs_src/body_multiple_params/tutorial001.py!}
+{!../../docs_src/body_multiple_params/tutorial001.py!}
```
/// note | "참고"
@@ -36,7 +36,7 @@
하지만, 다중 본문 매개변수 역시 선언할 수 있습니다. 예. `item`과 `user`:
```Python hl_lines="22"
-{!../../../docs_src/body_multiple_params/tutorial002.py!}
+{!../../docs_src/body_multiple_params/tutorial002.py!}
```
이 경우에, **FastAPI**는 이 함수 안에 한 개 이상의 본문 매개변수(Pydantic 모델인 두 매개변수)가 있다고 알 것입니다.
@@ -80,7 +80,7 @@ FastAPI는 요청을 자동으로 변환해, 매개변수의 `item`과 `user`를
```Python hl_lines="23"
-{!../../../docs_src/body_multiple_params/tutorial003.py!}
+{!../../docs_src/body_multiple_params/tutorial003.py!}
```
이 경우에는 **FastAPI**는 본문을 이와 같이 예측할 것입니다:
@@ -111,7 +111,7 @@ FastAPI는 요청을 자동으로 변환해, 매개변수의 `item`과 `user`를
기본적으로 단일 값은 쿼리 매개변수로 해석되므로, 명시적으로 `Query`를 추가할 필요가 없고, 아래처럼 할 수 있습니다:
```Python hl_lines="27"
-{!../../../docs_src/body_multiple_params/tutorial004.py!}
+{!../../docs_src/body_multiple_params/tutorial004.py!}
```
이렇게:
@@ -135,7 +135,7 @@ Pydantic 모델 `Item`의 `item`을 본문 매개변수로 오직 한개만 갖
하지만, 만약 모델 내용에 `item `키를 가진 JSON으로 예측하길 원한다면, 추가적인 본문 매개변수를 선언한 것처럼 `Body`의 특별한 매개변수인 `embed`를 사용할 수 있습니다:
```Python hl_lines="17"
-{!../../../docs_src/body_multiple_params/tutorial005.py!}
+{!../../docs_src/body_multiple_params/tutorial005.py!}
```
아래 처럼:
diff --git a/docs/ko/docs/tutorial/body-nested-models.md b/docs/ko/docs/tutorial/body-nested-models.md
index 4d785f64b..12fb4e0cc 100644
--- a/docs/ko/docs/tutorial/body-nested-models.md
+++ b/docs/ko/docs/tutorial/body-nested-models.md
@@ -6,7 +6,7 @@
어트리뷰트를 서브타입으로 정의할 수 있습니다. 예를 들어 파이썬 `list`는:
```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial001.py!}
+{!../../docs_src/body_nested_models/tutorial001.py!}
```
이는 `tags`를 항목 리스트로 만듭니다. 각 항목의 타입을 선언하지 않더라도요.
@@ -20,7 +20,7 @@
먼저, 파이썬 표준 `typing` 모듈에서 `List`를 임포트합니다:
```Python hl_lines="1"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
```
### 타입 매개변수로 `List` 선언
@@ -43,7 +43,7 @@ my_list: List[str]
마찬가지로 예제에서 `tags`를 구체적으로 "문자열의 리스트"로 만들 수 있습니다:
```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
```
## 집합 타입
@@ -55,7 +55,7 @@ my_list: List[str]
그렇다면 `Set`을 임포트 하고 `tags`를 `str`의 `set`으로 선언할 수 있습니다:
```Python hl_lines="1 14"
-{!../../../docs_src/body_nested_models/tutorial003.py!}
+{!../../docs_src/body_nested_models/tutorial003.py!}
```
덕분에 중복 데이터가 있는 요청을 수신하더라도 고유한 항목들의 집합으로 변환됩니다.
@@ -79,7 +79,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
예를 들어, `Image` 모델을 선언할 수 있습니다:
```Python hl_lines="9-11"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
```
### 서브모듈을 타입으로 사용
@@ -87,7 +87,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
그리고 어트리뷰트의 타입으로 사용할 수 있습니다:
```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
```
이는 **FastAPI**가 다음과 유사한 본문을 기대한다는 것을 의미합니다:
@@ -122,7 +122,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
예를 들어 `Image` 모델 안에 `url` 필드를 `str` 대신 Pydantic의 `HttpUrl`로 선언할 수 있습니다:
```Python hl_lines="4 10"
-{!../../../docs_src/body_nested_models/tutorial005.py!}
+{!../../docs_src/body_nested_models/tutorial005.py!}
```
이 문자열이 유효한 URL인지 검사하고 JSON 스키마/OpenAPI로 문서화 됩니다.
@@ -132,7 +132,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
`list`, `set` 등의 서브타입으로 Pydantic 모델을 사용할 수도 있습니다:
```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial006.py!}
+{!../../docs_src/body_nested_models/tutorial006.py!}
```
아래와 같은 JSON 본문으로 예상(변환, 검증, 문서화 등을)합니다:
@@ -172,7 +172,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
단독으로 깊게 중첩된 모델을 정의할 수 있습니다:
```Python hl_lines="9 14 20 23 27"
-{!../../../docs_src/body_nested_models/tutorial007.py!}
+{!../../docs_src/body_nested_models/tutorial007.py!}
```
/// info | "정보"
@@ -192,7 +192,7 @@ images: List[Image]
이를 아래처럼:
```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial008.py!}
+{!../../docs_src/body_nested_models/tutorial008.py!}
```
## 어디서나 편집기 지원
@@ -224,7 +224,7 @@ Pydantic 모델 대신에 `dict`를 직접 사용하여 작업할 경우, 이러
이 경우, `float` 값을 가진 `int` 키가 있는 모든 `dict`를 받아들입니다:
```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial009.py!}
+{!../../docs_src/body_nested_models/tutorial009.py!}
```
/// tip | "팁"
diff --git a/docs/ko/docs/tutorial/body.md b/docs/ko/docs/tutorial/body.md
index 337218eb4..8df8d556e 100644
--- a/docs/ko/docs/tutorial/body.md
+++ b/docs/ko/docs/tutorial/body.md
@@ -25,7 +25,7 @@
//// tab | Python 3.10+
```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -33,7 +33,7 @@
//// tab | Python 3.8+
```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -47,7 +47,7 @@
//// tab | Python 3.10+
```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -55,7 +55,7 @@
//// tab | Python 3.8+
```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -89,7 +89,7 @@
//// tab | Python 3.10+
```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -97,7 +97,7 @@
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -170,7 +170,7 @@
//// tab | Python 3.10+
```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
```
////
@@ -178,7 +178,7 @@
//// tab | Python 3.8+
```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
```
////
@@ -192,7 +192,7 @@
//// tab | Python 3.10+
```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
```
////
@@ -200,7 +200,7 @@
//// tab | Python 3.8+
```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
```
////
@@ -214,7 +214,7 @@
//// tab | Python 3.10+
```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
```
////
@@ -222,7 +222,7 @@
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
```
////
diff --git a/docs/ko/docs/tutorial/cookie-params.md b/docs/ko/docs/tutorial/cookie-params.md
index 5f129b63f..1e21e069d 100644
--- a/docs/ko/docs/tutorial/cookie-params.md
+++ b/docs/ko/docs/tutorial/cookie-params.md
@@ -9,7 +9,7 @@
//// tab | Python 3.10+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -53,7 +53,7 @@
///
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
@@ -67,7 +67,7 @@
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -75,7 +75,7 @@
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -83,7 +83,7 @@
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -97,7 +97,7 @@
///
```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -111,7 +111,7 @@
///
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
diff --git a/docs/ko/docs/tutorial/cors.md b/docs/ko/docs/tutorial/cors.md
index 312fdee1b..65357ae3f 100644
--- a/docs/ko/docs/tutorial/cors.md
+++ b/docs/ko/docs/tutorial/cors.md
@@ -47,7 +47,7 @@
* 특정한 HTTP 헤더 또는 와일드카드 `"*"` 를 사용한 모든 HTTP 헤더.
```Python hl_lines="2 6-11 13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
```
`CORSMiddleware` 에서 사용하는 기본 매개변수는 제한적이므로, 브라우저가 교차-도메인 상황에서 특정한 출처, 메소드, 헤더 등을 사용할 수 있도록 하려면 이들을 명시적으로 허용해야 합니다.
diff --git a/docs/ko/docs/tutorial/debugging.md b/docs/ko/docs/tutorial/debugging.md
index cb45e5169..27e8f9abf 100644
--- a/docs/ko/docs/tutorial/debugging.md
+++ b/docs/ko/docs/tutorial/debugging.md
@@ -7,7 +7,7 @@
FastAPI 애플리케이션에서 `uvicorn`을 직접 임포트하여 실행합니다
```Python hl_lines="1 15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
```
### `__name__ == "__main__"` 에 대하여
diff --git a/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md b/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md
index 259fe4b6d..7430efbb4 100644
--- a/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md
+++ b/docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md
@@ -9,7 +9,7 @@
//// tab | 파이썬 3.6 이상
```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | 파이썬 3.10 이상
```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
```
////
@@ -84,7 +84,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.6 이상
```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
```
////
@@ -92,7 +92,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.10 이상
```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
```
////
@@ -102,7 +102,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.6 이상
```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
```
////
@@ -110,7 +110,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.10 이상
```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
```
////
@@ -120,7 +120,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.6 이상
```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
```
////
@@ -128,7 +128,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.10 이상
```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
```
////
@@ -150,7 +150,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.6 이상
```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
```
////
@@ -158,7 +158,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
//// tab | 파이썬 3.10 이상
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
```
////
@@ -203,7 +203,7 @@ commons = Depends(CommonQueryParams)
//// tab | 파이썬 3.6 이상
```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
```
////
@@ -211,7 +211,7 @@ commons = Depends(CommonQueryParams)
//// tab | 파이썬 3.10 이상
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
```
////
@@ -251,7 +251,7 @@ commons: CommonQueryParams = Depends()
//// tab | 파이썬 3.6 이상
```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
```
////
@@ -259,7 +259,7 @@ commons: CommonQueryParams = Depends()
//// tab | 파이썬 3.10 이상
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
```
////
diff --git a/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md b/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
index bc8af488d..e71ba8546 100644
--- a/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
+++ b/docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
```
////
@@ -75,7 +75,7 @@
//// tab | Python 3.9+
```Python hl_lines="8 13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
```
////
@@ -83,7 +83,7 @@
//// tab | Python 3.8+
```Python hl_lines="7 12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
```
////
@@ -97,7 +97,7 @@
///
```Python hl_lines="6 11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
```
////
@@ -109,7 +109,7 @@
//// tab | Python 3.9+
```Python hl_lines="10 15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
```
////
@@ -117,7 +117,7 @@
//// tab | Python 3.8+
```Python hl_lines="9 14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
```
////
@@ -131,7 +131,7 @@
///
```Python hl_lines="8 13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
```
////
@@ -145,7 +145,7 @@
//// tab | Python 3.9+
```Python hl_lines="11 16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
```
////
@@ -153,7 +153,7 @@
//// tab | Python 3.8+
```Python hl_lines="10 15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
```
////
@@ -167,7 +167,7 @@
///
```Python hl_lines="9 14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
```
////
diff --git a/docs/ko/docs/tutorial/dependencies/global-dependencies.md b/docs/ko/docs/tutorial/dependencies/global-dependencies.md
index 2ce2cf4f2..dd6586c3e 100644
--- a/docs/ko/docs/tutorial/dependencies/global-dependencies.md
+++ b/docs/ko/docs/tutorial/dependencies/global-dependencies.md
@@ -9,7 +9,7 @@
//// tab | Python 3.9+
```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.8+
```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
```
////
@@ -31,7 +31,7 @@
///
```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
```
////
diff --git a/docs/ko/docs/tutorial/dependencies/index.md b/docs/ko/docs/tutorial/dependencies/index.md
index 361989e2b..f7b2f1788 100644
--- a/docs/ko/docs/tutorial/dependencies/index.md
+++ b/docs/ko/docs/tutorial/dependencies/index.md
@@ -34,7 +34,7 @@
//// tab | Python 3.10+
```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
```
////
@@ -42,7 +42,7 @@
//// tab | Python 3.9+
```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
```
////
@@ -50,7 +50,7 @@
//// tab | Python 3.8+
```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
```
////
@@ -64,7 +64,7 @@
///
```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
```
////
@@ -78,7 +78,7 @@
///
```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
```
////
@@ -116,7 +116,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.10+
```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
```
////
@@ -124,7 +124,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
```
////
@@ -132,7 +132,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.8+
```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
```
////
@@ -146,7 +146,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
///
```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
```
////
@@ -160,7 +160,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
///
```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
```
////
@@ -172,7 +172,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.10+
```Python hl_lines="13 18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
```
////
@@ -180,7 +180,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.9+
```Python hl_lines="15 20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
```
////
@@ -188,7 +188,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
//// tab | Python 3.8+
```Python hl_lines="16 21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
```
////
@@ -202,7 +202,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
///
```Python hl_lines="11 16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
```
////
@@ -216,7 +216,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
///
```Python hl_lines="15 20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
```
////
@@ -279,7 +279,7 @@ commons: Annotated[dict, Depends(common_parameters)]
//// tab | Python 3.10+
```Python hl_lines="12 16 21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
```
////
@@ -287,7 +287,7 @@ commons: Annotated[dict, Depends(common_parameters)]
//// tab | Python 3.9+
```Python hl_lines="14 18 23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
```
////
@@ -295,7 +295,7 @@ commons: Annotated[dict, Depends(common_parameters)]
//// tab | Python 3.8+
```Python hl_lines="15 19 24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
```
////
diff --git a/docs/ko/docs/tutorial/encoder.md b/docs/ko/docs/tutorial/encoder.md
index b8e87449c..732566d6d 100644
--- a/docs/ko/docs/tutorial/encoder.md
+++ b/docs/ko/docs/tutorial/encoder.md
@@ -21,7 +21,7 @@ JSON 호환 가능 데이터만 수신하는 `fake_db` 데이터베이스가 존
Pydantic 모델과 같은 객체를 받고 JSON 호환 가능한 버전으로 반환합니다:
```Python hl_lines="5 22"
-{!../../../docs_src/encoder/tutorial001.py!}
+{!../../docs_src/encoder/tutorial001.py!}
```
이 예시는 Pydantic 모델을 `dict`로, `datetime` 형식을 `str`로 변환합니다.
diff --git a/docs/ko/docs/tutorial/extra-data-types.md b/docs/ko/docs/tutorial/extra-data-types.md
index df3c7a06e..8baaa64fc 100644
--- a/docs/ko/docs/tutorial/extra-data-types.md
+++ b/docs/ko/docs/tutorial/extra-data-types.md
@@ -58,7 +58,7 @@
//// tab | Python 3.10+
```Python hl_lines="1 3 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
////
@@ -66,7 +66,7 @@
//// tab | Python 3.9+
```Python hl_lines="1 3 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
////
@@ -74,7 +74,7 @@
//// tab | Python 3.8+
```Python hl_lines="1 3 13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
```
////
@@ -88,7 +88,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1 2 11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
```
////
@@ -102,7 +102,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1 2 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
```
////
@@ -112,7 +112,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.10+
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
////
@@ -120,7 +120,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.9+
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
////
@@ -128,7 +128,7 @@ Prefer to use the `Annotated` version if possible.
//// tab | Python 3.8+
```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
```
////
@@ -142,7 +142,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
```
////
@@ -156,7 +156,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
```
////
diff --git a/docs/ko/docs/tutorial/first-steps.md b/docs/ko/docs/tutorial/first-steps.md
index 52e53fd89..c2c48fb3e 100644
--- a/docs/ko/docs/tutorial/first-steps.md
+++ b/docs/ko/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
가장 단순한 FastAPI 파일은 다음과 같이 보일 것입니다:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
위 코드를 `main.py`에 복사합니다.
@@ -134,7 +134,7 @@ API와 통신하는 클라이언트(프론트엔드, 모바일, IoT 애플리케
### 1 단계: `FastAPI` 임포트
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI`는 당신의 API를 위한 모든 기능을 제공하는 파이썬 클래스입니다.
@@ -150,7 +150,7 @@ API와 통신하는 클라이언트(프론트엔드, 모바일, IoT 애플리케
### 2 단계: `FastAPI` "인스턴스" 생성
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
여기에서 `app` 변수는 `FastAPI` 클래스의 "인스턴스"가 됩니다.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
아래처럼 앱을 만든다면:
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
```
이를 `main.py` 파일에 넣고, `uvicorn`을 아래처럼 호출해야 합니다:
@@ -251,7 +251,7 @@ API를 설계할 때 일반적으로 특정 행동을 수행하기 위해 특정
#### *경로 작동 데코레이터* 정의
```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`@app.get("/")`은 **FastAPI**에게 바로 아래에 있는 함수가 다음으로 이동하는 요청을 처리한다는 것을 알려줍니다.
@@ -307,7 +307,7 @@ API를 설계할 때 일반적으로 특정 행동을 수행하기 위해 특정
* **함수**: 는 "데코레이터" 아래에 있는 함수입니다 (`@app.get("/")` 아래).
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
이것은 파이썬 함수입니다.
@@ -321,7 +321,7 @@ URL "`/`"에 대한 `GET` 작동을 사용하는 요청을 받을 때마다 **Fa
`async def`을 이용하는 대신 일반 함수로 정의할 수 있습니다:
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
```
/// note | "참고"
@@ -333,7 +333,7 @@ URL "`/`"에 대한 `GET` 작동을 사용하는 요청을 받을 때마다 **Fa
### 5 단계: 콘텐츠 반환
```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`dict`, `list`, 단일값을 가진 `str`, `int` 등을 반환할 수 있습니다.
diff --git a/docs/ko/docs/tutorial/header-params.md b/docs/ko/docs/tutorial/header-params.md
index d403b9175..26e198869 100644
--- a/docs/ko/docs/tutorial/header-params.md
+++ b/docs/ko/docs/tutorial/header-params.md
@@ -7,7 +7,7 @@
먼저 `Header`를 임포트합니다:
```Python hl_lines="3"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
```
## `Header` 매개변수 선언
@@ -17,7 +17,7 @@
첫 번째 값은 기본값이며, 추가 검증이나 어노테이션 매개변수 모두 전달할 수 있습니다:
```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
```
/// note | "기술 세부사항"
@@ -51,7 +51,7 @@
만약 언더스코어를 하이픈으로 자동 변환을 비활성화해야 할 어떤 이유가 있다면, `Header`의 `convert_underscores` 매개변수를 `False`로 설정하십시오:
```Python hl_lines="10"
-{!../../../docs_src/header_params/tutorial002.py!}
+{!../../docs_src/header_params/tutorial002.py!}
```
/// warning | "경고"
@@ -71,7 +71,7 @@
예를 들어, 두 번 이상 나타날 수 있는 `X-Token`헤더를 선언하려면, 다음과 같이 작성합니다:
```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial003.py!}
+{!../../docs_src/header_params/tutorial003.py!}
```
다음과 같은 두 개의 HTTP 헤더를 전송하여 해당 *경로* 와 통신할 경우:
diff --git a/docs/ko/docs/tutorial/index.md b/docs/ko/docs/tutorial/index.md
index d00a942f0..a148bc76e 100644
--- a/docs/ko/docs/tutorial/index.md
+++ b/docs/ko/docs/tutorial/index.md
@@ -30,7 +30,7 @@ $ uvicorn main:app --reload
코드를 작성하거나 복사, 편집할 때, 로컬 환경에서 실행하는 것을 **강력히 권장**합니다.
-로컬 편집기에서 사용한다면, 모든 타입 검사와 자동완성 등 작성해야 하는 코드가 얼마나 적은지 보면서 FastAPI의 비로소 경험할 수 있습니다.
+로컬 편집기에서 사용한다면, 모든 타입 검사와 자동완성 등 작성해야 하는 코드가 얼마나 적은지 보면서 FastAPI의 이점을 비로소 경험할 수 있습니다.
---
diff --git a/docs/ko/docs/tutorial/middleware.md b/docs/ko/docs/tutorial/middleware.md
index 84f67bd26..f36f11a27 100644
--- a/docs/ko/docs/tutorial/middleware.md
+++ b/docs/ko/docs/tutorial/middleware.md
@@ -32,7 +32,7 @@
* `response`를 반환하기 전에 추가로 `response`를 수정할 수 있습니다.
```Python hl_lines="8-9 11 14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
```
/// tip | "팁"
@@ -60,7 +60,7 @@
예를 들어, 요청을 수행하고 응답을 생성하는데 까지 걸린 시간 값을 가지고 있는 `X-Process-Time` 같은 사용자 정의 헤더를 추가할 수 있습니다.
```Python hl_lines="10 12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
```
## 다른 미들웨어
diff --git a/docs/ko/docs/tutorial/path-operation-configuration.md b/docs/ko/docs/tutorial/path-operation-configuration.md
index b6608a14d..6ebe613a8 100644
--- a/docs/ko/docs/tutorial/path-operation-configuration.md
+++ b/docs/ko/docs/tutorial/path-operation-configuration.md
@@ -17,7 +17,7 @@
하지만 각 코드의 의미를 모른다면, `status`에 있는 단축 상수들을 사용할수 있습니다:
```Python hl_lines="3 17"
-{!../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_configuration/tutorial001.py!}
```
각 상태 코드들은 응답에 사용되며, OpenAPI 스키마에 추가됩니다.
@@ -35,7 +35,7 @@
(보통 단일 `str`인) `str`로 구성된 `list`와 함께 매개변수 `tags`를 전달하여, `경로 작동`에 태그를 추가할 수 있습니다:
```Python hl_lines="17 22 27"
-{!../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_configuration/tutorial002.py!}
```
전달된 태그들은 OpenAPI의 스키마에 추가되며, 자동 문서 인터페이스에서 사용됩니다:
@@ -47,7 +47,7 @@
`summary`와 `description`을 추가할 수 있습니다:
```Python hl_lines="20-21"
-{!../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_configuration/tutorial003.py!}
```
## 독스트링으로 만든 기술
@@ -57,7 +57,7 @@
마크다운 문법으로 독스트링을 작성할 수 있습니다, 작성된 마크다운 형식의 독스트링은 (마크다운의 들여쓰기를 고려하여) 올바르게 화면에 출력됩니다.
```Python hl_lines="19-27"
-{!../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_configuration/tutorial004.py!}
```
이는 대화형 문서에서 사용됩니다:
@@ -69,7 +69,7 @@
`response_description` 매개변수로 응답에 관한 설명을 명시할 수 있습니다:
```Python hl_lines="21"
-{!../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_configuration/tutorial005.py!}
```
/// info | "정보"
@@ -93,7 +93,7 @@ OpenAPI는 각 *경로 작동*이 응답에 관한 설명을 요구할 것을
단일 *경로 작동*을 없애지 않고 지원중단을 해야한다면, `deprecated` 매개변수를 전달하면 됩니다.
```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
```
대화형 문서에 지원중단이라고 표시됩니다.
diff --git a/docs/ko/docs/tutorial/path-params-numeric-validations.md b/docs/ko/docs/tutorial/path-params-numeric-validations.md
index 6d3215c24..caab2d453 100644
--- a/docs/ko/docs/tutorial/path-params-numeric-validations.md
+++ b/docs/ko/docs/tutorial/path-params-numeric-validations.md
@@ -7,7 +7,7 @@
먼저 `fastapi`에서 `Path`를 임포트합니다:
```Python hl_lines="3"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
## 메타데이터 선언
@@ -17,7 +17,7 @@
예를 들어, `title` 메타데이터 값을 경로 매개변수 `item_id`에 선언하려면 다음과 같이 입력할 수 있습니다:
```Python hl_lines="10"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
/// note | "참고"
@@ -47,7 +47,7 @@
따라서 함수를 다음과 같이 선언 할 수 있습니다:
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
```
## 필요한 경우 매개변수 정렬하기, 트릭
@@ -59,7 +59,7 @@
파이썬은 `*`으로 아무런 행동도 하지 않지만, 따르는 매개변수들은 kwargs
로도 알려진 키워드 인자(키-값 쌍)여야 함을 인지합니다. 기본값을 가지고 있지 않더라도 그렇습니다.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
## 숫자 검증: 크거나 같음
@@ -69,7 +69,7 @@
여기서 `ge=1`인 경우, `item_id`는 `1`보다 "크거나(`g`reater) 같은(`e`qual)" 정수형 숫자여야 합니다.
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
## 숫자 검증: 크거나 같음 및 작거나 같음
@@ -80,7 +80,7 @@
* `le`: 작거나 같은(`l`ess than or `e`qual)
```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
## 숫자 검증: 부동소수, 크거나 및 작거나
@@ -94,7 +94,7 @@
lt
역시 마찬가지입니다.
```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
## 요약
diff --git a/docs/ko/docs/tutorial/path-params.md b/docs/ko/docs/tutorial/path-params.md
index 67a2d899d..09a27a7b3 100644
--- a/docs/ko/docs/tutorial/path-params.md
+++ b/docs/ko/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
파이썬의 포맷 문자열 리터럴에서 사용되는 문법을 이용하여 경로 "매개변수" 또는 "변수"를 선언할 수 있습니다:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
경로 매개변수 `item_id`의 값은 함수의 `item_id` 인자로 전달됩니다.
@@ -19,7 +19,7 @@
파이썬 표준 타입 어노테이션을 사용하여 함수에 있는 경로 매개변수의 타입을 선언할 수 있습니다:
```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
```
위의 예시에서, `item_id`는 `int`로 선언되었습니다.
@@ -122,7 +122,7 @@
*경로 작동*은 순차적으로 실행되기 때문에 `/users/{user_id}` 이전에 `/users/me`를 먼저 선언해야 합니다:
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
```
그렇지 않으면 `/users/{user_id}`는 `/users/me` 요청 또한 매개변수 `user_id`의 값이 `"me"`인 것으로 "생각하게" 됩니다.
@@ -140,7 +140,7 @@
가능한 값들에 해당하는 고정된 값의 클래스 어트리뷰트들을 만듭니다:
```Python hl_lines="1 6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// info | "정보"
@@ -160,7 +160,7 @@
생성한 열거형 클래스(`ModelName`)를 사용하는 타입 어노테이션으로 *경로 매개변수*를 만듭니다:
```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
### 문서 확인
@@ -178,7 +178,7 @@
열거형 `ModelName`의 *열거형 멤버*를 비교할 수 있습니다:
```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
#### *열거형 값* 가져오기
@@ -186,7 +186,7 @@
`model_name.value` 또는 일반적으로 `your_enum_member.value`를 이용하여 실제 값(위 예시의 경우 `str`)을 가져올 수 있습니다:
```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// tip | "팁"
@@ -202,7 +202,7 @@
클라이언트에 반환하기 전에 해당 값(이 경우 문자열)으로 변환됩니다:
```Python hl_lines="18 21 23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
클라이언트는 아래의 JSON 응답을 얻습니다:
@@ -243,7 +243,7 @@ Starlette의 옵션을 직접 이용하여 다음과 같은 URL을 사용함으
따라서 다음과 같이 사용할 수 있습니다:
```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
```
/// tip | "팁"
diff --git a/docs/ko/docs/tutorial/query-params-str-validations.md b/docs/ko/docs/tutorial/query-params-str-validations.md
index 11193950b..e44f6dd16 100644
--- a/docs/ko/docs/tutorial/query-params-str-validations.md
+++ b/docs/ko/docs/tutorial/query-params-str-validations.md
@@ -5,7 +5,7 @@
이 응용 프로그램을 예로 들어보겠습니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
```
쿼리 매개변수 `q`는 `Optional[str]` 자료형입니다. 즉, `str` 자료형이지만 `None` 역시 될 수 있음을 뜻하고, 실제로 기본값은 `None`이기 때문에 FastAPI는 이 매개변수가 필수가 아니라는 것을 압니다.
@@ -27,7 +27,7 @@ FastAPI는 `q`의 기본값이 `= None`이기 때문에 필수가 아님을 압
이를 위해 먼저 `fastapi`에서 `Query`를 임포트합니다:
```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
## 기본값으로 `Query` 사용
@@ -35,7 +35,7 @@ FastAPI는 `q`의 기본값이 `= None`이기 때문에 필수가 아님을 압
이제 `Query`를 매개변수의 기본값으로 사용하여 `max_length` 매개변수를 50으로 설정합니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
```
기본값 `None`을 `Query(None)`으로 바꿔야 하므로, `Query`의 첫 번째 매개변수는 기본값을 정의하는 것과 같은 목적으로 사용됩니다.
@@ -87,7 +87,7 @@ q: str = Query(None, max_length=50)
매개변수 `min_length` 또한 추가할 수 있습니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
```
## 정규식 추가
@@ -95,7 +95,7 @@ q: str = Query(None, max_length=50)
매개변수와 일치해야 하는 정규표현식을 정의할 수 있습니다:
```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
```
이 특정 정규표현식은 전달 받은 매개변수 값을 검사합니다:
@@ -115,7 +115,7 @@ q: str = Query(None, max_length=50)
`min_length`가 `3`이고, 기본값이 `"fixedquery"`인 쿼리 매개변수 `q`를 선언해봅시다:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
```
/// note | "참고"
@@ -147,7 +147,7 @@ q: Optional[str] = Query(None, min_length=3)
그래서 `Query`를 필수값으로 만들어야 할 때면, 첫 번째 인자로 `...`를 사용할 수 있습니다:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// info | "정보"
@@ -165,7 +165,7 @@ q: Optional[str] = Query(None, min_length=3)
예를 들어, URL에서 여러번 나오는 `q` 쿼리 매개변수를 선언하려면 다음과 같이 작성할 수 있습니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
```
아래와 같은 URL을 사용합니다:
@@ -202,7 +202,7 @@ http://localhost:8000/items/?q=foo&q=bar
그리고 제공된 값이 없으면 기본 `list` 값을 정의할 수도 있습니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
```
아래로 이동한다면:
@@ -227,7 +227,7 @@ http://localhost:8000/items/
`List[str]` 대신 `list`를 직접 사용할 수도 있습니다:
```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
```
/// note | "참고"
@@ -255,13 +255,13 @@ http://localhost:8000/items/
`title`을 추가할 수 있습니다:
```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
```
그리고 `description`도 추가할 수 있습니다:
```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
```
## 별칭 매개변수
@@ -283,7 +283,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
이럴 경우 `alias`를 선언할 수 있으며, 해당 별칭은 매개변수 값을 찾는 데 사용됩니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
```
## 매개변수 사용하지 않게 하기
@@ -295,7 +295,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
그렇다면 `deprecated=True` 매개변수를 `Query`로 전달합니다:
```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
```
문서가 아래와 같이 보일겁니다:
diff --git a/docs/ko/docs/tutorial/query-params.md b/docs/ko/docs/tutorial/query-params.md
index e71444c18..b2a946c09 100644
--- a/docs/ko/docs/tutorial/query-params.md
+++ b/docs/ko/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
경로 매개변수의 일부가 아닌 다른 함수 매개변수를 선언하면 "쿼리" 매개변수로 자동 해석합니다.
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
쿼리는 URL에서 `?` 후에 나오고 `&`으로 구분되는 키-값 쌍의 집합입니다.
@@ -64,7 +64,7 @@ http://127.0.0.1:8000/items/?skip=20
같은 방법으로 기본값을 `None`으로 설정하여 선택적 매개변수를 선언할 수 있습니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
```
이 경우 함수 매개변수 `q`는 선택적이며 기본값으로 `None` 값이 됩니다.
@@ -88,7 +88,7 @@ FastAPI는 `q`가 `= None`이므로 선택적이라는 것을 인지합니다.
`bool` 형으로 선언할 수도 있고, 아래처럼 변환됩니다:
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
```
이 경우, 아래로 이동하면:
@@ -133,7 +133,7 @@ http://127.0.0.1:8000/items/foo?short=yes
매개변수들은 이름으로 감지됩니다:
```Python hl_lines="8 10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
```
## 필수 쿼리 매개변수
@@ -145,7 +145,7 @@ http://127.0.0.1:8000/items/foo?short=yes
그러나 쿼리 매개변수를 필수로 만들려면 단순히 기본값을 선언하지 않으면 됩니다:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
여기 쿼리 매개변수 `needy`는 `str`형인 필수 쿼리 매개변수입니다.
@@ -191,7 +191,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
그리고 물론, 일부 매개변수는 필수로, 다른 일부는 기본값을, 또 다른 일부는 선택적으로 선언할 수 있습니다:
```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
```
위 예시에서는 3가지 쿼리 매개변수가 있습니다:
diff --git a/docs/ko/docs/tutorial/request-files.md b/docs/ko/docs/tutorial/request-files.md
index b7781ef5e..40579dd51 100644
--- a/docs/ko/docs/tutorial/request-files.md
+++ b/docs/ko/docs/tutorial/request-files.md
@@ -17,7 +17,7 @@
`fastapi` 에서 `File` 과 `UploadFile` 을 임포트 합니다:
```Python hl_lines="1"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
## `File` 매개변수 정의
@@ -25,7 +25,7 @@
`Body` 및 `Form` 과 동일한 방식으로 파일의 매개변수를 생성합니다:
```Python hl_lines="7"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
/// info | "정보"
@@ -55,7 +55,7 @@ File의 본문을 선언할 때, 매개변수가 쿼리 매개변수 또는 본
`File` 매개변수를 `UploadFile` 타입으로 정의합니다:
```Python hl_lines="12"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
```
`UploadFile` 을 사용하는 것은 `bytes` 과 비교해 다음과 같은 장점이 있습니다:
@@ -143,7 +143,7 @@ HTML의 폼들(``)이 서버에 데이터를 전송하는 방식은
이 기능을 사용하기 위해 , `bytes` 의 `List` 또는 `UploadFile` 를 선언하기 바랍니다:
```Python hl_lines="10 15"
-{!../../../docs_src/request_files/tutorial002.py!}
+{!../../docs_src/request_files/tutorial002.py!}
```
선언한대로, `bytes` 의 `list` 또는 `UploadFile` 들을 전송받을 것입니다.
diff --git a/docs/ko/docs/tutorial/request-forms-and-files.md b/docs/ko/docs/tutorial/request-forms-and-files.md
index 0867414ea..24501fe34 100644
--- a/docs/ko/docs/tutorial/request-forms-and-files.md
+++ b/docs/ko/docs/tutorial/request-forms-and-files.md
@@ -13,7 +13,7 @@
## `File` 및 `Form` 업로드
```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
## `File` 및 `Form` 매개변수 정의
@@ -21,7 +21,7 @@
`Body` 및 `Query`와 동일한 방식으로 파일과 폼의 매개변수를 생성합니다:
```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
```
파일과 폼 필드는 폼 데이터 형식으로 업로드되어 파일과 폼 필드로 전달됩니다.
diff --git a/docs/ko/docs/tutorial/response-model.md b/docs/ko/docs/tutorial/response-model.md
index fc74a60b3..74034e34d 100644
--- a/docs/ko/docs/tutorial/response-model.md
+++ b/docs/ko/docs/tutorial/response-model.md
@@ -9,7 +9,7 @@
* 기타.
```Python hl_lines="17"
-{!../../../docs_src/response_model/tutorial001.py!}
+{!../../docs_src/response_model/tutorial001.py!}
```
/// note | "참고"
@@ -42,13 +42,13 @@ FastAPI는 이 `response_model`를 사용하여:
여기서 우리는 평문 비밀번호를 포함하는 `UserIn` 모델을 선언합니다:
```Python hl_lines="9 11"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
```
그리고 이 모델을 사용하여 입력을 선언하고 같은 모델로 출력을 선언합니다:
```Python hl_lines="17-18"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
```
이제 브라우저가 비밀번호로 사용자를 만들 때마다 API는 응답으로 동일한 비밀번호를 반환합니다.
@@ -68,19 +68,19 @@ FastAPI는 이 `response_model`를 사용하여:
대신 평문 비밀번호로 입력 모델을 만들고 해당 비밀번호 없이 출력 모델을 만들 수 있습니다:
```Python hl_lines="9 11 16"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
여기서 *경로 작동 함수*가 비밀번호를 포함하는 동일한 입력 사용자를 반환할지라도:
```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
...`response_model`을 `UserOut` 모델로 선언했기 때문에 비밀번호를 포함하지 않습니다:
```Python hl_lines="22"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
```
따라서 **FastAPI**는 출력 모델에서 선언하지 않은 모든 데이터를 (Pydantic을 사용하여) 필터링합니다.
@@ -100,7 +100,7 @@ FastAPI는 이 `response_model`를 사용하여:
응답 모델은 아래와 같이 기본값을 가질 수 있습니다:
```Python hl_lines="11 13-14"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
```
* `description: Optional[str] = None`은 기본값으로 `None`을 갖습니다.
@@ -116,7 +116,7 @@ FastAPI는 이 `response_model`를 사용하여:
*경로 작동 데코레이터* 매개변수를 `response_model_exclude_unset=True`로 설정 할 수 있습니다:
```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
```
이러한 기본값은 응답에 포함되지 않고 실제로 설정된 값만 포함됩니다.
@@ -208,7 +208,7 @@ Pydantic 모델이 하나만 있고 출력에서 일부 데이터를 제
///
```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial005.py!}
+{!../../docs_src/response_model/tutorial005.py!}
```
/// tip | "팁"
@@ -224,7 +224,7 @@ Pydantic 모델이 하나만 있고 출력에서 일부 데이터를 제
`list` 또는 `tuple` 대신 `set`을 사용하는 법을 잊었더라도, FastAPI는 `set`으로 변환하고 정상적으로 작동합니다:
```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial006.py!}
+{!../../docs_src/response_model/tutorial006.py!}
```
## 요약
diff --git a/docs/ko/docs/tutorial/response-status-code.md b/docs/ko/docs/tutorial/response-status-code.md
index 48cb49cbf..57eef6ba1 100644
--- a/docs/ko/docs/tutorial/response-status-code.md
+++ b/docs/ko/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@
* 기타
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note | "참고"
@@ -77,7 +77,7 @@ HTTP는 세자리의 숫자 상태 코드를 응답의 일부로 전송합니다
상기 예시 참고:
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
`201` 은 "생성됨"를 의미하는 상태 코드입니다.
@@ -87,7 +87,7 @@ HTTP는 세자리의 숫자 상태 코드를 응답의 일부로 전송합니다
`fastapi.status` 의 편의 변수를 사용할 수 있습니다.
```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
```
이것은 단순히 작업을 편리하게 하기 위한 것으로, HTTP 상태 코드와 동일한 번호를 갖고있지만, 이를 사용하면 편집기의 자동완성 기능을 사용할 수 있습니다:
diff --git a/docs/ko/docs/tutorial/schema-extra-example.md b/docs/ko/docs/tutorial/schema-extra-example.md
index 7b5ccdd32..71052b334 100644
--- a/docs/ko/docs/tutorial/schema-extra-example.md
+++ b/docs/ko/docs/tutorial/schema-extra-example.md
@@ -11,7 +11,7 @@
//// tab | Python 3.10+ Pydantic v2
```Python hl_lines="13-24"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
```
////
@@ -19,7 +19,7 @@
//// tab | Python 3.10+ Pydantic v1
```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
```
////
@@ -27,7 +27,7 @@
//// tab | Python 3.8+ Pydantic v2
```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
```
////
@@ -35,7 +35,7 @@
//// tab | Python 3.8+ Pydantic v1
```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
```
////
@@ -83,7 +83,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.10+
```Python hl_lines="2 8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
```
////
@@ -91,7 +91,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.8+
```Python hl_lines="4 10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
```
////
@@ -117,7 +117,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.10+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
```
////
@@ -125,7 +125,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.9+
```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
```
////
@@ -133,7 +133,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.8+
```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
```
////
@@ -147,7 +147,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
```
////
@@ -161,7 +161,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
```
////
@@ -179,7 +179,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.10+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
```
////
@@ -187,7 +187,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.9+
```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
```
////
@@ -195,7 +195,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.8+
```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
```
////
@@ -209,7 +209,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
```
////
@@ -223,7 +223,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
```
////
@@ -270,7 +270,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.10+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
```
////
@@ -278,7 +278,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.9+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
```
////
@@ -286,7 +286,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
//// tab | Python 3.8+
```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
```
////
@@ -300,7 +300,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
```
////
@@ -314,7 +314,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
///
```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
```
////
diff --git a/docs/ko/docs/tutorial/security/get-current-user.md b/docs/ko/docs/tutorial/security/get-current-user.md
index 9bf3d4ee1..56f5792a7 100644
--- a/docs/ko/docs/tutorial/security/get-current-user.md
+++ b/docs/ko/docs/tutorial/security/get-current-user.md
@@ -3,7 +3,7 @@
이전 장에서 (의존성 주입 시스템을 기반으로 한)보안 시스템은 *경로 작동 함수*에서 `str`로 `token`을 제공했습니다:
```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
```
그러나 아직도 유용하지 않습니다.
@@ -19,7 +19,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.7 이상
```Python hl_lines="5 12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -27,7 +27,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.10 이상
```Python hl_lines="3 10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -45,7 +45,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.7 이상
```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -53,7 +53,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.10 이상
```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -65,7 +65,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.7 이상
```Python hl_lines="19-22 26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -73,7 +73,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.10 이상
```Python hl_lines="17-20 24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -85,7 +85,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.7 이상
```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -93,7 +93,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
//// tab | 파이썬 3.10 이상
```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
@@ -153,7 +153,7 @@ Pydantic 모델인 `User`로 `current_user`의 타입을 선언하는 것을 알
//// tab | 파이썬 3.7 이상
```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
```
////
@@ -161,7 +161,7 @@ Pydantic 모델인 `User`로 `current_user`의 타입을 선언하는 것을 알
//// tab | 파이썬 3.10 이상
```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
```
////
diff --git a/docs/ko/docs/tutorial/security/simple-oauth2.md b/docs/ko/docs/tutorial/security/simple-oauth2.md
index 9593f96f5..fd18c1d47 100644
--- a/docs/ko/docs/tutorial/security/simple-oauth2.md
+++ b/docs/ko/docs/tutorial/security/simple-oauth2.md
@@ -55,7 +55,7 @@ OAuth2의 경우 문자열일 뿐입니다.
//// tab | 파이썬 3.7 이상
```Python hl_lines="4 76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -63,7 +63,7 @@ OAuth2의 경우 문자열일 뿐입니다.
//// tab | 파이썬 3.10 이상
```Python hl_lines="2 74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -117,7 +117,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type`
//// tab | 파이썬 3.7 이상
```Python hl_lines="3 77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -125,7 +125,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type`
//// tab | 파이썬 3.10 이상
```Python hl_lines="1 75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -157,7 +157,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type`
//// tab | P파이썬 3.7 이상
```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -165,7 +165,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type`
//// tab | 파이썬 3.10 이상
```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -213,7 +213,7 @@ UserInDB(
//// tab | 파이썬 3.7 이상
```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -221,7 +221,7 @@ UserInDB(
//// tab | 파이썬 3.10 이상
```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
@@ -253,7 +253,7 @@ UserInDB(
//// tab | 파이썬 3.7 이상
```Python hl_lines="58-66 69-72 90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
```
////
@@ -261,7 +261,7 @@ UserInDB(
//// tab | 파이썬 3.10 이상
```Python hl_lines="55-64 67-70 88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
```
////
diff --git a/docs/ko/docs/tutorial/static-files.md b/docs/ko/docs/tutorial/static-files.md
index 360aaaa6b..90a60d193 100644
--- a/docs/ko/docs/tutorial/static-files.md
+++ b/docs/ko/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@
* 특정 경로에 `StaticFiles()` 인스턴스를 "마운트" 합니다.
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "기술적 세부사항"
diff --git a/docs/nl/docs/index.md b/docs/nl/docs/index.md
index 8edc3ba0c..d88bb7771 100644
--- a/docs/nl/docs/index.md
+++ b/docs/nl/docs/index.md
@@ -93,7 +93,7 @@ De belangrijkste kenmerken zijn:
"_Wat je hebt gebouwd ziet er echt super solide en gepolijst uit. In veel opzichten is het wat ik wilde dat **Hug** kon zijn - het is echt inspirerend om iemand dit te zien bouwen._"
-
+
---
diff --git a/docs/nl/docs/python-types.md b/docs/nl/docs/python-types.md
index a5562b795..00052037c 100644
--- a/docs/nl/docs/python-types.md
+++ b/docs/nl/docs/python-types.md
@@ -23,7 +23,7 @@ Als je een Python expert bent en alles al weet over type hints, sla dan dit hoof
Laten we beginnen met een eenvoudig voorbeeld:
```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
Het aanroepen van dit programma leidt tot het volgende resultaat:
@@ -40,7 +40,7 @@ De functie voert het volgende uit:
* Voeg samen met een spatie in het midden.
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### Bewerk het
@@ -84,7 +84,7 @@ Dat is alles.
Dat zijn de "type hints":
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
Dit is niet hetzelfde als het declareren van standaardwaarden zoals bij:
@@ -114,7 +114,7 @@ Nu kun je de opties bekijken en er doorheen scrollen totdat je de optie vindt di
Bekijk deze functie, deze heeft al type hints:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
Omdat de editor de types van de variabelen kent, krijgt u niet alleen aanvulling, maar ook controles op fouten:
@@ -124,7 +124,7 @@ Omdat de editor de types van de variabelen kent, krijgt u niet alleen aanvulling
Nu weet je hoe je het moet oplossen, converteer `age` naar een string met `str(age)`:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## Types declareren
@@ -145,7 +145,7 @@ Je kunt bijvoorbeeld het volgende gebruiken:
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### Generieke types met typeparameters
@@ -183,7 +183,7 @@ Als type, vul `list` in.
Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vierkante haakjes:
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
```
////
@@ -193,7 +193,7 @@ Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vie
Van `typing`, importeer `List` (met een hoofdletter `L`):
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
Declareer de variabele met dezelfde dubbele punt (`:`) syntax.
@@ -203,7 +203,7 @@ Zet als type de `List` die je hebt geïmporteerd uit `typing`.
Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vierkante haakjes:
```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
////
@@ -241,7 +241,7 @@ Je kunt hetzelfde doen om `tuple`s en `set`s te declareren:
//// tab | Python 3.9+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
```
////
@@ -249,7 +249,7 @@ Je kunt hetzelfde doen om `tuple`s en `set`s te declareren:
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
```
////
@@ -270,7 +270,7 @@ De tweede typeparameter is voor de waarden (values) van het `dict`:
//// tab | Python 3.9+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
```
////
@@ -278,7 +278,7 @@ De tweede typeparameter is voor de waarden (values) van het `dict`:
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
```
////
@@ -300,7 +300,7 @@ In Python 3.10 is er ook een **nieuwe syntax** waarin je de mogelijke types kunt
//// tab | Python 3.10+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
```
////
@@ -308,7 +308,7 @@ In Python 3.10 is er ook een **nieuwe syntax** waarin je de mogelijke types kunt
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
```
////
@@ -322,7 +322,7 @@ Je kunt declareren dat een waarde een type kan hebben, zoals `str`, maar dat het
In Python 3.6 en hoger (inclusief Python 3.10) kun je het declareren door `Optional` te importeren en te gebruiken vanuit de `typing`-module.
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
Door `Optional[str]` te gebruiken in plaats van alleen `str`, kan de editor je helpen fouten te detecteren waarbij je ervan uit zou kunnen gaan dat een waarde altijd een `str` is, terwijl het in werkelijkheid ook `None` zou kunnen zijn.
@@ -334,7 +334,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
//// tab | Python 3.10+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
```
////
@@ -342,7 +342,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
```
////
@@ -350,7 +350,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
//// tab | Python 3.8+ alternative
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
```
////
@@ -371,7 +371,7 @@ Het gaat alleen om de woorden en naamgeving. Maar die naamgeving kan invloed heb
Laten we als voorbeeld deze functie nemen:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
```
De parameter `name` is gedefinieerd als `Optional[str]`, maar is **niet optioneel**, je kunt de functie niet aanroepen zonder de parameter:
@@ -389,7 +389,7 @@ say_hi(name=None) # Dit werkt, None is geldig 🎉
Het goede nieuws is dat als je eenmaal Python 3.10 gebruikt, je je daar geen zorgen meer over hoeft te maken, omdat je dan gewoon `|` kunt gebruiken om unions van types te definiëren:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
```
Dan hoef je je geen zorgen te maken over namen als `Optional` en `Union`. 😎
@@ -453,13 +453,13 @@ Je kunt een klasse ook declareren als het type van een variabele.
Stel dat je een klasse `Person` hebt, met een naam:
```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Vervolgens kun je een variabele van het type `Persoon` declareren:
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Dan krijg je ook nog eens volledige editorondersteuning:
@@ -487,7 +487,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
//// tab | Python 3.10+
```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
```
////
@@ -495,7 +495,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
```
////
@@ -503,7 +503,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
```
////
@@ -533,7 +533,7 @@ Python heeft ook een functie waarmee je **extra ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
```
////
@@ -545,7 +545,7 @@ In versies lager dan Python 3.9 importeer je `Annotated` vanuit `typing_extensio
Het wordt al geïnstalleerd met **FastAPI**.
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
```
////
diff --git a/docs/pl/docs/index.md b/docs/pl/docs/index.md
index e591e1c9d..9a96c6553 100644
--- a/docs/pl/docs/index.md
+++ b/docs/pl/docs/index.md
@@ -90,7 +90,7 @@ Kluczowe cechy:
"_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._"
-
+
---
diff --git a/docs/pl/docs/tutorial/first-steps.md b/docs/pl/docs/tutorial/first-steps.md
index 8f1b9b922..99c425f12 100644
--- a/docs/pl/docs/tutorial/first-steps.md
+++ b/docs/pl/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
Najprostszy plik FastAPI może wyglądać tak:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Skopiuj to do pliku `main.py`.
@@ -134,7 +134,7 @@ Możesz go również użyć do automatycznego generowania kodu dla klientów, kt
### Krok 1: zaimportuj `FastAPI`
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI` jest klasą, która zapewnia wszystkie funkcjonalności Twojego API.
@@ -150,7 +150,7 @@ Oznacza to, że możesz korzystać ze wszystkich funkcjonalności ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
```
////
@@ -25,7 +25,7 @@ Para conseguir isso, importe `JSONResponse` e retorne o seu conteúdo diretament
//// tab | Python 3.9+
```Python hl_lines="4 25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
```
////
@@ -33,7 +33,7 @@ Para conseguir isso, importe `JSONResponse` e retorne o seu conteúdo diretament
//// tab | Python 3.8+
```Python hl_lines="4 26"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an.py!}
```
////
@@ -47,7 +47,7 @@ Faça uso da versão `Annotated` quando possível.
///
```Python hl_lines="2 23"
-{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!}
```
////
@@ -61,7 +61,7 @@ Faça uso da versão `Annotated` quando possível.
///
```Python hl_lines="4 25"
-{!> ../../../docs_src/additional_status_codes/tutorial001.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001.py!}
```
////
diff --git a/docs/pt/docs/advanced/advanced-dependencies.md b/docs/pt/docs/advanced/advanced-dependencies.md
index 5a7b921b2..a656390a4 100644
--- a/docs/pt/docs/advanced/advanced-dependencies.md
+++ b/docs/pt/docs/advanced/advanced-dependencies.md
@@ -21,7 +21,7 @@ Para fazer isso, nós declaramos o método `__call__`:
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -29,7 +29,7 @@ Para fazer isso, nós declaramos o método `__call__`:
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -43,7 +43,7 @@ Prefira utilizar a versão `Annotated` se possível.
///
```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -57,7 +57,7 @@ E agora, nós podemos utilizar o `__init__` para declarar os parâmetros da inst
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -65,7 +65,7 @@ E agora, nós podemos utilizar o `__init__` para declarar os parâmetros da inst
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -79,7 +79,7 @@ Prefira utilizar a versão `Annotated` se possível.
///
```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -93,7 +93,7 @@ Nós poderíamos criar uma instância desta classe com:
//// tab | Python 3.9+
```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -101,7 +101,7 @@ Nós poderíamos criar uma instância desta classe com:
//// tab | Python 3.8+
```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -115,7 +115,7 @@ Prefira utilizar a versão `Annotated` se possível.
///
```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
@@ -137,7 +137,7 @@ checker(q="somequery")
//// tab | Python 3.9+
```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
```
////
@@ -145,7 +145,7 @@ checker(q="somequery")
//// tab | Python 3.8+
```Python hl_lines="21"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
```
////
@@ -159,7 +159,7 @@ Prefira utilizar a versão `Annotated` se possível.
///
```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
```
////
diff --git a/docs/pt/docs/advanced/async-tests.md b/docs/pt/docs/advanced/async-tests.md
index 7cac26262..c81d6124b 100644
--- a/docs/pt/docs/advanced/async-tests.md
+++ b/docs/pt/docs/advanced/async-tests.md
@@ -33,13 +33,13 @@ Para um exemplos simples, vamos considerar uma estrutura de arquivos semelhante
O arquivo `main.py` teria:
```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
```
O arquivo `test_main.py` teria os testes para para o arquivo `main.py`, ele poderia ficar assim:
```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
## Executá-lo
@@ -61,7 +61,7 @@ $ pytest
O marcador `@pytest.mark.anyio` informa ao pytest que esta função de teste deve ser invocada de maneira assíncrona:
```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
/// tip | "Dica"
@@ -73,7 +73,7 @@ Note que a função de teste é `async def` agora, no lugar de apenas `def` como
Então podemos criar um `AsyncClient` com a aplicação, e enviar requisições assíncronas para ela utilizando `await`.
```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
```
Isso é equivalente a:
diff --git a/docs/pt/docs/advanced/behind-a-proxy.md b/docs/pt/docs/advanced/behind-a-proxy.md
index 2dfc5ca25..3c65b5a0a 100644
--- a/docs/pt/docs/advanced/behind-a-proxy.md
+++ b/docs/pt/docs/advanced/behind-a-proxy.md
@@ -19,7 +19,7 @@ Nesse caso, o caminho original `/app` seria servido em `/api/v1/app`.
Embora todo o seu código esteja escrito assumindo que existe apenas `/app`.
```Python hl_lines="6"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
```
E o proxy estaria **"removendo"** o **prefixo do caminho** dinamicamente antes de transmitir a solicitação para o servidor da aplicação (provavelmente Uvicorn via CLI do FastAPI), mantendo sua aplicação convencida de que está sendo servida em `/app`, para que você não precise atualizar todo o seu código para incluir o prefixo `/api/v1`.
@@ -99,7 +99,7 @@ Você pode obter o `root_path` atual usado pela sua aplicação para cada solici
Aqui estamos incluindo ele na mensagem apenas para fins de demonstração.
```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
```
Então, se você iniciar o Uvicorn com:
@@ -128,7 +128,7 @@ A resposta seria algo como:
Alternativamente, se você não tiver uma maneira de fornecer uma opção de linha de comando como `--root-path` ou equivalente, você pode definir o parâmetro `--root-path` ao criar sua aplicação FastAPI:
```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
```
Passar o `root_path`h para `FastAPI` seria o equivalente a passar a opção de linha de comando `--root-path` para Uvicorn ou Hypercorn.
@@ -310,7 +310,7 @@ Se você passar uma lista personalizada de `servers` e houver um `root_path` (po
Por exemplo:
```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
```
Gerará um OpenAPI schema como:
@@ -359,7 +359,7 @@ A interface de documentação interagirá com o servidor que você selecionar.
Se você não quiser que o **FastAPI** inclua um servidor automático usando o `root_path`, você pode usar o parâmetro `root_path_in_servers=False`:
```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
```
e então ele não será incluído no OpenAPI schema.
diff --git a/docs/pt/docs/advanced/dataclasses.md b/docs/pt/docs/advanced/dataclasses.md
new file mode 100644
index 000000000..af603ada7
--- /dev/null
+++ b/docs/pt/docs/advanced/dataclasses.md
@@ -0,0 +1,101 @@
+# Usando Dataclasses
+
+FastAPI é construído em cima do **Pydantic**, e eu tenho mostrado como usar modelos Pydantic para declarar requisições e respostas.
+
+Mas o FastAPI também suporta o uso de `dataclasses` da mesma forma:
+
+```Python hl_lines="1 7-12 19-20"
+{!../../docs_src/dataclasses/tutorial001.py!}
+```
+
+Isso ainda é suportado graças ao **Pydantic**, pois ele tem suporte interno para `dataclasses`.
+
+Então, mesmo com o código acima que não usa Pydantic explicitamente, o FastAPI está usando Pydantic para converter essas dataclasses padrão para a versão do Pydantic.
+
+E claro, ele suporta o mesmo:
+
+* validação de dados
+* serialização de dados
+* documentação de dados, etc.
+
+Isso funciona da mesma forma que com os modelos Pydantic. E na verdade é alcançado da mesma maneira por baixo dos panos, usando Pydantic.
+
+/// info | Informação
+
+Lembre-se de que dataclasses não podem fazer tudo o que os modelos Pydantic podem fazer.
+
+Então, você ainda pode precisar usar modelos Pydantic.
+
+Mas se você tem um monte de dataclasses por aí, este é um truque legal para usá-las para alimentar uma API web usando FastAPI. 🤓
+
+///
+
+## Dataclasses em `response_model`
+
+Você também pode usar `dataclasses` no parâmetro `response_model`:
+
+```Python hl_lines="1 7-13 19"
+{!../../docs_src/dataclasses/tutorial002.py!}
+```
+
+A dataclass será automaticamente convertida para uma dataclass Pydantic.
+
+Dessa forma, seu esquema aparecerá na interface de documentação da API:
+
+kwargs
. Mesmo que eles não possuam um valor padrão.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
## Validações numéricas: maior que ou igual
@@ -93,7 +93,7 @@ Com `Query` e `Path` (e outras que você verá mais tarde) você pode declarar r
Aqui, com `ge=1`, `item_id` precisará ser um número inteiro maior que ("`g`reater than") ou igual ("`e`qual") a 1.
```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
## Validações numéricas: maior que e menor que ou igual
@@ -104,7 +104,7 @@ O mesmo se aplica para:
* `le`: menor que ou igual (`l`ess than or `e`qual)
```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
## Validações numéricas: valores do tipo float, maior que e menor que
@@ -118,7 +118,7 @@ Assim, `0.5` seria um valor válido. Mas `0.0` ou `0` não seria.
E o mesmo para lt
.
```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
## Recapitulando
diff --git a/docs/pt/docs/tutorial/path-params.md b/docs/pt/docs/tutorial/path-params.md
index fb872e4f5..a68354a1b 100644
--- a/docs/pt/docs/tutorial/path-params.md
+++ b/docs/pt/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
Você pode declarar os "parâmetros" ou "variáveis" com a mesma sintaxe utilizada pelo formato de strings do Python:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
O valor do parâmetro que foi passado à `item_id` será passado para a sua função como o argumento `item_id`.
@@ -19,7 +19,7 @@ Então, se você rodar este exemplo e for até ../../docs_src/query_param_models/tutorial001_an_py310.py!}
+```
+
+////
+
+//// tab | Python 3.9+
+
+```Python hl_lines="8-12 16"
+{!> ../../docs_src/query_param_models/tutorial001_an_py39.py!}
+```
+
+////
+
+//// tab | Python 3.8+
+
+```Python hl_lines="10-14 18"
+{!> ../../docs_src/query_param_models/tutorial001_an.py!}
+```
+
+////
+
+//// tab | Python 3.10+ non-Annotated
+
+/// tip | Dica
+
+Prefira utilizar a versão `Annotated` se possível.
+
+///
+
+```Python hl_lines="9-13 17"
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
+```
+
+////
+
+//// tab | Python 3.9+ non-Annotated
+
+/// tip | Dica
+
+Prefira utilizar a versão `Annotated` se possível.
+
+///
+
+```Python hl_lines="8-12 16"
+{!> ../../docs_src/query_param_models/tutorial001_py39.py!}
+```
+
+////
+
+//// tab | Python 3.8+ non-Annotated
+
+/// tip | Dica
+
+Prefira utilizar a versão `Annotated` se possível.
+
+///
+
+```Python hl_lines="9-13 17"
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
+```
+
+////
+
+O **FastAPI** **extrairá** os dados para **cada campo** dos **parâmetros de consulta** presentes na requisição, e fornecerá o modelo Pydantic que você definiu.
+
+
+## Verifique os Documentos
+
+Você pode ver os parâmetros de consulta nos documentos de IU em `/docs`:
+
+kwargs
, даже если у них нет значений по умолчанию.
```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
```
### Лучше с `Annotated`
@@ -224,7 +224,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
```
////
@@ -232,7 +232,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
```
////
@@ -246,7 +246,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
```
////
@@ -254,7 +254,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
```
////
@@ -268,7 +268,7 @@ Python не будет ничего делать с `*`, но он будет з
///
```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
```
////
@@ -283,7 +283,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
```
////
@@ -291,7 +291,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
```
////
@@ -305,7 +305,7 @@ Python не будет ничего делать с `*`, но он будет з
///
```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
```
////
@@ -323,7 +323,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.9+
```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
```
////
@@ -331,7 +331,7 @@ Python не будет ничего делать с `*`, но он будет з
//// tab | Python 3.8+
```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
```
////
@@ -345,7 +345,7 @@ Python не будет ничего делать с `*`, но он будет з
///
```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
```
////
diff --git a/docs/ru/docs/tutorial/path-params.md b/docs/ru/docs/tutorial/path-params.md
index dc3d64af4..d1d76cf7b 100644
--- a/docs/ru/docs/tutorial/path-params.md
+++ b/docs/ru/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
Вы можете определить "параметры" или "переменные" пути, используя синтаксис форматированных строк Python:
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
Значение параметра пути `item_id` будет передано в функцию в качестве аргумента `item_id`.
@@ -19,7 +19,7 @@
Вы можете объявить тип параметра пути в функции, используя стандартные аннотации типов Python.
```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
```
Здесь, `item_id` объявлен типом `int`.
@@ -123,7 +123,7 @@
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
```
Иначе путь для `/users/{user_id}` также будет соответствовать `/users/me`, "подразумевая", что он получает параметр `user_id` со значением `"me"`.
@@ -131,7 +131,7 @@
Аналогично, вы не можете переопределить операцию с путем:
```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
```
Первый будет выполняться всегда, так как путь совпадает первым.
@@ -149,7 +149,7 @@
Затем создайте атрибуты класса с фиксированными допустимыми значениями:
```Python hl_lines="1 6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// info | "Дополнительная информация"
@@ -169,7 +169,7 @@
Определите *параметр пути*, используя в аннотации типа класс перечисления (`ModelName`), созданный ранее:
```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
### Проверьте документацию
@@ -187,7 +187,7 @@
Вы можете сравнить это значение с *элементом перечисления* класса `ModelName`:
```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
#### Получение *значения перечисления*
@@ -195,7 +195,7 @@
Можно получить фактическое значение (в данном случае - `str`) с помощью `model_name.value` или в общем случае `your_enum_member.value`:
```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
/// tip | "Подсказка"
@@ -211,7 +211,7 @@
Они будут преобразованы в соответствующие значения (в данном случае - строки) перед их возвратом клиенту:
```Python hl_lines="18 21 23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
```
Вы отправите клиенту такой JSON-ответ:
@@ -251,7 +251,7 @@ OpenAPI не поддерживает способов объявления *п
Можете использовать так:
```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
```
/// tip | "Подсказка"
diff --git a/docs/ru/docs/tutorial/query-params-str-validations.md b/docs/ru/docs/tutorial/query-params-str-validations.md
index e6653a837..0054af6ed 100644
--- a/docs/ru/docs/tutorial/query-params-str-validations.md
+++ b/docs/ru/docs/tutorial/query-params-str-validations.md
@@ -7,7 +7,7 @@
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
```
////
@@ -15,7 +15,7 @@
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
```
////
@@ -46,7 +46,7 @@ FastAPI определит параметр `q` как необязательн
В Python 3.9 или выше, `Annotated` является частью стандартной библиотеки, таким образом вы можете импортировать его из `typing`.
```Python hl_lines="1 3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -58,7 +58,7 @@ FastAPI определит параметр `q` как необязательн
Эта библиотека будет установлена вместе с FastAPI.
```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -116,7 +116,7 @@ q: Annotated[Union[str, None]] = None
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
```
////
@@ -124,7 +124,7 @@ q: Annotated[Union[str, None]] = None
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
```
////
@@ -154,7 +154,7 @@ q: Annotated[Union[str, None]] = None
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
```
////
@@ -162,7 +162,7 @@ q: Annotated[Union[str, None]] = None
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
```
////
@@ -268,7 +268,7 @@ q: str = Query(default="rick")
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
```
////
@@ -276,7 +276,7 @@ q: str = Query(default="rick")
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
```
////
@@ -284,7 +284,7 @@ q: str = Query(default="rick")
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
```
////
@@ -298,7 +298,7 @@ q: str = Query(default="rick")
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
```
////
@@ -312,7 +312,7 @@ q: str = Query(default="rick")
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
```
////
@@ -324,7 +324,7 @@ q: str = Query(default="rick")
//// tab | Python 3.10+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
```
////
@@ -332,7 +332,7 @@ q: str = Query(default="rick")
//// tab | Python 3.9+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
```
////
@@ -340,7 +340,7 @@ q: str = Query(default="rick")
//// tab | Python 3.8+
```Python hl_lines="12"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
```
////
@@ -354,7 +354,7 @@ q: str = Query(default="rick")
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
```
////
@@ -368,7 +368,7 @@ q: str = Query(default="rick")
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
```
////
@@ -392,7 +392,7 @@ q: str = Query(default="rick")
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
```
////
@@ -400,7 +400,7 @@ q: str = Query(default="rick")
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
```
////
@@ -414,7 +414,7 @@ q: str = Query(default="rick")
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
```
////
@@ -462,7 +462,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
```
////
@@ -470,7 +470,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
```
////
@@ -484,7 +484,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
```
/// tip | "Подсказка"
@@ -504,7 +504,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
```
////
@@ -512,7 +512,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
```
////
@@ -526,7 +526,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
```
////
@@ -550,7 +550,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
```
////
@@ -558,7 +558,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
```
////
@@ -566,7 +566,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
```
////
@@ -580,7 +580,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
```
////
@@ -594,7 +594,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
```
////
@@ -612,7 +612,7 @@ Pydantic, мощь которого используется в FastAPI для
//// tab | Python 3.9+
```Python hl_lines="4 10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d_an_py39.py!}
```
////
@@ -620,7 +620,7 @@ Pydantic, мощь которого используется в FastAPI для
//// tab | Python 3.8+
```Python hl_lines="2 9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d_an.py!}
```
////
@@ -634,7 +634,7 @@ Pydantic, мощь которого используется в FastAPI для
///
```Python hl_lines="2 8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d.py!}
```
////
@@ -654,7 +654,7 @@ Pydantic, мощь которого используется в FastAPI для
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
```
////
@@ -662,7 +662,7 @@ Pydantic, мощь которого используется в FastAPI для
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
```
////
@@ -670,7 +670,7 @@ Pydantic, мощь которого используется в FastAPI для
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
```
////
@@ -684,7 +684,7 @@ Pydantic, мощь которого используется в FastAPI для
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
```
////
@@ -698,7 +698,7 @@ Pydantic, мощь которого используется в FastAPI для
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
```
////
@@ -712,7 +712,7 @@ Pydantic, мощь которого используется в FastAPI для
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
```
////
@@ -753,7 +753,7 @@ http://localhost:8000/items/?q=foo&q=bar
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
```
////
@@ -761,7 +761,7 @@ http://localhost:8000/items/?q=foo&q=bar
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
```
////
@@ -775,7 +775,7 @@ http://localhost:8000/items/?q=foo&q=bar
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
```
////
@@ -789,7 +789,7 @@ http://localhost:8000/items/?q=foo&q=bar
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
```
////
@@ -818,7 +818,7 @@ http://localhost:8000/items/
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
```
////
@@ -826,7 +826,7 @@ http://localhost:8000/items/
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
```
////
@@ -840,7 +840,7 @@ http://localhost:8000/items/
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
```
////
@@ -872,7 +872,7 @@ http://localhost:8000/items/
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
```
////
@@ -880,7 +880,7 @@ http://localhost:8000/items/
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
```
////
@@ -888,7 +888,7 @@ http://localhost:8000/items/
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
```
////
@@ -902,7 +902,7 @@ http://localhost:8000/items/
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
```
////
@@ -916,7 +916,7 @@ http://localhost:8000/items/
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
```
////
@@ -926,7 +926,7 @@ http://localhost:8000/items/
//// tab | Python 3.10+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
```
////
@@ -934,7 +934,7 @@ http://localhost:8000/items/
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
```
////
@@ -942,7 +942,7 @@ http://localhost:8000/items/
//// tab | Python 3.8+
```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
```
////
@@ -956,7 +956,7 @@ http://localhost:8000/items/
///
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
```
////
@@ -970,7 +970,7 @@ http://localhost:8000/items/
///
```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
```
////
@@ -996,7 +996,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
```
////
@@ -1004,7 +1004,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
```
////
@@ -1012,7 +1012,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
```
////
@@ -1026,7 +1026,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
```
////
@@ -1040,7 +1040,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
```
////
@@ -1056,7 +1056,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.10+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
```
////
@@ -1064,7 +1064,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.9+
```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
```
////
@@ -1072,7 +1072,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.8+
```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
```
////
@@ -1086,7 +1086,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
```
////
@@ -1100,7 +1100,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
```
////
@@ -1116,7 +1116,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.10+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
```
////
@@ -1124,7 +1124,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.9+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
```
////
@@ -1132,7 +1132,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
```
////
@@ -1146,7 +1146,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
```
////
@@ -1160,7 +1160,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
///
```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
```
////
diff --git a/docs/ru/docs/tutorial/query-params.md b/docs/ru/docs/tutorial/query-params.md
index 061f9be04..edf06746b 100644
--- a/docs/ru/docs/tutorial/query-params.md
+++ b/docs/ru/docs/tutorial/query-params.md
@@ -3,7 +3,7 @@
Когда вы объявляете параметры функции, которые не являются параметрами пути, они автоматически интерпретируются как "query"-параметры.
```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
```
Query-параметры представляют из себя набор пар ключ-значение, которые идут после знака `?` в URL-адресе, разделенные символами `&`.
@@ -66,7 +66,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
```
////
@@ -74,7 +74,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
```
////
@@ -94,7 +94,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
```
////
@@ -102,7 +102,7 @@ http://127.0.0.1:8000/items/?skip=20
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
```
////
@@ -151,7 +151,7 @@ http://127.0.0.1:8000/items/foo?short=yes
//// tab | Python 3.10+
```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
```
////
@@ -159,7 +159,7 @@ http://127.0.0.1:8000/items/foo?short=yes
//// tab | Python 3.8+
```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
```
////
@@ -173,7 +173,7 @@ http://127.0.0.1:8000/items/foo?short=yes
Но если вы хотите сделать query-параметр обязательным, вы можете просто не указывать значение по умолчанию:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
Здесь параметр запроса `needy` является обязательным параметром с типом данных `str`.
@@ -221,7 +221,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
//// tab | Python 3.10+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
```
////
@@ -229,7 +229,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
```
////
diff --git a/docs/ru/docs/tutorial/request-files.md b/docs/ru/docs/tutorial/request-files.md
index 1fbc4acc0..34b9c94fa 100644
--- a/docs/ru/docs/tutorial/request-files.md
+++ b/docs/ru/docs/tutorial/request-files.md
@@ -19,7 +19,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -27,7 +27,7 @@
//// tab | Python 3.6+
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -41,7 +41,7 @@
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -53,7 +53,7 @@
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -61,7 +61,7 @@
//// tab | Python 3.6+
```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -75,7 +75,7 @@
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -109,7 +109,7 @@
//// tab | Python 3.9+
```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
```
////
@@ -117,7 +117,7 @@
//// tab | Python 3.6+
```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
```
////
@@ -131,7 +131,7 @@
///
```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
```
////
@@ -220,7 +220,7 @@ contents = myfile.file.read()
//// tab | Python 3.10+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
```
////
@@ -228,7 +228,7 @@ contents = myfile.file.read()
//// tab | Python 3.9+
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
```
////
@@ -236,7 +236,7 @@ contents = myfile.file.read()
//// tab | Python 3.6+
```Python hl_lines="10 18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
```
////
@@ -250,7 +250,7 @@ contents = myfile.file.read()
///
```Python hl_lines="7 15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
```
////
@@ -264,7 +264,7 @@ contents = myfile.file.read()
///
```Python hl_lines="9 17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
```
////
@@ -276,7 +276,7 @@ contents = myfile.file.read()
//// tab | Python 3.9+
```Python hl_lines="9 15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
```
////
@@ -284,7 +284,7 @@ contents = myfile.file.read()
//// tab | Python 3.6+
```Python hl_lines="8 14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
```
////
@@ -298,7 +298,7 @@ contents = myfile.file.read()
///
```Python hl_lines="7 13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
```
////
@@ -314,7 +314,7 @@ contents = myfile.file.read()
//// tab | Python 3.9+
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
```
////
@@ -322,7 +322,7 @@ contents = myfile.file.read()
//// tab | Python 3.6+
```Python hl_lines="11 16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
```
////
@@ -336,7 +336,7 @@ contents = myfile.file.read()
///
```Python hl_lines="8 13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
```
////
@@ -350,7 +350,7 @@ contents = myfile.file.read()
///
```Python hl_lines="10 15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
```
////
@@ -372,7 +372,7 @@ contents = myfile.file.read()
//// tab | Python 3.9+
```Python hl_lines="11 18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
```
////
@@ -380,7 +380,7 @@ contents = myfile.file.read()
//// tab | Python 3.6+
```Python hl_lines="12 19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
```
////
@@ -394,7 +394,7 @@ contents = myfile.file.read()
///
```Python hl_lines="9 16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
```
////
@@ -408,7 +408,7 @@ contents = myfile.file.read()
///
```Python hl_lines="11 18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
```
////
diff --git a/docs/ru/docs/tutorial/request-forms-and-files.md b/docs/ru/docs/tutorial/request-forms-and-files.md
index b38962866..9b449bcd9 100644
--- a/docs/ru/docs/tutorial/request-forms-and-files.md
+++ b/docs/ru/docs/tutorial/request-forms-and-files.md
@@ -15,7 +15,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -23,7 +23,7 @@
//// tab | Python 3.6+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -37,7 +37,7 @@
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
@@ -49,7 +49,7 @@
//// tab | Python 3.9+
```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
```
////
@@ -57,7 +57,7 @@
//// tab | Python 3.6+
```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
```
////
@@ -71,7 +71,7 @@
///
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
```
////
diff --git a/docs/ru/docs/tutorial/request-forms.md b/docs/ru/docs/tutorial/request-forms.md
index 3737f1347..93b44437b 100644
--- a/docs/ru/docs/tutorial/request-forms.md
+++ b/docs/ru/docs/tutorial/request-forms.md
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
@@ -51,7 +51,7 @@
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -59,7 +59,7 @@
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -73,7 +73,7 @@
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
diff --git a/docs/ru/docs/tutorial/response-model.md b/docs/ru/docs/tutorial/response-model.md
index f8c910fe9..363e64676 100644
--- a/docs/ru/docs/tutorial/response-model.md
+++ b/docs/ru/docs/tutorial/response-model.md
@@ -7,7 +7,7 @@ FastAPI позволяет использовать **аннотации тип
//// tab | Python 3.10+
```Python hl_lines="16 21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
```
////
@@ -15,7 +15,7 @@ FastAPI позволяет использовать **аннотации тип
//// tab | Python 3.9+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
```
////
@@ -23,7 +23,7 @@ FastAPI позволяет использовать **аннотации тип
//// tab | Python 3.8+
```Python hl_lines="18 23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
```
////
@@ -62,7 +62,7 @@ FastAPI будет использовать этот возвращаемый т
//// tab | Python 3.10+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
```
////
@@ -70,7 +70,7 @@ FastAPI будет использовать этот возвращаемый т
//// tab | Python 3.9+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
```
////
@@ -78,7 +78,7 @@ FastAPI будет использовать этот возвращаемый т
//// tab | Python 3.8+
```Python hl_lines="17 22 24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
```
////
@@ -116,7 +116,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="7 9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -124,7 +124,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="9 11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -142,7 +142,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
```
////
@@ -150,7 +150,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
```
////
@@ -174,7 +174,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -182,7 +182,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="9 11 16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -192,7 +192,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -200,7 +200,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -210,7 +210,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
```
////
@@ -218,7 +218,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
```
////
@@ -248,7 +248,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.10+
```Python hl_lines="7-10 13-14 18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
```
////
@@ -256,7 +256,7 @@ FastAPI будет использовать значение `response_model` д
//// tab | Python 3.8+
```Python hl_lines="9-13 15-16 20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
```
////
@@ -302,7 +302,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
Самый частый сценарий использования - это [возвращать Response напрямую, как описано в расширенной документации](../advanced/response-directly.md){.internal-link target=_blank}.
```Python hl_lines="8 10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
```
Это поддерживается FastAPI по-умолчанию, т.к. аннотация проставлена в классе (или подклассе) `Response`.
@@ -314,7 +314,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
Вы также можете указать подкласс `Response` в аннотации типа:
```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
```
Это сработает, потому что `RedirectResponse` является подклассом `Response` и FastAPI автоматически обработает этот простейший случай.
@@ -328,7 +328,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.10+
```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
```
////
@@ -336,7 +336,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
```
////
@@ -354,7 +354,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
```
////
@@ -362,7 +362,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
```
////
@@ -376,7 +376,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.10+
```Python hl_lines="9 11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -384,7 +384,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.9+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -392,7 +392,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.8+
```Python hl_lines="11 13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -412,7 +412,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.10+
```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
```
////
@@ -420,7 +420,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.9+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
```
////
@@ -428,7 +428,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
//// tab | Python 3.8+
```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
```
////
@@ -523,7 +523,7 @@ FastAPI достаточно умен (на самом деле, это засл
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
```
////
@@ -531,7 +531,7 @@ FastAPI достаточно умен (на самом деле, это засл
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
```
////
@@ -551,7 +551,7 @@ FastAPI достаточно умен (на самом деле, это засл
//// tab | Python 3.10+
```Python hl_lines="29 35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
```
////
@@ -559,7 +559,7 @@ FastAPI достаточно умен (на самом деле, это засл
//// tab | Python 3.8+
```Python hl_lines="31 37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
```
////
diff --git a/docs/ru/docs/tutorial/response-status-code.md b/docs/ru/docs/tutorial/response-status-code.md
index a36c42d05..48808bea7 100644
--- a/docs/ru/docs/tutorial/response-status-code.md
+++ b/docs/ru/docs/tutorial/response-status-code.md
@@ -9,7 +9,7 @@
* и других.
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
/// note | "Примечание"
@@ -77,7 +77,7 @@ FastAPI знает об этом и создаст документацию Open
Рассмотрим предыдущий пример еще раз:
```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
```
`201` – это код статуса "Создано".
@@ -87,7 +87,7 @@ FastAPI знает об этом и создаст документацию Open
Для удобства вы можете использовать переменные из `fastapi.status`.
```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
```
Они содержат те же числовые значения, но позволяют использовать подсказки редактора для выбора кода статуса:
diff --git a/docs/ru/docs/tutorial/schema-extra-example.md b/docs/ru/docs/tutorial/schema-extra-example.md
index 1b216de3a..daa264afc 100644
--- a/docs/ru/docs/tutorial/schema-extra-example.md
+++ b/docs/ru/docs/tutorial/schema-extra-example.md
@@ -11,7 +11,7 @@
//// tab | Python 3.10+
```Python hl_lines="13-21"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
```
////
@@ -19,7 +19,7 @@
//// tab | Python 3.8+
```Python hl_lines="15-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
```
////
@@ -43,7 +43,7 @@
//// tab | Python 3.10+
```Python hl_lines="2 8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
```
////
@@ -51,7 +51,7 @@
//// tab | Python 3.8+
```Python hl_lines="4 10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
```
////
@@ -83,7 +83,7 @@
//// tab | Python 3.10+
```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
```
////
@@ -91,7 +91,7 @@
//// tab | Python 3.9+
```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
```
////
@@ -99,7 +99,7 @@
//// tab | Python 3.8+
```Python hl_lines="23-28"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
```
////
@@ -113,7 +113,7 @@
///
```Python hl_lines="18-23"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
```
////
@@ -127,7 +127,7 @@
///
```Python hl_lines="20-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
```
////
@@ -154,7 +154,7 @@
//// tab | Python 3.10+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
```
////
@@ -162,7 +162,7 @@
//// tab | Python 3.9+
```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
```
////
@@ -170,7 +170,7 @@
//// tab | Python 3.8+
```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
```
////
@@ -184,7 +184,7 @@
///
```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
```
////
@@ -198,7 +198,7 @@
///
```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
```
////
diff --git a/docs/ru/docs/tutorial/security/first-steps.md b/docs/ru/docs/tutorial/security/first-steps.md
index 444a06915..c98ce2c60 100644
--- a/docs/ru/docs/tutorial/security/first-steps.md
+++ b/docs/ru/docs/tutorial/security/first-steps.md
@@ -23,7 +23,7 @@
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -31,7 +31,7 @@
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -45,7 +45,7 @@
///
```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -155,7 +155,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
//// tab | Python 3.9+
```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -163,7 +163,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
//// tab | Python 3.8+
```Python hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -177,7 +177,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
///
```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
@@ -221,7 +221,7 @@ oauth2_scheme(some, parameters)
//// tab | Python 3.9+
```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
```
////
@@ -229,7 +229,7 @@ oauth2_scheme(some, parameters)
//// tab | Python 3.8+
```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
```
////
@@ -243,7 +243,7 @@ oauth2_scheme(some, parameters)
///
```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
```
////
diff --git a/docs/ru/docs/tutorial/static-files.md b/docs/ru/docs/tutorial/static-files.md
index ccddae249..4734554f3 100644
--- a/docs/ru/docs/tutorial/static-files.md
+++ b/docs/ru/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@
* "Примонтируйте" экземпляр `StaticFiles()` с указанием определенной директории.
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "Технические детали"
diff --git a/docs/ru/docs/tutorial/testing.md b/docs/ru/docs/tutorial/testing.md
index efefbfb01..ae045bbbe 100644
--- a/docs/ru/docs/tutorial/testing.md
+++ b/docs/ru/docs/tutorial/testing.md
@@ -27,7 +27,7 @@
Напишите простое утверждение с `assert` дабы проверить истинность Python-выражения (это тоже стандарт `pytest`).
```Python hl_lines="2 12 15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
```
/// tip | "Подсказка"
@@ -75,7 +75,7 @@
```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
```
### Файл тестов
@@ -93,7 +93,7 @@
Так как оба файла находятся в одной директории, для импорта объекта приложения из файла `main` в файл `test_main` Вы можете использовать относительный импорт:
```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
```
...и писать дальше тесты, как и раньше.
@@ -125,7 +125,7 @@
//// tab | Python 3.10+
```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
```
////
@@ -133,7 +133,7 @@
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
```
////
@@ -141,7 +141,7 @@
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
```
////
@@ -155,7 +155,7 @@
///
```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
```
////
@@ -169,7 +169,7 @@
///
```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
```
////
@@ -179,7 +179,7 @@
Теперь обновим файл `test_main.py`, добавив в него тестов:
```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
```
Если Вы не знаете, как передать информацию в запросе, можете воспользоваться поисковиком (погуглить) и задать вопрос: "Как передать информацию в запросе с помощью `httpx`", можно даже спросить: "Как передать информацию в запросе с помощью `requests`", поскольку дизайн HTTPX основан на дизайне Requests.
diff --git a/docs/tr/docs/advanced/testing-websockets.md b/docs/tr/docs/advanced/testing-websockets.md
index 59a2499e2..aa8a040d0 100644
--- a/docs/tr/docs/advanced/testing-websockets.md
+++ b/docs/tr/docs/advanced/testing-websockets.md
@@ -5,7 +5,7 @@ WebSockets testi yapmak için `TestClient`'ı kullanabilirsiniz.
Bu işlem için, `TestClient`'ı bir `with` ifadesinde kullanarak WebSocket'e bağlanabilirsiniz:
```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
```
/// note | "Not"
diff --git a/docs/tr/docs/advanced/wsgi.md b/docs/tr/docs/advanced/wsgi.md
index 54a6f20e2..bc8da16df 100644
--- a/docs/tr/docs/advanced/wsgi.md
+++ b/docs/tr/docs/advanced/wsgi.md
@@ -13,7 +13,7 @@ Ardından WSGI (örneğin Flask) uygulamanızı middleware ile sarmalayın.
Son olarak da bir yol altında bağlama işlemini gerçekleştirin.
```Python hl_lines="2-3 23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
```
## Kontrol Edelim
diff --git a/docs/tr/docs/alternatives.md b/docs/tr/docs/alternatives.md
index bd668ca45..286b7897a 100644
--- a/docs/tr/docs/alternatives.md
+++ b/docs/tr/docs/alternatives.md
@@ -319,7 +319,7 @@ Bu aslında Pydantic'in de aynı doğrulama stiline geçmesinde ilham kaynağı
///
-### Hug
+### Hug
Hug, Python tip belirteçlerini kullanarak API parametrelerinin tipini belirlemeyi uygulayan ilk framework'lerdendi. Bu, diğer araçlara da ilham kaynağı olan harika bir fikirdi.
diff --git a/docs/tr/docs/python-types.md b/docs/tr/docs/python-types.md
index b8b880c6d..9584a5732 100644
--- a/docs/tr/docs/python-types.md
+++ b/docs/tr/docs/python-types.md
@@ -23,7 +23,7 @@ Python uzmanıysanız ve tip belirteçleri ilgili her şeyi zaten biliyorsanız,
Basit bir örnek ile başlayalım:
```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
Programın çıktısı:
@@ -39,7 +39,7 @@ Fonksiyon sırayla şunları yapar:
* Değişkenleri aralarında bir boşlukla beraber Birleştirir.
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### Düzenle
@@ -83,7 +83,7 @@ Bu kadar.
İşte bunlar "tip belirteçleri":
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
Bu, aşağıdaki gibi varsayılan değerleri bildirmekle aynı şey değildir:
@@ -113,7 +113,7 @@ Aradığınızı bulana kadar seçenekleri kaydırabilirsiniz:
Bu fonksiyon, zaten tür belirteçlerine sahip:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
Editör değişkenlerin tiplerini bildiğinden, yalnızca otomatik tamamlama değil, hata kontrolleri de sağlar:
@@ -123,7 +123,7 @@ Editör değişkenlerin tiplerini bildiğinden, yalnızca otomatik tamamlama de
Artık `age` değişkenini `str(age)` olarak kullanmanız gerektiğini biliyorsunuz:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## Tip bildirme
@@ -144,7 +144,7 @@ Yalnızca `str` değil, tüm standart Python tiplerinin bildirebilirsiniz.
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### Tip parametreleri ile Generic tipler
@@ -162,7 +162,7 @@ Bu tür tip belirteçlerini desteklemek için özel olarak mevcuttur.
From `typing`, import `List` (büyük harf olan `L` ile):
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
Değişkenin tipini yine iki nokta üstüste (`:`) ile belirleyin.
@@ -172,7 +172,7 @@ tip olarak `List` kullanın.
Liste, bazı dahili tipleri içeren bir tür olduğundan, bunları köşeli parantez içine alırsınız:
```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
```
/// tip | "Ipucu"
@@ -200,7 +200,7 @@ Ve yine, editör bunun bir `str` olduğunu biliyor ve bunun için destek s
`Tuple` ve `set`lerin tiplerini bildirmek için de aynısını yapıyoruz:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
```
Bu şu anlama geliyor:
@@ -217,7 +217,7 @@ Bir `dict` tanımlamak için virgülle ayrılmış iki parametre verebilirsiniz.
İkinci parametre ise `dict` değerinin `value` değeri içindir:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
```
Bu şu anlama gelir:
@@ -231,7 +231,7 @@ Bu şu anlama gelir:
`Optional` bir değişkenin `str`gibi bir tipi olabileceğini ama isteğe bağlı olarak tipinin `None` olabileceğini belirtir:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
`str` yerine `Optional[str]` kullanmak editorün bu değerin her zaman `str` tipinde değil bazen `None` tipinde de olabileceğini belirtir ve hataları tespit etmemizde yardımcı olur.
@@ -256,13 +256,13 @@ Bir değişkenin tipini bir sınıf ile bildirebilirsiniz.
Diyelim ki `name` değerine sahip `Person` sınıfınız var:
```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Sonra bir değişkeni 'Person' tipinde tanımlayabilirsiniz:
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Ve yine bütün editör desteğini alırsınız:
@@ -284,7 +284,7 @@ Ve ortaya çıkan nesne üzerindeki bütün editör desteğini alırsınız.
Resmi Pydantic dokümanlarından alınmıştır:
```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
```
/// info
diff --git a/docs/tr/docs/tutorial/cookie-params.md b/docs/tr/docs/tutorial/cookie-params.md
index 807f85e8a..895cf9b03 100644
--- a/docs/tr/docs/tutorial/cookie-params.md
+++ b/docs/tr/docs/tutorial/cookie-params.md
@@ -9,7 +9,7 @@
//// tab | Python 3.10+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
///
```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -53,7 +53,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
///
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
@@ -67,7 +67,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -75,7 +75,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -83,7 +83,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -97,7 +97,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
///
```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -111,7 +111,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
///
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
diff --git a/docs/tr/docs/tutorial/first-steps.md b/docs/tr/docs/tutorial/first-steps.md
index 76c035992..335fcaece 100644
--- a/docs/tr/docs/tutorial/first-steps.md
+++ b/docs/tr/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
En sade FastAPI dosyası şu şekilde görünür:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Yukarıdaki içeriği bir `main.py` dosyasına kopyalayalım.
@@ -134,7 +134,7 @@ Ayrıca, API'ınızla iletişim kuracak önyüz, mobil veya IoT uygulamaları gi
### Adım 1: `FastAPI`yı Projemize Dahil Edelim
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI`, API'niz için tüm işlevselliği sağlayan bir Python sınıfıdır.
@@ -150,7 +150,7 @@ Ayrıca, API'ınızla iletişim kuracak önyüz, mobil veya IoT uygulamaları gi
### Adım 2: Bir `FastAPI` "Örneği" Oluşturalım
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Burada `app` değişkeni `FastAPI` sınıfının bir örneği olacaktır.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
Uygulamanızı aşağıdaki gibi oluşturursanız:
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
```
Ve bunu `main.py` dosyasına yerleştirirseniz eğer `uvicorn` komutunu şu şekilde çalıştırabilirsiniz:
@@ -251,7 +251,7 @@ Biz de onları "**operasyonlar**" olarak adlandıracağız.
#### Bir *Yol Operasyonu Dekoratörü* Tanımlayalım
```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`@app.get("/")` dekoratörü, **FastAPI**'a hemen altındaki fonksiyonun aşağıdaki durumlardan sorumlu olduğunu söyler:
@@ -307,7 +307,7 @@ Aşağıdaki, bizim **yol operasyonu fonksiyonumuzdur**:
* **fonksiyon**: "dekoratör"ün (`@app.get("/")`'in) altındaki fonksiyondur.
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Bu bir Python fonksiyonudur.
@@ -321,7 +321,7 @@ Bu durumda bu fonksiyon bir `async` fonksiyondur.
Bu fonksiyonu `async def` yerine normal bir fonksiyon olarak da tanımlayabilirsiniz.
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
```
/// note | "Not"
@@ -333,7 +333,7 @@ Eğer farkı bilmiyorsanız, [Async: *"Aceleniz mi var?"*](../async.md#in-a-hurr
### Adım 5: İçeriği Geri Döndürün
```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Bir `dict`, `list` veya `str`, `int` gibi tekil değerler döndürebilirsiniz.
diff --git a/docs/tr/docs/tutorial/path-params.md b/docs/tr/docs/tutorial/path-params.md
index d36242083..9017d99ab 100644
--- a/docs/tr/docs/tutorial/path-params.md
+++ b/docs/tr/docs/tutorial/path-params.md
@@ -3,7 +3,7 @@
Yol "parametrelerini" veya "değişkenlerini" Python string biçimlemede kullanılan sözdizimi ile tanımlayabilirsiniz.
```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
```
Yol parametresi olan `item_id`'nin değeri, fonksiyonunuza `item_id` argümanı olarak aktarılacaktır.
@@ -19,7 +19,7 @@ Eğer bu örneği çalıştırıp ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
```
////
@@ -74,7 +74,7 @@ Aynı şekilde, varsayılan değerlerini `None` olarak atayarak isteğe bağlı
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
```
////
@@ -94,7 +94,7 @@ Aşağıda görüldüğü gibi dönüştürülmek üzere `bool` tipleri de tanı
//// tab | Python 3.10+
```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
```
////
@@ -102,7 +102,7 @@ Aşağıda görüldüğü gibi dönüştürülmek üzere `bool` tipleri de tanı
//// tab | Python 3.8+
```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
```
////
@@ -151,7 +151,7 @@ Ve parametreleri, herhangi bir sıraya koymanıza da gerek yoktur.
//// tab | Python 3.10+
```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
```
////
@@ -159,7 +159,7 @@ Ve parametreleri, herhangi bir sıraya koymanıza da gerek yoktur.
//// tab | Python 3.8+
```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
```
////
@@ -173,7 +173,7 @@ Parametre için belirli bir değer atamak istemeyip parametrenin sadece isteğe
Fakat, bir sorgu parametresini zorunlu yapmak istiyorsanız varsayılan bir değer atamamanız yeterli olacaktır:
```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
```
Burada `needy` parametresi `str` tipinden oluşan zorunlu bir sorgu parametresidir.
@@ -223,7 +223,7 @@ Ve elbette, bazı parametreleri zorunlu, bazılarını varsayılan değerli ve b
//// tab | Python 3.10+
```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
```
////
@@ -231,7 +231,7 @@ Ve elbette, bazı parametreleri zorunlu, bazılarını varsayılan değerli ve b
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
```
////
diff --git a/docs/tr/docs/tutorial/request-forms.md b/docs/tr/docs/tutorial/request-forms.md
index 8e8ccfba4..19b6150ff 100644
--- a/docs/tr/docs/tutorial/request-forms.md
+++ b/docs/tr/docs/tutorial/request-forms.md
@@ -17,7 +17,7 @@ Formları kullanmak için öncelikle ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@ Formları kullanmak için öncelikle ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
@@ -51,7 +51,7 @@ Form parametrelerini `Body` veya `Query` için yaptığınız gibi oluşturun:
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```
////
@@ -59,7 +59,7 @@ Form parametrelerini `Body` veya `Query` için yaptığınız gibi oluşturun:
//// tab | Python 3.8+
```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
```
////
@@ -73,7 +73,7 @@ Prefer to use the `Annotated` version if possible.
///
```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
```
////
diff --git a/docs/tr/docs/tutorial/static-files.md b/docs/tr/docs/tutorial/static-files.md
index b82be611f..8bff59744 100644
--- a/docs/tr/docs/tutorial/static-files.md
+++ b/docs/tr/docs/tutorial/static-files.md
@@ -8,7 +8,7 @@
* Bir `StaticFiles()` örneğini belirli bir yola bağlayın.
```Python hl_lines="2 6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
```
/// note | "Teknik Detaylar"
diff --git a/docs/uk/docs/alternatives.md b/docs/uk/docs/alternatives.md
index eb48d6be7..6821ffe70 100644
--- a/docs/uk/docs/alternatives.md
+++ b/docs/uk/docs/alternatives.md
@@ -321,7 +321,7 @@ Falcon — ще один високопродуктивний фреймворк
///
-### Hug
+### Hug
Hug був одним із перших фреймворків, який реалізував оголошення типів параметрів API за допомогою підказок типу Python. Це була чудова ідея, яка надихнула інші інструменти зробити те саме.
diff --git a/docs/uk/docs/index.md b/docs/uk/docs/index.md
index 4c8c54af2..012bac2e2 100644
--- a/docs/uk/docs/index.md
+++ b/docs/uk/docs/index.md
@@ -88,7 +88,7 @@ FastAPI - це сучасний, швидкий (високопродуктив
"_Honestly, what you've built looks super solid and polished. In many ways, it's what I wanted **Hug** to be - it's really inspiring to see someone build that._"
-
+
---
diff --git a/docs/uk/docs/python-types.md b/docs/uk/docs/python-types.md
index 511a5264a..573b5372c 100644
--- a/docs/uk/docs/python-types.md
+++ b/docs/uk/docs/python-types.md
@@ -23,7 +23,7 @@ Python підтримує додаткові "підказки типу" ("type
Давайте почнемо з простого прикладу:
```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
Виклик цієї програми виводить:
@@ -39,7 +39,7 @@ John Doe
* Конкатенує їх разом із пробілом по середині.
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### Редагуйте це
@@ -83,7 +83,7 @@ John Doe
Це "type hints":
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
Це не те саме, що оголошення значень за замовчуванням, як це було б з:
@@ -113,7 +113,7 @@ John Doe
Перевірте цю функцію, вона вже має анотацію типу:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
Оскільки редактор знає типи змінних, ви не тільки отримаєте автозаповнення, ви також отримаєте перевірку помилок:
@@ -123,7 +123,7 @@ John Doe
Тепер ви знаєте, щоб виправити це, вам потрібно перетворити `age` у строку з допомогою `str(age)`:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## Оголошення типів
@@ -144,7 +144,7 @@ John Doe
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### Generic-типи з параметрами типів
@@ -172,7 +172,7 @@ John Doe
З модуля `typing`, імпортуємо `List` (з великої літери `L`):
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
Оголосимо змінну з тим самим синтаксисом двокрапки (`:`).
@@ -182,7 +182,7 @@ John Doe
Оскільки список є типом, який містить деякі внутрішні типи, ви поміщаєте їх у квадратні дужки:
```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
////
@@ -196,7 +196,7 @@ John Doe
Оскільки список є типом, який містить деякі внутрішні типи, ви поміщаєте їх у квадратні дужки:
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
```
////
@@ -234,7 +234,7 @@ John Doe
//// tab | Python 3.8 і вище
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
```
////
@@ -242,7 +242,7 @@ John Doe
//// tab | Python 3.9 і вище
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
```
////
@@ -263,7 +263,7 @@ John Doe
//// tab | Python 3.8 і вище
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
```
////
@@ -271,7 +271,7 @@ John Doe
//// tab | Python 3.9 і вище
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
```
////
@@ -293,7 +293,7 @@ John Doe
//// tab | Python 3.8 і вище
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
```
////
@@ -301,7 +301,7 @@ John Doe
//// tab | Python 3.10 і вище
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
```
////
@@ -315,7 +315,7 @@ John Doe
У Python 3.6 і вище (включаючи Python 3.10) ви можете оголосити його, імпортувавши та використовуючи `Optional` з модуля `typing`.
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
Використання `Optional[str]` замість просто `str` дозволить редактору допомогти вам виявити помилки, коли ви могли б вважати, що значенням завжди є `str`, хоча насправді воно також може бути `None`.
@@ -327,7 +327,7 @@ John Doe
//// tab | Python 3.8 і вище
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
```
////
@@ -335,7 +335,7 @@ John Doe
//// tab | Python 3.8 і вище - альтернатива
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
```
////
@@ -343,7 +343,7 @@ John Doe
//// tab | Python 3.10 і вище
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
```
////
@@ -407,13 +407,13 @@ John Doe
Скажімо, у вас є клас `Person` з імʼям:
```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Потім ви можете оголосити змінну типу `Person`:
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
І знову ж таки, ви отримуєте всю підтримку редактора:
@@ -437,7 +437,7 @@ John Doe
//// tab | Python 3.8 і вище
```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
```
////
@@ -445,7 +445,7 @@ John Doe
//// tab | Python 3.9 і вище
```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
```
////
@@ -453,7 +453,7 @@ John Doe
//// tab | Python 3.10 і вище
```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
```
////
diff --git a/docs/uk/docs/tutorial/body-fields.md b/docs/uk/docs/tutorial/body-fields.md
index e4d5b1fad..b1f645932 100644
--- a/docs/uk/docs/tutorial/body-fields.md
+++ b/docs/uk/docs/tutorial/body-fields.md
@@ -9,7 +9,7 @@
//// tab | Python 3.10+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
```
////
@@ -53,7 +53,7 @@
///
```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
```
////
@@ -71,7 +71,7 @@
//// tab | Python 3.10+
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
```
////
@@ -79,7 +79,7 @@
//// tab | Python 3.9+
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
```
////
@@ -87,7 +87,7 @@
//// tab | Python 3.8+
```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
```
////
@@ -101,7 +101,7 @@
///
```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
```
////
@@ -115,7 +115,7 @@
///
```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
```
////
diff --git a/docs/uk/docs/tutorial/body.md b/docs/uk/docs/tutorial/body.md
index 50fd76f84..1e4188831 100644
--- a/docs/uk/docs/tutorial/body.md
+++ b/docs/uk/docs/tutorial/body.md
@@ -25,7 +25,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -33,7 +33,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -47,7 +47,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -55,7 +55,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -89,7 +89,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
```
////
@@ -97,7 +97,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
```
////
@@ -170,7 +170,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
```
////
@@ -178,7 +178,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
```
////
@@ -192,7 +192,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
```
////
@@ -200,7 +200,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
```
////
@@ -214,7 +214,7 @@
//// tab | Python 3.8 і вище
```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
```
////
@@ -222,7 +222,7 @@
//// tab | Python 3.10 і вище
```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
```
////
diff --git a/docs/uk/docs/tutorial/cookie-params.md b/docs/uk/docs/tutorial/cookie-params.md
index 4720a42ba..40ca4f6e6 100644
--- a/docs/uk/docs/tutorial/cookie-params.md
+++ b/docs/uk/docs/tutorial/cookie-params.md
@@ -9,7 +9,7 @@
//// tab | Python 3.10+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -17,7 +17,7 @@
//// tab | Python 3.9+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -25,7 +25,7 @@
//// tab | Python 3.8+
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -39,7 +39,7 @@
///
```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -53,7 +53,7 @@
///
```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
@@ -67,7 +67,7 @@
//// tab | Python 3.10+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
```
////
@@ -75,7 +75,7 @@
//// tab | Python 3.9+
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
```
////
@@ -83,7 +83,7 @@
//// tab | Python 3.8+
```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
```
////
@@ -97,7 +97,7 @@
///
```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
```
////
@@ -111,7 +111,7 @@
///
```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
```
////
diff --git a/docs/uk/docs/tutorial/encoder.md b/docs/uk/docs/tutorial/encoder.md
index 9ef8d5c5d..39dca9be8 100644
--- a/docs/uk/docs/tutorial/encoder.md
+++ b/docs/uk/docs/tutorial/encoder.md
@@ -23,7 +23,7 @@
//// tab | Python 3.10+
```Python hl_lines="4 21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
```
////
@@ -31,7 +31,7 @@
//// tab | Python 3.8+
```Python hl_lines="5 22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
```
////
diff --git a/docs/uk/docs/tutorial/extra-data-types.md b/docs/uk/docs/tutorial/extra-data-types.md
index 54cbd4b00..5e6c364e4 100644
--- a/docs/uk/docs/tutorial/extra-data-types.md
+++ b/docs/uk/docs/tutorial/extra-data-types.md
@@ -58,7 +58,7 @@
//// tab | Python 3.10+
```Python hl_lines="1 3 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
////
@@ -66,7 +66,7 @@
//// tab | Python 3.9+
```Python hl_lines="1 3 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
////
@@ -74,7 +74,7 @@
//// tab | Python 3.8+
```Python hl_lines="1 3 13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
```
////
@@ -88,7 +88,7 @@
///
```Python hl_lines="1 2 11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
```
////
@@ -102,7 +102,7 @@
///
```Python hl_lines="1 2 12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
```
////
@@ -112,7 +112,7 @@
//// tab | Python 3.10+
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
////
@@ -120,7 +120,7 @@
//// tab | Python 3.9+
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
////
@@ -128,7 +128,7 @@
//// tab | Python 3.8+
```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
```
////
@@ -142,7 +142,7 @@
///
```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
```
////
@@ -156,7 +156,7 @@
///
```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
```
////
diff --git a/docs/uk/docs/tutorial/first-steps.md b/docs/uk/docs/tutorial/first-steps.md
index 784da65f5..6f79c0d1d 100644
--- a/docs/uk/docs/tutorial/first-steps.md
+++ b/docs/uk/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
Найпростіший файл FastAPI може виглядати так:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Скопіюйте це до файлу `main.py`.
@@ -158,7 +158,7 @@ OpenAPI описує схему для вашого API. І ця схема вк
### Крок 1: імпортуємо `FastAPI`
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI` це клас у Python, який надає всю функціональність для API.
@@ -174,7 +174,7 @@ OpenAPI описує схему для вашого API. І ця схема вк
### Крок 2: створюємо екземпляр `FastAPI`
```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Змінна `app` є екземпляром класу `FastAPI`.
@@ -243,7 +243,7 @@ https://example.com/items/foo
#### Визначте декоратор операції шляху (path operation decorator)
```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Декоратор `@app.get("/")` вказує **FastAPI**, що функція нижче, відповідає за обробку запитів, які надходять до неї:
@@ -298,7 +298,7 @@ https://example.com/items/foo
* **функція**: це функція, яка знаходиться нижче "декоратора" (нижче `@app.get("/")`).
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Це звичайна функція Python.
@@ -312,7 +312,7 @@ FastAPI викликатиме її щоразу, коли отримає зап
Ви також можете визначити її як звичайну функцію замість `async def`:
```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
```
/// note | "Примітка"
@@ -324,7 +324,7 @@ FastAPI викликатиме її щоразу, коли отримає зап
### Крок 5: поверніть результат
```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Ви можете повернути `dict`, `list`, а також окремі значення `str`, `int`, ітд.
diff --git a/docs/vi/docs/index.md b/docs/vi/docs/index.md
index 09deac6f2..5e346ded8 100644
--- a/docs/vi/docs/index.md
+++ b/docs/vi/docs/index.md
@@ -93,7 +93,7 @@ Những tính năng như:
"_Thành thật, những gì bạn đã xây dựng nhìn siêu chắc chắn và bóng bẩy. Theo nhiều cách, nó là những gì tôi đã muốn Hug trở thành - thật sự truyền cảm hứng để thấy ai đó xây dựng nó._"
-
+
---
diff --git a/docs/vi/docs/python-types.md b/docs/vi/docs/python-types.md
index 99d1d207f..275b0eb39 100644
--- a/docs/vi/docs/python-types.md
+++ b/docs/vi/docs/python-types.md
@@ -23,7 +23,7 @@ Nếu bạn là một chuyên gia về Python, và bạn đã biết mọi thứ
Hãy bắt đầu với một ví dụ đơn giản:
```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
Kết quả khi gọi chương trình này:
@@ -39,7 +39,7 @@ Hàm thực hiện như sau:
* Nối chúng lại với nhau bằng một kí tự trắng ở giữa.
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
```
### Sửa đổi
@@ -83,7 +83,7 @@ Chính là nó.
Những thứ đó là "type hints":
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
```
Đó không giống như khai báo những giá trị mặc định giống như:
@@ -113,7 +113,7 @@ Với cái đó, bạn có thể cuộn, nhìn thấy các lựa chọn, cho đ
Kiểm tra hàm này, nó đã có gợi ý kiểu dữ liệu:
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
```
Bởi vì trình soạn thảo biết kiểu dữ liệu của các biến, bạn không chỉ có được completion, bạn cũng được kiểm tra lỗi:
@@ -123,7 +123,7 @@ Bởi vì trình soạn thảo biết kiểu dữ liệu của các biến, bạ
Bây giờ bạn biết rằng bạn phải sửa nó, chuyển `age` sang một xâu với `str(age)`:
```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
```
## Khai báo các kiểu dữ liệu
@@ -144,7 +144,7 @@ Bạn có thể sử dụng, ví dụ:
* `bytes`
```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
```
### Các kiểu dữ liệu tổng quát với tham số kiểu dữ liệu
@@ -182,7 +182,7 @@ Tương tự kiểu dữ liệu `list`.
Như danh sách là một kiểu dữ liệu chứa một vài kiểu dữ liệu có sẵn, bạn đặt chúng trong các dấu ngoặc vuông:
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
```
////
@@ -192,7 +192,7 @@ Như danh sách là một kiểu dữ liệu chứa một vài kiểu dữ liệ
Từ `typing`, import `List` (với chữ cái `L` viết hoa):
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
Khai báo biến với cùng dấu hai chấm (`:`).
@@ -202,7 +202,7 @@ Tương tự như kiểu dữ liệu, `List` bạn import từ `typing`.
Như danh sách là một kiểu dữ liệu chứa các kiểu dữ liệu có sẵn, bạn đặt chúng bên trong dấu ngoặc vuông:
```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
```
////
@@ -240,7 +240,7 @@ Bạn sẽ làm điều tương tự để khai báo các `tuple` và các `set
//// tab | Python 3.9+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
```
////
@@ -248,7 +248,7 @@ Bạn sẽ làm điều tương tự để khai báo các `tuple` và các `set
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
```
////
@@ -269,7 +269,7 @@ Tham số kiểu dữ liệu thứ hai dành cho giá trị của `dict`.
//// tab | Python 3.9+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
```
////
@@ -277,7 +277,7 @@ Tham số kiểu dữ liệu thứ hai dành cho giá trị của `dict`.
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
```
////
@@ -302,7 +302,7 @@ Trong Python 3.10 cũng có một **cú pháp mới** mà bạn có thể đặt
//// tab | Python 3.10+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
```
////
@@ -310,7 +310,7 @@ Trong Python 3.10 cũng có một **cú pháp mới** mà bạn có thể đặt
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
```
////
@@ -324,7 +324,7 @@ Bạn có thể khai báo một giá trị có thể có một kiểu dữ liệ
Trong Python 3.6 hoặc lớn hơn (bao gồm Python 3.10) bạn có thể khai báo nó bằng các import và sử dụng `Optional` từ mô đun `typing`.
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
```
Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo giúp bạn phát hiện các lỗi mà bạn có thể gặp như một giá trị luôn là một `str`, trong khi thực tế nó rất có thể là `None`.
@@ -336,7 +336,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
//// tab | Python 3.10+
```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
```
////
@@ -344,7 +344,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
//// tab | Python 3.8+
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
```
////
@@ -352,7 +352,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
//// tab | Python 3.8+ alternative
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
```
////
@@ -375,7 +375,7 @@ Nó chỉ là về các từ và tên. Nhưng những từ đó có thể ảnh
Cho một ví dụ, hãy để ý hàm này:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
```
Tham số `name` được định nghĩa là `Optional[str]`, nhưng nó **không phải là tùy chọn**, bạn không thể gọi hàm mà không có tham số:
@@ -393,7 +393,7 @@ say_hi(name=None) # This works, None is valid 🎉
Tin tốt là, khi bạn sử dụng Python 3.10, bạn sẽ không phải lo lắng về điều đó, bạn sẽ có thể sử dụng `|` để định nghĩa hợp của các kiểu dữ liệu một cách đơn giản:
```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
```
Và sau đó, bạn sẽ không phải lo rằng những cái tên như `Optional` và `Union`. 😎
@@ -458,13 +458,13 @@ Bạn cũng có thể khai báo một lớp như là kiểu dữ liệu của m
Hãy nói rằng bạn muốn có một lớp `Person` với một tên:
```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Sau đó bạn có thể khai báo một biến có kiểu là `Person`:
```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
```
Và lại một lần nữa, bạn có được tất cả sự hỗ trợ từ trình soạn thảo:
@@ -492,7 +492,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
//// tab | Python 3.10+
```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
```
////
@@ -500,7 +500,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
//// tab | Python 3.9+
```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
```
////
@@ -508,7 +508,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
//// tab | Python 3.8+
```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
```
////
@@ -538,7 +538,7 @@ Python cũng có một tính năng cho phép đặt **metadata bổ sung** trong
Trong Python 3.9, `Annotated` là một phần của thư viện chuẩn, do đó bạn có thể import nó từ `typing`.
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
```
////
@@ -550,7 +550,7 @@ Trong Python 3.9, `Annotated` là một phần của thư viện chuẩn, do đ
Nó đã được cài đặt sẵng cùng với **FastAPI**.
```Python hl_lines="1 4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
```
////
diff --git a/docs/vi/docs/tutorial/first-steps.md b/docs/vi/docs/tutorial/first-steps.md
index ce808eb91..d80d78506 100644
--- a/docs/vi/docs/tutorial/first-steps.md
+++ b/docs/vi/docs/tutorial/first-steps.md
@@ -3,7 +3,7 @@
Tệp tin FastAPI đơn giản nhất có thể trông như này:
```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
Sao chép sang một tệp tin `main.py`.
@@ -134,7 +134,7 @@ Bạn cũng có thể sử dụng nó để sinh code tự động, với các c
### Bước 1: import `FastAPI`
```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
```
`FastAPI` là một Python class cung cấp tất cả chức năng cho API của bạn.
@@ -150,7 +150,7 @@ Bạn cũng có thể sử dụng tất cả Timothy Crosley - Hug creator (ref)
+
---
diff --git a/docs/zh-hant/docs/about/index.md b/docs/zh-hant/docs/about/index.md
new file mode 100644
index 000000000..5dcee68f2
--- /dev/null
+++ b/docs/zh-hant/docs/about/index.md
@@ -0,0 +1,3 @@
+# 關於 FastAPI
+
+關於 FastAPI、其設計、靈感來源等更多資訊。 🤓
diff --git a/docs/zh-hant/docs/deployment/cloud.md b/docs/zh-hant/docs/deployment/cloud.md
new file mode 100644
index 000000000..5d645b6c2
--- /dev/null
+++ b/docs/zh-hant/docs/deployment/cloud.md
@@ -0,0 +1,17 @@
+# 在雲端部署 FastAPI
+
+你幾乎可以使用 **任何雲端供應商** 來部署你的 FastAPI 應用程式。
+
+在大多數情況下,主要的雲端供應商都有部署 FastAPI 的指南。
+
+## 雲端供應商 - 贊助商
+
+一些雲端供應商 ✨ [**贊助 FastAPI**](../help-fastapi.md#sponsor-the-author){.internal-link target=_blank} ✨,這確保了 FastAPI 及其 **生態系統** 持續健康地 **發展**。
+
+這也展現了他們對 FastAPI 和其 **社群**(包括你)的真正承諾,他們不僅希望為你提供 **優質的服務**,還希望確保你擁有一個 **良好且健康的框架**:FastAPI。🙇
+
+你可能會想嘗試他們的服務,以下有他們的指南:
+
+* Platform.sh
+* Porter
+* Coherence
diff --git a/docs/zh-hant/docs/deployment/index.md b/docs/zh-hant/docs/deployment/index.md
new file mode 100644
index 000000000..e760b3d16
--- /dev/null
+++ b/docs/zh-hant/docs/deployment/index.md
@@ -0,0 +1,21 @@
+# 部署
+
+部署 **FastAPI** 應用程式相對容易。
+
+## 部署是什麼意思
+
+**部署** 應用程式指的是執行一系列必要的步驟,使其能夠 **讓使用者存取和使用**。
+
+對於一個 **Web API**,部署通常涉及將其放置在 **遠端伺服器** 上,並使用性能優良且穩定的 **伺服器程式**,確保使用者能夠高效、無中斷地存取應用程式,且不會遇到問題。
+
+這與 **開發** 階段形成鮮明對比,在 **開發** 階段,你會不斷更改程式碼、破壞程式碼、修復程式碼,然後停止和重新啟動伺服器等。
+
+## 部署策略
+
+根據你的使用場景和使用工具,有多種方法可以實現此目的。
+
+你可以使用一些工具自行 **部署伺服器**,你也可以使用能為你完成部分工作的 **雲端服務**,或其他可能的選項。
+
+我將向你展示在部署 **FastAPI** 應用程式時你可能應該記住的一些主要概念(儘管其中大部分適用於任何其他類型的 Web 應用程式)。
+
+在接下來的部分中,你將看到更多需要記住的細節以及一些技巧。 ✨
diff --git a/docs/zh-hant/docs/fastapi-cli.md b/docs/zh-hant/docs/fastapi-cli.md
new file mode 100644
index 000000000..3c644ce46
--- /dev/null
+++ b/docs/zh-hant/docs/fastapi-cli.md
@@ -0,0 +1,83 @@
+# FastAPI CLI
+
+**FastAPI CLI** 是一個命令列程式,能用來運行你的 FastAPI 應用程式、管理你的 FastAPI 專案等。
+
+當你安裝 FastAPI(例如使用 `pip install "fastapi[standard]"`),它會包含一個叫做 `fastapi-cli` 的套件,這個套件提供了 `fastapi` 命令。
+
+要運行你的 FastAPI 應用程式來進行開發,你可以使用 `fastapi dev` 命令:
+
+