]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
:pencil: Add notes about installing python-multipart for forms (#574)
authorsliptonic <shopinthewoods@gmail.com>
Fri, 4 Oct 2019 20:33:42 +0000 (15:33 -0500)
committerSebastián Ramírez <tiangolo@gmail.com>
Fri, 4 Oct 2019 20:33:42 +0000 (15:33 -0500)
docs/tutorial/request-files.md
docs/tutorial/request-forms-and-files.md
docs/tutorial/request-forms.md
docs/tutorial/security/first-steps.md

index e95f9b97aa5cd8d6623b522f5648d4eb56fa6682..3207dc076d7dc6c6f3b421fd8db25d2173d325b3 100644 (file)
@@ -1,5 +1,12 @@
 You can define files to be uploaded by the client using `File`.
 
+!!! info
+    To receive uploaded files, first install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
+
+    E.g. `pip install python-multipart`.
+
+    This is because uploaded files are sent as "form data".
+
 ## Import `File`
 
 Import `File` and `UploadFile` from `fastapi`:
index eb1f9967d5e425dfebe15b66f0e63a6118893651..5c71635e54acf311d1c84afe6791d61c66331a8e 100644 (file)
@@ -1,5 +1,10 @@
 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 [`python-multipart`](https://andrew-d.github.io/python-multipart/).
+
+    E.g. `pip install python-multipart`.
+
 ## Import `File` and `Form`
 
 ```Python hl_lines="1"
index 4fe88fa494e59081e5d74646512f73a846bcf2e5..8c64b3af80c6f1d7f9071d6c16dfb33be950f81c 100644 (file)
@@ -1,5 +1,10 @@
 When you need to receive form fields instead of JSON, you can use `Form`.
 
+!!! info
+    To use forms, first install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
+
+    E.g. `pip install python-multipart`.
+
 ## Import `Form`
 
 Import `Form` from `fastapi`:
index 11695f622930df2e4e7bb4294b2b2cdd9d3d47c7..1ed9e8c62a035eb0e1ae9b4b1bafcfd9872eb7ba 100644 (file)
@@ -24,6 +24,13 @@ Copy the example in a file `main.py`:
 
 ## Run it
 
+!!! info
+    First install [`python-multipart`](https://andrew-d.github.io/python-multipart/).
+
+    E.g. `pip install python-multipart`.
+
+    This is because **OAuth2** uses "form data" for sending the `username` and `password`.
+
 Run the example with:
 
 ```bash