mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-25 00:37:44 -04:00
✨ Add support for Pydantic models in Form parameters (#12129)
Revert "⏪️ Temporarily revert "✨ Add support for Pydantic models in `Form` pa…"
This reverts commit 8e6cf9ee9c.
This commit is contained in:
committed by
GitHub
parent
965fc8301e
commit
7bad7c0975
36
scripts/playwright/request_form_models/image01.py
Normal file
36
scripts/playwright/request_form_models/image01.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
import httpx
|
||||
from playwright.sync_api import Playwright, sync_playwright
|
||||
|
||||
|
||||
# Run playwright codegen to generate the code below, copy paste the sections in run()
|
||||
def run(playwright: Playwright) -> None:
|
||||
browser = playwright.chromium.launch(headless=False)
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
page.goto("http://localhost:8000/docs")
|
||||
page.get_by_role("button", name="POST /login/ Login").click()
|
||||
page.get_by_role("button", name="Try it out").click()
|
||||
page.screenshot(path="docs/en/docs/img/tutorial/request-form-models/image01.png")
|
||||
|
||||
# ---------------------
|
||||
context.close()
|
||||
browser.close()
|
||||
|
||||
|
||||
process = subprocess.Popen(
|
||||
["fastapi", "run", "docs_src/request_form_models/tutorial001.py"]
|
||||
)
|
||||
try:
|
||||
for _ in range(3):
|
||||
try:
|
||||
response = httpx.get("http://localhost:8000/docs")
|
||||
except httpx.ConnectError:
|
||||
time.sleep(1)
|
||||
break
|
||||
with sync_playwright() as playwright:
|
||||
run(playwright)
|
||||
finally:
|
||||
process.terminate()
|
||||
Reference in New Issue
Block a user