tropicoo / yt-dlp-bot

Self-hosted Video Download Telegram Bot πŸ‡ΊπŸ‡¦
BSD 3-Clause "New" or "Revised" License
205 stars 71 forks source link

Bump fastapi from 0.105.0 to 0.106.0 #224

Closed dependabot[bot] closed 8 months ago

dependabot[bot] commented 8 months ago

Bumps fastapi from 0.105.0 to 0.106.0.

Release notes

Sourced from fastapi's releases.

0.106.0

Breaking Changes

Using resources from dependencies with yield in background tasks is no longer supported.

This change is what supports the new features, read below. πŸ€“

Dependencies with yield, HTTPException and Background Tasks

Dependencies with yield now can raise HTTPException and other exceptions after yield. πŸŽ‰

Read the new docs here: Dependencies with yield and HTTPException.

from fastapi import Depends, FastAPI, HTTPException
from typing_extensions import Annotated

app = FastAPI()

data = { "plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"}, "portal-gun": {"description": "Gun to create portals", "owner": "Rick"}, }

class OwnerError(Exception): pass

def get_username(): try: yield "Rick" except OwnerError as e: raise HTTPException(status_code=400, detail=f"Onwer error: {e}")

@​app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id not in data: raise HTTPException(status_code=404, detail="Item not found") item = data[item_id] if item["owner"] != username: raise OwnerError(username) return item


Before FastAPI 0.106.0, raising exceptions after yield was not possible, the exit code in dependencies with yield was executed after the response was sent, so Exception Handlers would have already run.

... (truncated)

Commits
  • 5826c4f πŸ“ Tweak release notes
  • 91510db πŸ”– Release version 0.106.0
  • bcd5a42 πŸ“ Update release notes
  • 678bed2 πŸ“ Update release notes
  • a4aa79e ✨ Add support for raising exceptions (including HTTPException) in dependenc...
  • e7756ae πŸ“ Update release notes
  • dc2fdd5 πŸ‘₯ Update FastAPI People (#10567)
  • See full diff in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)