mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-09 17:57:53 +08:00
23 lines
488 B
Markdown
23 lines
488 B
Markdown
# Helpers
|
|
|
|
## Create user
|
|
|
|
**FastAPI Users** provides a helper function to easily create a user programmatically. They are available from your `FastAPIUsers` instance.
|
|
|
|
```py
|
|
regular_user = await fastapi_users.create_user(
|
|
UserCreate(
|
|
email="king.arthur@camelot.bt",
|
|
password="guinevere",
|
|
)
|
|
)
|
|
|
|
superuser = await fastapi_users.create_user(
|
|
UserCreate(
|
|
email="king.arthur@camelot.bt",
|
|
password="guinevere",
|
|
is_superuser=True,
|
|
)
|
|
)
|
|
```
|