Show Menu
Cheatography

fastapi Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Path operation

Path parameters
@route­r.g­et(­"­/{e­mai­l_o­r_n­ame­}", respon­se_­mod­el=­Use­rOut) async def users_­rea­d(e­mai­l_o­r_name: str, curren­t_user: UserIn = Depend­s(g­et_­cur­ren­t_u­ser)):     query = users.s­el­ect­().w­here(         or_(us­ers.c.name == email_­or_­name, users.c.email == email_­or_­name)     )     result = await databa­se.f­et­ch_­one­(query)     if not result:         raise HTTPEx­cep­tion(             status­_co­de=404,             detail­=f"The user {email­_or­_name} does not exist in the system.",         )     else:         return result
 

Path

Path w