pre-commit-ci-lite[bot]
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
11 additions and
2 deletions
-
docs_src/app_testing/app_b_an_py310/main.py
-
docs_src/app_testing/app_b_an_py39/main.py
-
docs_src/app_testing/app_b_py310/main.py
-
docs_src/app_testing/app_b_py39/main.py
|
|
|
@ -3,11 +3,13 @@ from typing import Annotated |
|
|
|
from fastapi import FastAPI, Header, HTTPException |
|
|
|
from pydantic import BaseModel |
|
|
|
|
|
|
|
|
|
|
|
class Item(BaseModel): |
|
|
|
id: str |
|
|
|
title: str |
|
|
|
description: str | None = None |
|
|
|
|
|
|
|
|
|
|
|
foo_item = Item(id="foo", title="Foo", description="There goes my hero") |
|
|
|
bar_item = Item(id="bar", title="Bar", description="The bartenders") |
|
|
|
|
|
|
|
@ -20,6 +22,7 @@ fake_db: dict[str, Item] = { |
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/{item_id}", response_model=Item) |
|
|
|
async def read_main(item_id: str, x_token: Annotated[str, Header()]): |
|
|
|
if x_token != fake_secret_token: |
|
|
|
|
|
|
|
@ -3,11 +3,13 @@ from typing import Annotated, Union |
|
|
|
from fastapi import FastAPI, Header, HTTPException |
|
|
|
from pydantic import BaseModel |
|
|
|
|
|
|
|
|
|
|
|
class Item(BaseModel): |
|
|
|
id: str |
|
|
|
title: str |
|
|
|
description: Union[str, None] = None |
|
|
|
|
|
|
|
|
|
|
|
foo_item = Item(id="foo", title="Foo", description="There goes my hero") |
|
|
|
bar_item = Item(id="bar", title="Bar", description="The bartenders") |
|
|
|
|
|
|
|
@ -21,8 +23,6 @@ fake_db: dict[str, Item] = { |
|
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/{item_id}", response_model=Item) |
|
|
|
async def read_main(item_id: str, x_token: Annotated[str, Header()]): |
|
|
|
if x_token != fake_secret_token: |
|
|
|
|
|
|
|
@ -1,11 +1,13 @@ |
|
|
|
from fastapi import FastAPI, Header, HTTPException |
|
|
|
from pydantic import BaseModel |
|
|
|
|
|
|
|
|
|
|
|
class Item(BaseModel): |
|
|
|
id: str |
|
|
|
title: str |
|
|
|
description: str | None = None |
|
|
|
|
|
|
|
|
|
|
|
foo_item = Item(id="foo", title="Foo", description="There goes my hero") |
|
|
|
bar_item = Item(id="bar", title="Bar", description="The bartenders") |
|
|
|
|
|
|
|
@ -18,6 +20,7 @@ fake_db: dict[str, Item] = { |
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/{item_id}", response_model=Item) |
|
|
|
async def read_main(item_id: str, x_token: str = Header()): |
|
|
|
if x_token != fake_secret_token: |
|
|
|
|
|
|
|
@ -3,11 +3,13 @@ from typing import Union |
|
|
|
from fastapi import FastAPI, Header, HTTPException |
|
|
|
from pydantic import BaseModel |
|
|
|
|
|
|
|
|
|
|
|
class Item(BaseModel): |
|
|
|
id: str |
|
|
|
title: str |
|
|
|
description: Union[str, None] = None |
|
|
|
|
|
|
|
|
|
|
|
foo_item = Item(id="foo", title="Foo", description="There goes my hero") |
|
|
|
bar_item = Item(id="bar", title="Bar", description="The bartenders") |
|
|
|
|
|
|
|
@ -20,6 +22,7 @@ fake_db: dict[str, Item] = { |
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/{item_id}", response_model=Item) |
|
|
|
async def read_main(item_id: str, x_token: str = Header()): |
|
|
|
if x_token != fake_secret_token: |
|
|
|
|