コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 11 for look (0.003 sec.)
OpenAPI Callbacks 13336
OpenAPI Callbacks Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You could create an API with a path operation that could trigger a request to an external API cre ... I (that was probably created by the same developer). In this case, you could want to document how that external API should look like. What path operation it should have, what body it should expect, what response it should return, etc. An app with cal ... d by that external developer (this is the "callback"). The normal FastAPI app Let's first see how the normal API app would look like before adding the callback. It will have a path operation that will receive an Invoice body, and a query parameter ca ... n the request body of the callback, etc. So, what we will do next is add the code to document how that external API should look like to receive the callback from your API . That documentation will show up in the Swagger UI at /docs in your API, and i ...
https://man.mtool.work/fastapi/0.115/advanced/openapi-callbacks/
Repository Management Tasks 10295
Repository Management Tasks These are the tasks that can be performed to manage the FastAPI repository by team members . Tip This section is useful only to a handful of people, team members with permissions to manage the repository. You can ... atest-changes ) will use the PR title to update the latest changes automatically. So, having a nice PR title will not only look nice in GitHub, but also in the release notes. ? Add Labels to PRs The same GitHub Action latest-changes uses one label in ... . The "admonition" sections, like tip , info , etc. are not changed or translated. For example: /// tip This is a tip. /// looks like this: Tip This is a tip. ...it could be translated as: /// tip Esto es un consejo. /// ...but needs to keep the exac ... s translated to consejo , like: /// consejo Esto es un consejo. /// it would change the style to the default one, it would look like: /// consejo Esto es un consejo. /// Those don't have to be translated, but if they are, they need to be written as: ...
https://man.mtool.work/fastapi/0.115/management-tasks/
Virtual Environments 9691
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 ... you have uv : $ uv pip install -r requirements.txt ---> 100% requirements.txt A requirements.txt with some packages could look like: fastapi[standard]==0.113.0 pydantic==2.8.0 Run Your Program After you activated the virtual environment, you can run ... Scripts (on Windows) to the PATH environment variable. Let's say that before activating the environment, the PATH variable looked like this: Linux, macOS Windows /usr/bin:/bin:/usr/sbin:/sbin That means that the system would look for programs in: /us ... r/bin /bin /usr/sbin /sbin C:\Windows\System32 That means that the system would look for programs in: C:\Windows\System32 After activating the virtual environment, the PATH variable would look something like ...
https://man.mtool.work/fastapi/0.115/virtual-environments/
Async Tests 9495
Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now, ... verify that your backend successfully wrote the correct data in the database, while using an async database library. Let's look at how we can make that work. pytest.mark.anyio If we want to call asynchronous functions in our tests, our test functions ... "/" ) async def root (): return { "message" : "Tomato" } The file test_main.py would have the tests for main.py , it could look like this now: Python 3.8+ import pytest from httpx import ASGITransport , AsyncClient from .main import app @pytest . mar ...
https://man.mtool.work/fastapi/0.115/advanced/async-tests/
Generate Clients 9086
Generate Clients Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the OpenAPI specification, you get automatic compatibility with many tools, ... ect, you probably wouldn't be able to call that command directly, but you would put it on your package.json file. It could look like this: { "name" : "frontend-app" , "version" : "1.0.0" , "description" : "" , "main" : "index.js" , "scripts" : { "gen ... axios (the frontend HTTP library) internally. Try Out the Client Code Now you can import and use the client code, it could look like this, notice that you get autocompletion for the methods: You will also get autocompletion for the payload to send: T ... ou have: ItemsService UsersService Client Method Names Right now the generated method names like createItemItemsPost don't look very clean: ItemsService . createItemItemsPost ({ name : "Plumbus" , price : 5 }) ...that's because the client generator u ...
https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 8890
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか ... ass = HTMLResponse ) async def read_items (): return """ <html> <head> <title>Some HTML in here</title> </head> <body> <h1>Look ma! HTML!</h1> </body> </html> """ 情報 パラメータ response_class は、レスポンスの「メディアタイプ」を定義するために利用さ ... "/items/" ) async def read_items (): html_content = """ <html> <head> <title>Some HTML in here</title> </head> <body> <h1>Look ma! HTML!</h1> </body> </html> """ return HTMLResponse ( content = html_content , status_code = 200 ) 注意 path operation関 ... API () def generate_html_response (): html_content = """ <html> <head> <title>Some HTML in here</title> </head> <body> <h1>Look ma! HTML!</h1> </body> </html> """ return HTMLResponse ( content = html_content , status_code = 200 ) @app . get ( "/items ...
https://man.mtool.work/fastapi/0.115/advanced/custom-response/
Custom Docs UI Static Assets (Self-Hosting) 8072
Custom Docs UI Static Assets (Self-Hosting) Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . The API docs use Swagger UI and ReDoc , and each of those need some Jav ... in the same FastAPI app, and configure the docs to use them. Project file structure Let's say your project file structure looks like this: . ├── app │ ├── __init__.py │ ├── main.py Now create a directory to store those static files. Your new file st ... ructure could look like this: . ├── app │ ├── __init__.py │ ├── main.py └── static/ Download the files Download the static files needed for t ... es: swagger-ui-bundle.js swagger-ui.css And ReDoc uses the file: redoc.standalone.js After that, your file structure could look like: . ├── app │ ├── __init__.py │ ├── main.py └── static ├── redoc.standalone.js ├── swagger-ui-bundle.js └── swagger-ui ...
https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
Development - Contributing 7468
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 ... e that now the docs show your new section (the info box at the top is gone). ? Now you can translate it all and see how it looks as you save the file. Don't Translate these Pages ? Don't translate: Files under reference/ release-notes.md fastapi-peop ... y with the live command to preview the results (or mkdocs serve ). Once you are done, you can also test it all as it would look online, including all the other languages. To do that, first build all the docs: // Use the command "build-all", this will ...
https://man.mtool.work/fastapi/0.115/contributing/
Behind a Proxy 7254
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 ... rver with a url value of /api/v1 , taken from the root_path . In the docs UI at http://127.0.0.1:9999/api/v1/docs it would look like: Tip The docs UI will interact with the server that you select. Disable automatic server from root_path If you don't ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
Settings and Environment Variables 7059
Settings and Environment Variables Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In many cases your application could need some external settings or configuratio ... de a dependency with your own custom settings. The config file Coming from the previous example, your config.py file could look like: Python 3.8+ - non-Annotated from pydantic_settings import BaseSettings class Settings ( BaseSettings ): app_name : s ...
https://man.mtool.work/fastapi/0.115/advanced/settings/
PREV 1 2 NEXT