Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for inspect (0.21 sec)

  1. tests/test_operations_signatures.py

    import inspect
    
    from fastapi import APIRouter, FastAPI
    
    method_names = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
    
    
    def test_signatures_consistency():
        base_sig = inspect.signature(APIRouter.get)
        for method_name in method_names:
            router_method = getattr(APIRouter, method_name)
            app_method = getattr(FastAPI, method_name)
            router_sig = inspect.signature(router_method)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon May 27 12:08:13 GMT 2019
    - 934 bytes
    - Viewed (0)
  2. tests/test_local_docs.py

    import inspect
    
    from fastapi.openapi.docs import get_redoc_html, get_swagger_ui_html
    
    
    def test_strings_in_generated_swagger():
        sig = inspect.signature(get_swagger_ui_html)
        swagger_js_url = sig.parameters.get("swagger_js_url").default  # type: ignore
        swagger_css_url = sig.parameters.get("swagger_css_url").default  # type: ignore
        swagger_favicon_url = sig.parameters.get("swagger_favicon_url").default  # type: ignore
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Dec 20 18:50:00 GMT 2020
    - 2.4K bytes
    - Viewed (0)
  3. fastapi/dependencies/utils.py

        if inspect.isroutine(call):
            return inspect.iscoroutinefunction(call)
        if inspect.isclass(call):
            return False
        dunder_call = getattr(call, "__call__", None)  # noqa: B004
        return inspect.iscoroutinefunction(dunder_call)
    
    
    def is_async_gen_callable(call: Callable[..., Any]) -> bool:
        if inspect.isasyncgenfunction(call):
            return True
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/custom-response.md

    For large responses, returning a `Response` directly is much faster than returning a dictionary.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_schema_extra_example/test_tutorial001_pv1.py

        )
        assert response.status_code == 200
    
    
    @needs_pydanticv1
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        # insert_assert(response.json())
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/items/{item_id}": {
                    "put": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.4K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/security/get-current-user.md

        !!! tip
            Prefer to use the `Annotated` version if possible.
    
        ```Python hl_lines="19-22  26-27"
        {!> ../../../docs_src/security/tutorial002.py!}
        ```
    
    ## Inject the current user
    
    So now we can use the same `Depends` with our `get_current_user` in the *path operation*:
    
    === "Python 3.10+"
    
        ```Python hl_lines="31"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/behind-a-proxy.md

    If you pass a custom list of `servers` and there's a `root_path` (because your API lives behind a proxy), **FastAPI** will insert a "server" with this `root_path` at the beginning of the list.
    
    For example:
    
    ```Python hl_lines="4-7"
    {!../../../docs_src/behind_a_proxy/tutorial003.py!}
    ```
    
    Will generate an OpenAPI schema like:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 11.6K bytes
    - Viewed (2)
  8. tests/test_tutorial/test_schema_extra_example/test_tutorial001_py310.py

    
    @needs_py310
    @needs_pydanticv2
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        # insert_assert(response.json())
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/items/{item_id}": {
                    "put": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.7K bytes
    - Viewed (0)
  9. tests/test_webhooks_security.py

        # Just for coverage
        new_subscription(body={}, token="Bearer 123")
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        # insert_assert(response.json())
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {},
            "webhooks": {
                "new-subscription": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Oct 20 09:00:44 GMT 2023
    - 4.6K bytes
    - Viewed (0)
  10. docs/de/docs/tutorial/dependencies/index.md

    Das System (in diesem Fall **FastAPI**) kümmert sich dann darum, Ihren Code mit den erforderlichen Abhängigkeiten zu versorgen („die Abhängigkeiten einfügen“ – „inject the dependencies“).
    
    Das ist sehr nützlich, wenn Sie:
    
    * Eine gemeinsame Logik haben (die gleiche Code-Logik immer und immer wieder).
    * Datenbankverbindungen teilen.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:01:10 GMT 2024
    - 13.1K bytes
    - Viewed (0)
Back to top