Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 370 for Portal (0.03 sec)

  1. tests/test_tutorial/test_response_model/test_tutorial003_02.py

    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)
        assert response.status_code == 307, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.4K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_response_model/test_tutorial003_05.py

        return client
    
    
    def test_get_portal(client: TestClient):
        response = client.get("/portal")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Here's your interdimensional portal."}
    
    
    def test_get_redirect(client: TestClient):
        response = client.get("/portal", params={"teleport": True}, follow_redirects=False)
        assert response.status_code == 307, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  3. tests/test_route_scope.py

    
    def test_websocket():
        with client.websocket_connect("/items/portal-gun") as websocket:
            data = websocket.receive_json()
            assert data == {"item_id": "portal-gun", "path": "/items/{item_id}"}
    
    
    def test_websocket_invalid_path_doesnt_match():
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/itemsx/portal-gun"):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 1.5K bytes
    - Viewed (0)
  4. docs_src/path_operation_advanced_configuration/tutorial005_py39.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", openapi_extra={"x-aperture-labs-portal": "blue"})
    async def read_items():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 180 bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial003_04_py39.py

    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Union[Response, dict]:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 384 bytes
    - Viewed (0)
  6. docs_src/response_model/tutorial003_05_py39.py

    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal", response_model=None)
    async def get_portal(teleport: bool = False) -> Union[Response, dict]:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 405 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dependencies/test_tutorial008d.py

        with pytest.raises(mod.InternalError) as exc_info:
            client.get("/items/portal-gun")
        assert (
            exc_info.value.args[0] == "The portal gun is too dangerous to be owned by Rick"
        )
    
    
    def test_internal_server_error(mod: ModuleType):
        client = TestClient(mod.app, raise_server_exceptions=False)
        response = client.get("/items/portal-gun")
        assert response.status_code == 500, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial008c_py39.py

            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 660 bytes
    - Viewed (0)
  9. docs_src/response_model/tutorial003_02_py39.py

    from fastapi.responses import JSONResponse, RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Response:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 381 bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial008d_py39.py

            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 694 bytes
    - Viewed (0)
Back to top