Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1161 - 1170 of 1,977 for Fastapi (0.04 sec)

  1. docs/en/docs/advanced/wsgi.md

    ```Python hl_lines="2-3  23"
    {!../../docs_src/wsgi/tutorial001.py!}
    ```
    
    ## Check it
    
    Now, every request under the path `/v1/` will be handled by the Flask application.
    
    And the rest will be handled by **FastAPI**.
    
    If you run it and go to <a href="http://localhost:8000/v1/" class="external-link" target="_blank">http://localhost:8000/v1/</a> you will see the response from Flask:
    
    ```txt
    Hello, World from Flask!
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_events/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.events.tutorial003 import (
        app,
        fake_answer_to_everything_ml_model,
        ml_models,
    )
    
    
    def test_events():
        assert not ml_models, "ml_models should be empty"
        with TestClient(app) as client:
            assert ml_models["answer_to_everything"] == fake_answer_to_everything_ml_model
            response = client.get("/predict", params={"x": 2})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_response_model/test_tutorial003_02.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_model.tutorial003_02 import app
    
    client = TestClient(app)
    
    
    def test_get_portal():
        response = client.get("/portal")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Here's your interdimensional portal."}
    
    
    def test_get_redirect():
        response = client.get("/portal", params={"teleport": True}, follow_redirects=False)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/testing.md

    You could also use `from starlette.testclient import TestClient`.
    
    **FastAPI** provides the same `starlette.testclient` as `fastapi.testclient` just as a convenience for you, the developer. But it comes directly from Starlette.
    
    ///
    
    /// tip
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  5. tests/test_openapi_query_parameter_extension.py

    from typing import Optional
    
    from dirty_equals import IsDict
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get(
        "/",
        openapi_extra={
            "parameters": [
                {
                    "required": False,
                    "schema": {"title": "Extra Param 1"},
                    "name": "extra_param_1",
                    "in": "query",
                },
                {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  6. tests/test_enforce_once_required_parameter.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Query, status
    from fastapi.testclient import TestClient
    
    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(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body_updates/test_tutorial001_py39.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39, needs_pydanticv1, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.body_updates.tutorial001_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get(client: TestClient):
        response = client.get("/items/baz")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 28 04:14:40 UTC 2023
    - 11.8K bytes
    - Viewed (0)
  8. tests/test_dependency_contextmanager.py

    import json
    from typing import Dict
    
    import pytest
    from fastapi import BackgroundTasks, Depends, FastAPI
    from fastapi.responses import StreamingResponse
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    state = {
        "/async": "asyncgen not started",
        "/sync": "generator not started",
        "/async_raise": "asyncgen raise not started",
        "/sync_raise": "generator raise not started",
        "context_a": "not started a",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  9. docs_src/body_updates/tutorial001_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 900 bytes
    - Viewed (0)
  10. docs/em/docs/advanced/custom-response.md

    ⭕ 📨, 📨 `Response` 🔗 🌅 ⏊ 🌘 đŸ›Ŧ 📖.
    
    👉 ↩ī¸ đŸ”ĸ, FastAPI 🔜 ✔ 🔠 đŸŦ 🔘 &amp; ⚒ 💭 âšĢī¸ đŸŽģ ⏎ī¸ đŸŽģ, ⚙ī¸ 🎏 [đŸŽģ 🔗 đŸ”ĸ](../tutorial/encoder.md){.internal-link target=_blank} đŸ”Ŧ 🔰. 👉 âšĢī¸â” ✔ 👆 📨 **❌ 🎚**, đŸ–ŧ đŸ’Ŋ 🏷.
    
    ✋ī¸ đŸšĨ 👆 đŸŽ¯ 👈 🎚 👈 👆 đŸ›Ŧ **đŸŽģ ⏎ī¸ đŸŽģ**, 👆 đŸ’Ē đŸšļ‍♀ī¸ âšĢī¸ 🔗 📨 🎓 &amp; ❎ ➕ đŸŒĨ 👈 FastAPI 🔜 ✔ī¸ đŸšļ‍♀ī¸ 👆 📨 🎚 🔘 `jsonable_encoder` ⏭ đŸšļ‍♀ī¸ âšĢī¸ 📨 🎓.
    
    ```Python hl_lines="2  7"
    {!../../docs_src/custom_response/tutorial001b.py!}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.7K bytes
    - Viewed (0)
Back to top