- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 172 for FORM (0.15 sec)
-
docs/zh/docs/tutorial/request-forms.md
# 表单数据 接收的不是 JSON,而是表单字段时,要使用 `Form`。 !!! info "说明" 要使用表单,需预先安装 <a href="https://github.com/Kludex/python-multipart" class="external-link" target="_blank">`python-multipart`</a>。 例如,`pip install python-multipart`。 ## 导入 `Form` 从 `fastapi` 导入 `Form`: ```Python hl_lines="1" {!../../../docs_src/request_forms/tutorial001.py!} ``` ## 定义 `Form` 参数 创建表单(`Form`)参数的方式与 `Body` 和 `Query` 一样:
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 2.2K bytes - Viewed (0) -
docs/en/docs/tutorial/request-forms-and-files.md
# Request Forms and Files You can define files and form fields at the same time using `File` and `Form`. !!! info To receive uploaded files and/or form data, first install <a href="https://github.com/Kludex/python-multipart" class="external-link" target="_blank">`python-multipart`</a>. E.g. `pip install python-multipart`. ## Import `File` and `Form` === "Python 3.9+" ```Python hl_lines="3"
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 2K bytes - Viewed (0) -
docs_src/request_files/tutorial002_py39.py
@app.get("/") async def main(): content = """ <body> <form action="/files/" enctype="multipart/form-data" method="post"> <input name="files" type="file" multiple> <input type="submit"> </form> <form action="/uploadfiles/" enctype="multipart/form-data" method="post"> <input name="files" type="file" multiple> <input type="submit"> </form> </body> """
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 786 bytes - Viewed (0) -
docs_src/request_files/tutorial003_py39.py
@app.get("/") async def main(): content = """ <body> <form action="/files/" enctype="multipart/form-data" method="post"> <input name="files" type="file" multiple> <input type="submit"> </form> <form action="/uploadfiles/" enctype="multipart/form-data" method="post"> <input name="files" type="file" multiple> <input type="submit"> </form> </body> """
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 888 bytes - Viewed (0) -
tests/test_tuples.py
assert response.status_code == 422, response.text def test_tuple_form_valid(): response = client.post("/tuple-form/", data={"values": ("1", "2")}) assert response.status_code == 200, response.text assert response.json() == [1, 2] def test_tuple_form_invalid(): response = client.post("/tuple-form/", data={"values": ("1", "2", "3")}) assert response.status_code == 422, response.text
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 11.8K bytes - Viewed (0) -
docs_src/request_forms/tutorial001.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 173 bytes - Viewed (0) -
tests/test_tutorial/test_request_forms/test_tutorial001.py
client = TestClient(app) return client def test_post_body_form(client: TestClient): response = client.post("/login/", data={"username": "Foo", "password": "secret"}) assert response.status_code == 200 assert response.json() == {"username": "Foo"} def test_post_body_form_no_password(client: TestClient): response = client.post("/login/", data={"username": "Foo"})
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 7.5K bytes - Viewed (0) -
docs/zh/docs/tutorial/request-files.md
## 什么是 「表单数据」 与 JSON 不同,HTML 表单(`<form></form>`)向服务器发送数据通常使用「特殊」的编码。 **FastAPI** 要确保从正确的位置读取数据,而不是读取 JSON。 !!! note "技术细节" 不包含文件时,表单数据一般用 `application/x-www-form-urlencoded`「媒体类型」编码。 但表单包含文件时,编码为 `multipart/form-data`。使用了 `File`,**FastAPI** 就知道要从请求体的正确位置获取文件。
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 6.9K bytes - Viewed (0) -
docs/ru/docs/tutorial/request-files.md
**FastAPI** наследует `UploadFile` непосредственно из **Starlette**, но добавляет некоторые детали для совместимости с **Pydantic** и другими частями FastAPI. ## Про данные формы ("Form Data") Способ, которым HTML-формы (`<form></form>`) отправляют данные на сервер, обычно использует "специальную" кодировку для этих данных, отличную от JSON. **FastAPI** позаботится о том, чтобы считать эти данные из нужного места, а не из JSON.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 15.4K bytes - Viewed (0) -
fastapi/__init__.py
from .param_functions import Body as Body from .param_functions import Cookie as Cookie from .param_functions import Depends as Depends from .param_functions import File as File from .param_functions import Form as Form from .param_functions import Header as Header from .param_functions import Path as Path from .param_functions import Query as Query from .param_functions import Security as Security from .requests import Request as Request
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Apr 19 00:31:47 GMT 2024 - 1.1K bytes - Viewed (0)