Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 474 for clients (0.19 sec)

  1. tests/test_tutorial/test_generate_clients/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.generate_clients.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_post_items():
        response = client.post("/items/", json={"name": "Foo", "price": 5})
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Item received"}
    
    
    def test_post_users():
        response = client.post(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  2. tests/test_swagger_ui_init_oauth.py

    from fastapi.testclient import TestClient
    
    swagger_ui_init_oauth = {"clientId": "the-foo-clients", "appName": "The Predendapp"}
    
    app = FastAPI(swagger_ui_init_oauth=swagger_ui_init_oauth)
    
    
    @app.get("/items/")
    async def read_items():
        return {"id": "foo"}
    
    
    client = TestClient(app)
    
    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Aug 09 10:54:05 GMT 2020
    - 718 bytes
    - Viewed (0)
  3. fastapi/applications.py

                    This is particularly useful when automatically generating clients or
                    SDKs for your API.
    
                    Read more about it in the
                    [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
                    """
                ),
            ] = Default(generate_unique_id),
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  4. fastapi/routing.py

                    This is particularly useful when automatically generating clients or
                    SDKs for your API.
    
                    Read more about it in the
                    [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
                    """
                ),
            ] = Default(generate_unique_id),
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 170.1K bytes
    - Viewed (0)
  5. docs_src/path_operation_advanced_configuration/tutorial002.py

    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items():
        return [{"item_id": "Foo"}]
    
    
    def use_route_names_as_operation_ids(app: FastAPI) -> None:
        """
        Simplify operation IDs so that generated API clients have simpler function
        names.
    
        Should be called only after all routes have been added.
        """
        for route in app.routes:
            if isinstance(route, APIRoute):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 572 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_websockets/test_tutorial003_py39.py

        return html
    
    
    @pytest.fixture(name="client")
    def get_client(app: FastAPI):
        client = TestClient(app)
    
        return client
    
    
    @needs_py39
    def test_get(client: TestClient, html: str):
        response = client.get("/")
        assert response.text == html
    
    
    @needs_py39
    def test_websocket_handle_disconnection(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_websockets/test_tutorial003.py

            data2 = connection_two.receive_text()
            client1_says = "Client #1234 says: Hello from 1234"
            assert data2 == client1_says
            data1 = connection.receive_text()
            assert data1 == client1_says
            connection_two.close()
            data1 = connection.receive_text()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 29 09:26:07 GMT 2021
    - 872 bytes
    - Viewed (0)
  8. tests/test_enforce_once_required_parameter.py

    app = FastAPI()
    
    
    def _get_client_key(client_id: str = Query(...)) -> str:
        return f"{client_id}_key"
    
    
    def _get_client_tag(client_id: Optional[str] = Query(None)) -> Optional[str]:
        if client_id is None:
            return None
        return f"{client_id}_tag"
    
    
    @app.get("/foo")
    def foo_handler(
        client_key: str = Depends(_get_client_key),
        client_tag: Optional[str] = Depends(_get_client_tag),
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.4K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_security/test_tutorial005_py39.py

    def test_read_system_status(client: TestClient):
        access_token = get_access_token(client=client)
        response = client.get(
            "/status/", headers={"Authorization": f"Bearer {access_token}"}
        )
        assert response.status_code == 200, response.text
        assert response.json() == {"status": "ok"}
    
    
    @needs_py39
    def test_read_system_status_no_token(client: TestClient):
        response = client.get("/status/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  10. tests/test_default_response_class_router.py

        with client:
            response = client.get("/a/override")
        assert response.content == b"Hello A"
        assert response.headers["content-type"] == text_type
    
    
    def test_router_a_a():
        with client:
            response = client.get("/a/a")
        assert response.json() == {"msg": "Hello A A"}
        assert response.headers["content-type"] == json_type
    
    
    def test_router_a_a_override():
        with client:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5K bytes
    - Viewed (0)
Back to top