mirror of https://github.com/tiangolo/fastapi.git
📝 Add misc dependency installs to tutorial docs (#2126)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
38802eefeb
commit
ea017c9919
|
|
@ -2,6 +2,20 @@
|
||||||
|
|
||||||
You can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API" class="external-link" target="_blank">WebSockets</a> with **FastAPI**.
|
You can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API" class="external-link" target="_blank">WebSockets</a> with **FastAPI**.
|
||||||
|
|
||||||
|
## Install `WebSockets`
|
||||||
|
|
||||||
|
First you need to install `WebSockets`:
|
||||||
|
|
||||||
|
<div class="termy">
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ pip install websockets
|
||||||
|
|
||||||
|
---> 100%
|
||||||
|
```
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
## WebSockets client
|
## WebSockets client
|
||||||
|
|
||||||
### In production
|
### In production
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,12 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
|
||||||
{!> ../../../docs_src/response_model/tutorial002_py310.py!}
|
{!> ../../../docs_src/response_model/tutorial002_py310.py!}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! info
|
||||||
|
To use `EmailStr`, first install <a href="https://github.com/JoshData/python-email-validator" class="external-link" target="_blank">`email_validator`</a>.
|
||||||
|
|
||||||
|
E.g. `pip install email-validator`
|
||||||
|
or `pip install pydantic[email]`.
|
||||||
|
|
||||||
And we are using this model to declare our input and the same model to declare our output:
|
And we are using this model to declare our input and the same model to declare our output:
|
||||||
|
|
||||||
=== "Python 3.6 and above"
|
=== "Python 3.6 and above"
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,20 @@ The file `__init__.py` is just an empty file, but it tells Python that `sql_app`
|
||||||
|
|
||||||
Now let's see what each file/module does.
|
Now let's see what each file/module does.
|
||||||
|
|
||||||
|
## Install `SQLAlchemy`
|
||||||
|
|
||||||
|
First you need to install `SQLAlchemy`:
|
||||||
|
|
||||||
|
<div class="termy">
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ pip install sqlalchemy
|
||||||
|
|
||||||
|
---> 100%
|
||||||
|
```
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
## Create the SQLAlchemy parts
|
## Create the SQLAlchemy parts
|
||||||
|
|
||||||
Let's refer to the file `sql_app/database.py`.
|
Let's refer to the file `sql_app/database.py`.
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@ With it, you can use <a href="https://docs.pytest.org/" class="external-link" ta
|
||||||
|
|
||||||
## Using `TestClient`
|
## Using `TestClient`
|
||||||
|
|
||||||
|
!!! info
|
||||||
|
To use `TestClient`, first install <a href="https://github.com/psf/requests" class="external-link" target="_blank">`requests`</a>.
|
||||||
|
|
||||||
|
E.g. `pip install requests`.
|
||||||
|
|
||||||
Import `TestClient`.
|
Import `TestClient`.
|
||||||
|
|
||||||
Create a `TestClient` by passing your **FastAPI** application to it.
|
Create a `TestClient` by passing your **FastAPI** application to it.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue