- Sort Score
- Result 10 results
- Languages All
Results 181 - 190 of 421 for depende (0.11 sec)
-
docs_src/dependencies/tutorial008c_an_py39.py
from typing import Annotated from fastapi import Depends, FastAPI, HTTPException app = FastAPI() class InternalError(Exception): pass def get_username(): try: yield "Rick" except InternalError: print("Oops, we didn't raise again, Britney ๐ฑ") @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id == "portal-gun":
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 700 bytes - Viewed (0) -
docs_src/background_tasks/tutorial002_an.py
from typing import Union from fastapi import BackgroundTasks, Depends, FastAPI from typing_extensions import Annotated app = FastAPI() def write_log(message: str): with open("log.txt", mode="a") as log: log.write(message) def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None): if q: message = f"found query: {q}\n" background_tasks.add_task(write_log, message) return q
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 725 bytes - Viewed (0) -
tests/test_security_api_key_header_optional.py
from typing import Optional from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyHeader from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() api_key = APIKeyHeader(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(api_key)): if oauth_header is None: return None
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2K bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/index.md
็ถๅ๏ผไพ่ต้กนๅฝๆฐ่ฟๅๅ ๅซ่ฟไบๅผ็ `dict`ใ ### ๅฏผๅ ฅ `Depends` ```Python hl_lines="3" {!../../docs_src/dependencies/tutorial001.py!} ``` ### ๅฃฐๆไพ่ต้กน ไธๅจ*่ทฏๅพๆไฝๅฝๆฐ*ๅๆฐไธญไฝฟ็จ `Body`ใ`Query` ็ๆนๅผ็ธๅ๏ผๅฃฐๆไพ่ต้กน้่ฆไฝฟ็จ `Depends` ๅไธไธชๆฐ็ๅๆฐ๏ผ ```Python hl_lines="15 20" {!../../docs_src/dependencies/tutorial001.py!} ``` ่ฝ็ถ๏ผๅจ่ทฏๅพๆไฝๅฝๆฐ็ๅๆฐไธญไฝฟ็จ `Depends` ็ๆนๅผไธ `Body`ใ`Query` ็ธๅ๏ผไฝ `Depends` ็ๅทฅไฝๆนๅผ็ฅๆไธๅใ ่ฟ้ๅช่ฝไผ ็ป Depends ไธไธชๅๆฐใ ไธ่ฏฅๅๆฐๅฟ ้กปๆฏๅฏ่ฐ็จๅฏน่ฑก๏ผๆฏๅฆๅฝๆฐใ
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 7K bytes - Viewed (0) -
docs/de/docs/tutorial/security/get-current-user.md
/// ```Python hl_lines="19-22 26-27" {!> ../../docs_src/security/tutorial002.py!} ``` //// ## Den aktuellen Benutzer einfรผgen Und jetzt kรถnnen wir wiederum `Depends` mit unserem `get_current_user` in der *Pfadoperation* verwenden: //// tab | Python 3.10+ ```Python hl_lines="31" {!> ../../docs_src/security/tutorial002_an_py310.py!} ``` ////
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 8.3K bytes - Viewed (0) -
docs/ko/docs/tutorial/security/get-current-user.md
/// tip | "ํ" ์์ฒญ ๋ณธ๋ฌธ๋ Pydantic ๋ชจ๋ธ๋ก ์ ์ธ๋๋ค๋ ๊ฒ์ ๊ธฐ์ตํ ๊ฒ์ ๋๋ค. ์ฌ๊ธฐ์ **FastAPI**๋ `Depends`๋ฅผ ์ฌ์ฉํ๊ณ ์๊ธฐ ๋๋ฌธ์ ํผ๋๋์ง ์์ต๋๋ค. /// /// check | "ํ์ธ" ์ด ์์กด์ฑ ์์คํ ์ด ์ค๊ณ๋ ๋ฐฉ์์ ๋ชจ๋ `User` ๋ชจ๋ธ์ ๋ฐํํ๋ ๋ค์ํ ์์กด์ฑ(๋ค๋ฅธ "์์กด์ ์ธ")์ ๊ฐ์ง ์ ์๋๋ก ํฉ๋๋ค. ํด๋น ํ์ ์ ๋ฐ์ดํฐ๋ฅผ ๋ฐํํ ์ ์๋ ์์กด์ฑ์ด ํ๋๋ง ์๋ ๊ฒ์ผ๋ก ์ ํ๋์ง ์์ต๋๋ค. /// ## ๋ค๋ฅธ ๋ชจ๋ธ ์ด์ *๊ฒฝ๋ก ์๋ ํจ์*์์ ํ์ฌ ์ฌ์ฉ์๋ฅผ ์ง์ ๊ฐ์ ธ์ฌ ์ ์์ผ๋ฉฐ `Depends`๋ฅผ ์ฌ์ฉํ์ฌ **์์กด์ฑ ์ฃผ์ ** ์์ค์์ ๋ณด์ ๋ฉ์ปค๋์ฆ์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค.
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.6K bytes - Viewed (0) -
docs/em/docs/tutorial/security/get-current-user.md
๐ 5๏ธโฃ๐ ๐ญ ๐ ๐จ ๐ช ๐ฃ โฎ๏ธ Pydantic ๐ท. ๐ฅ **FastAPI** ๐ ๐ซ ๐ค ๐จ โฉ๏ธ ๐ โ๏ธ `Depends`. /// /// check ๐ ๐ ๐ โ๏ธ ๐ โ ๐ฅ โ๏ธ ๐ ๐ (๐ "โ") ๐ ๐ ๐จ `User` ๐ท. ๐ฅ ๐ซ ๐ซ โ๏ธ ๐ด 1๏ธโฃ ๐ ๐ ๐ช ๐จ ๐ ๐ ๐ฝ. /// ## ๐ ๐ท ๐ ๐ช ๐ ๐ค โฎ๏ธ ๐ฉโ๐ป ๐ *โก ๐ ๏ธ ๐ข* & ๐ โฎ๏ธ ๐โโ ๐ ๏ธ **๐ ๐** ๐, โ๏ธ `Depends`. & ๐ ๐ช โ๏ธ ๐ ๐ท โ๏ธ ๐ฝ ๐โโ ๐ (๐ ๐ผ, Pydantic ๐ท `User`).
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 4.3K bytes - Viewed (0) -
tests/test_security_oauth2_optional.py
return None user = User(username=oauth_header) return user @app.post("/login") def login(form_data: OAuth2PasswordRequestFormStrict = Depends()): return form_data @app.get("/users/me") def read_users_me(current_user: Optional[User] = Depends(get_current_user)): if current_user is None: return {"msg": "Create an account first"} return current_user client = TestClient(app)
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 10.8K bytes - Viewed (0) -
docs_src/websockets/tutorial002_an_py310.py
from typing import Annotated from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)">
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 2.8K bytes - Viewed (0) -
docs_src/websockets/tutorial002_py310.py
from fastapi import ( Cookie, Depends, FastAPI, Query, WebSocket, WebSocketException, status, ) from fastapi.responses import HTMLResponse app = FastAPI() html = """ <!DOCTYPE html> <html> <head> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)">
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 2.7K bytes - Viewed (0)