Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 51 for option (0.23 sec)

  1. docs_src/custom_response/tutorial009c.py

    
    class CustomORJSONResponse(Response):
        media_type = "application/json"
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed"
            return orjson.dumps(content, option=orjson.OPT_INDENT_2)
    
    
    @app.get("/", response_class=CustomORJSONResponse)
    async def main():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 01 09:32:30 GMT 2022
    - 451 bytes
    - Viewed (0)
  2. fastapi/responses.py

        """
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed to use ORJSONResponse"
            return orjson.dumps(
                content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  3. tests/test_security_http_basic_optional.py

    from base64 import b64encode
    from typing import Optional
    
    from fastapi import FastAPI, Security
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    security = HTTPBasic(auto_error=False)
    
    
    @app.get("/users/me")
    def read_current_user(credentials: Optional[HTTPBasicCredentials] = Security(security)):
        if credentials is None:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  4. tests/test_security_openid_connect_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security.open_id_connect_url import OpenIdConnect
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(oid)):
        if oauth_header is None:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  5. tests/test_security_api_key_cookie_optional.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI, Security
    from fastapi.security import APIKeyCookie
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyCookie(name="key", auto_error=False)
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(api_key)):
        if oauth_header is None:
            return None
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  6. tests/test_multipart_installation.py

        with pytest.raises(RuntimeError, match=multipart_incorrect_install_error):
            app = FastAPI()
    
            @app.post("/")
            async def root(f: bytes = File()):
                return f  # pragma: nocover
    
    
    def test_incorrect_multipart_installed_multi_form(monkeypatch):
        monkeypatch.delattr("multipart.multipart.parse_options_header", raising=False)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  7. docs_src/request_files/tutorial002_an_py39.py

        return {"filenames": [file.filename for file in files]}
    
    
    @app.get("/")
    async def main():
        content = """
    <body>
    <form action="/files/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    <form action="/uploadfiles/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    </body>
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 826 bytes
    - Viewed (0)
  8. docs_src/request_files/tutorial002.py

        return {"filenames": [file.filename for file in files]}
    
    
    @app.get("/")
    async def main():
        content = """
    <body>
    <form action="/files/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    <form action="/uploadfiles/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    </body>
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 811 bytes
    - Viewed (0)
  9. docs_src/request_files/tutorial003_an.py

    ):
        return {"filenames": [file.filename for file in files]}
    
    
    @app.get("/")
    async def main():
        content = """
    <body>
    <form action="/files/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    <form action="/uploadfiles/" enctype="multipart/form-data" method="post">
    <input name="files" type="file" multiple>
    <input type="submit">
    </form>
    </body>
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 987 bytes
    - Viewed (0)
  10. fastapi/dependencies/utils.py

        *,
        request: Union[Request, WebSocket],
        dependant: Dependant,
        body: Optional[Union[Dict[str, Any], FormData]] = None,
        background_tasks: Optional[StarletteBackgroundTasks] = None,
        response: Optional[Response] = None,
        dependency_overrides_provider: Optional[Any] = None,
        dependency_cache: Optional[Dict[Tuple[Callable[..., Any], Tuple[str]], Any]] = None,
        async_exit_stack: AsyncExitStack,
    ) -> Tuple[
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
Back to top