Results of 1 - 10 of about 28 for check (0.009 sec.)
- SQL (Relational) Databases 14207
- SQL (Relational) Databases Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . FastAPI doesn't require you to use a SQL (relational) database. But you can use any data
...e ) secret_name : str sqlite_file_name = "database.db" sqlite_url = f "sqlite:/// { sqlite_file_name } " connect_args = { "check_same_thread" : False } engine = create_engine ( sqlite_url , connect_args = connect_args ) def create_db_and_tables (): SQ...e ) secret_name : str sqlite_file_name = "database.db" sqlite_url = f "sqlite:/// { sqlite_file_name } " connect_args = { "check_same_thread" : False } engine = create_engine ( sqlite_url , connect_args = connect_args ) def create_db_and_tables (): SQ...e ) secret_name : str sqlite_file_name = "database.db" sqlite_url = f "sqlite:/// { sqlite_file_name } " connect_args = { "check_same_thread" : False } engine = create_engine ( sqlite_url , connect_args = connect_args ) def create_db_and_tables (): SQ... - https://man.mtool.work/fastapi/0.115/tutorial/sql-databases/
- Advanced Dependencies 12437
- Advanced Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Parameterized dependencies All the dependencies we have seen are a fixed function or class. B
...dency, without having to declare many different functions or classes. Let's imagine that we want to have a dependency that checks if the query parameter q contains some fixed content. But we want to be able to parameterize that fixed content. A "calla..._ : Python 3.9+ from typing import Annotated from fastapi import Depends , FastAPI app = FastAPI () class FixedContentQueryChecker : def __init__ ( self , fixed_content : str ): self . fixed_content = fixed_content def __call__ ( self , q : str = "" )...: if q : return self . fixed_content in q return False checker = FixedContentQueryChecker ( "bar" ) @app . get ( "/query-checker/" ) async def read_query_check ( fixed_content_include... - https://man.mtool.work/fastapi/0.115/advanced/advanced-dependencies/
- Simple OAuth2 with Password and Bearer 10913
- Simple OAuth2 with Password and Bearer Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Now let's build from the previous chapter and add the missing parts to have
...username ] return UserInDB ( ** user_dict ) def fake_decode_token ( token ): # This doesn't provide any security at all # Check the next version user = get_user ( fake_users_db , token ) return user async def get_current_user ( token : Annotated [ st...username ] return UserInDB ( ** user_dict ) def fake_decode_token ( token ): # This doesn't provide any security at all # Check the next version user = get_user ( fake_users_db , token ) return user async def get_current_user ( token : Annotated [ st...username ] return UserInDB ( ** user_dict ) def fake_decode_token ( token ): # This doesn't provide any security at all # Check the next version user = get_user ( fake_users_db , token ) return user async def get_current_user ( token : Annotated [ st... - https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
- Virtual Environments 8979
- Virtual Environments Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When you work in Python projects you probably should use a virtual environment (or a similar m
...tual environment and not any other that could be installed globally, probably with a different version than what you need. Check the Virtual Environment is Active Check that the virtual environment is active (the previous command worked). Tip This is...optional , but it's a good way to check that everything is working as expected and you are using the virtual environment you intended. Linux, macOS, Windows Bash...s in new versions , but it's better to be safe, and install newer versions intentionally and when you can run the tests to check everything is working correctly. Now, imagine that with many other packages that all your projects depend on . That's very... - https://man.mtool.work/fastapi/0.115/virtual-environments/
- Development - Contributing 8733
- Development - Contributing Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . First, you might want to see the basic ways to help FastAPI and get help . Developing If
...ve, that will install all the requirements. Docs live During local development, there is a script that builds the site and checks for any changes, live-reloading: $ python ./scripts/docs.py live <span style="color: green;">[INFO]</span> Serving on htt...t can't be done without the help from the community. ? ? Here are the steps to help with translations. Tips and guidelines Check the currently existing pull requests for your language. You can filter the pull requests by the ones with the label for yo...hers to review the translation before merging. Tip You can add comments with change suggestions to existing pull requests. Check the docs about adding a pull request review to approve it or request changes. Check if there's a GitHub Discussion to coor... - https://man.mtool.work/fastapi/0.115/contributing/
- Using Dataclasses 8422
- Using Dataclasses Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . FastAPI is built on top of Pydantic , and I have been showing you how to use Pydantic models to d
...def . As always, in FastAPI you can combine def and async def as needed. If you need a refresher about when to use which, check out the section "In a hurry?" in the docs about async and await . This path operation function is not returning dataclasse...e. You can combine dataclasses with other type annotations in many different combinations to form complex data structures. Check the in-code annotation tips above to see more specific details. Learn More You can also combine dataclasses with other Pyd...antic models, inherit from them, include them in your own models, etc. To learn more, check the Pydantic docs about dataclasses . Version This is available since FastAPI version 0.67.0 . ?... - https://man.mtool.work/fastapi/0.115/advanced/dataclasses/
- Separate OpenAPI Schemas for Input and Output or Not 8422
- Separate OpenAPI Schemas for Input and Output or Not Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When using Pydantic v2 , the generated OpenAPI is a bit more e
...g for that field, it will still have that default value . Model for Output Response Data If you interact with the docs and check the response, even though the code didn't add anything in one of the description fields, the JSON response contains the de...it's just that sometimes the value could be None (or null in JSON). That means that, clients using your API don't have to check if the value exists or not, they can assume the field will always be there , but just that in some cases it will have the...be required for output it will be required (and possibly None , or in JSON terms, null ) Model for Output in Docs You can check the output model in the docs too, both name and description are marked as required with a red asterisk : Model for Input a... - https://man.mtool.work/fastapi/0.115/how-to/separate-openapi-schemas/
- Behind a Proxy 8176
- Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration
...SGI specification defines a root_path for this use case. And the --root-path command line option provides that root_path . Checking the current root_path You can get the current root_path used by your application for each request, it is part of the sc...root-path /api/v1 <span style="color: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) Check the responses Now, if you go to the URL with the port for Uvicorn: http://127.0.0.1:8000/app , you will see the normal res...how the Proxy (Traefik) uses the path prefix and how the server (Uvicorn) uses the root_path from the option --root-path . Check the docs UI But here's the fun part. ✨ The "official" way to access the app would be through the proxy with the path prefi... - https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
- How To - Recipes 8012
- How To - Recipes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Here you will see different recipes or "how to" guides for several topics . Most of these ideas wo
...tudy them if they apply directly to your project . If something seems interesting and useful to your project, go ahead and check it, but otherwise, you might probably just skip them. Tip If you want to learn FastAPI in a structured way (recommended),... - https://man.mtool.work/fastapi/0.115/how-to/
- HTTP Basic Auth 7865
- HTTP Basic Auth Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For the simplest cases, you can use HTTP Basic Auth. In HTTP Basic Auth, the application expects a
...RL for the first time (or click the "Execute" button in the docs) the browser will ask you for your username and password: Check the username Here's a more complete example. Use a dependency to check if the username and password are correct. For this,...use the Python standard module secrets to check the username and password. secrets.compare_digest() needs to take bytes or a str that only contains ASCII characters (the... - https://man.mtool.work/fastapi/0.115/advanced/security/http-basic-auth/