Tejas Attarde
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with
16 additions and
10 deletions
-
docs_src/query_params_str_validations/tutorial012_an_py310.py
-
docs_src/query_params_str_validations/tutorial013_an_py310.py
-
fastapi/_compat/v2.py
-
scripts/playwright/cookie_param_models/image01.py
-
scripts/playwright/header_param_models/image01.py
-
scripts/playwright/json_base64_bytes/image01.py
-
scripts/playwright/query_param_models/image01.py
-
scripts/playwright/request_form_models/image01.py
-
scripts/playwright/sql_databases/image01.py
-
scripts/playwright/sql_databases/image02.py
|
|
|
@ -6,6 +6,8 @@ app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/") |
|
|
|
async def read_items(q: Annotated[list[str], Query()] = ["foo", "bar"]): |
|
|
|
async def read_items(q: Annotated[list[str], Query()] = None): |
|
|
|
if q is None: |
|
|
|
q = [] |
|
|
|
query_items = {"q": q} |
|
|
|
return query_items |
|
|
|
|
|
|
|
@ -6,6 +6,8 @@ app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/items/") |
|
|
|
async def read_items(q: Annotated[list, Query()] = []): |
|
|
|
async def read_items(q: Annotated[list, Query()] = None): |
|
|
|
if q is None: |
|
|
|
q = [] |
|
|
|
query_items = {"q": q} |
|
|
|
return query_items |
|
|
|
|
|
|
|
@ -160,10 +160,12 @@ class ModelField: |
|
|
|
def validate( |
|
|
|
self, |
|
|
|
value: Any, |
|
|
|
values: dict[str, Any] = {}, # noqa: B006 |
|
|
|
values: dict[str, Any] = None, # noqa: B006 |
|
|
|
*, |
|
|
|
loc: tuple[int | str, ...] = (), |
|
|
|
) -> tuple[Any, list[dict[str, Any]]]: |
|
|
|
if values is None: |
|
|
|
values = {} |
|
|
|
try: |
|
|
|
return ( |
|
|
|
self._type_adapter.validate_python(value, from_attributes=True), |
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -28,7 +28,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -31,7 +31,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -28,7 +28,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ process = subprocess.Popen( |
|
|
|
try: |
|
|
|
for _ in range(3): |
|
|
|
try: |
|
|
|
response = httpx.get("http://localhost:8000/docs") |
|
|
|
response = httpx.get("http://localhost:8000/docs", timeout=10.0) |
|
|
|
except httpx.ConnectError: |
|
|
|
time.sleep(1) |
|
|
|
break |
|
|
|
|