Search Options

Results per page
Sort
Preferred Languages
Advance

Results 271 - 280 of 1,379 for def2 (0.02 sec)

  1. docs/sts/client_grants/sts_element.py

        cElementTree.Element instance. Provides STS namespace aware parsing
        functions.
    
        """
    
        def __init__(self, root_name, element):
            self.root_name = root_name
            self.element = element
    
        @classmethod
        def fromstring(cls, root_name, data):
            """Initialize STSElement from name and XML string data.
    
            :param name: Name for XML data. Used in XML errors.
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Apr 23 18:58:53 UTC 2021
    - 2.5K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_openapi_webhooks/test_tutorial001.py

    from docs_src.openapi_webhooks.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/users/")
        assert response.status_code == 200, response.text
        assert response.json() == ["Rick", "Morty"]
    
    
    def test_dummy_webhook():
        # Just for coverage
        app.webhooks.routes[0].endpoint({})
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Oct 20 09:00:44 UTC 2023
    - 4.4K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_request_files/test_tutorial002_an_py39.py

    from ...utils import needs_py39
    
    
    @pytest.fixture(name="app")
    def get_app():
        from docs_src.request_files.tutorial002_an_py39 import app
    
        return app
    
    
    @pytest.fixture(name="client")
    def get_client(app: FastAPI):
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_post_form_no_body(client: TestClient):
        response = client.post("/files/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_operation_configurations/test_tutorial005_py39.py

    from ...utils import needs_py39, needs_pydanticv1, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.path_operation_configuration.tutorial005_py39 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_query_params_str_validations(client: TestClient):
        response = client.post("/items/", json={"name": "Foo", "price": 42})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 28 04:14:40 UTC 2023
    - 8.9K bytes
    - Viewed (0)
  5. tests/test_security_api_key_query.py

    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    @app.get("/users/me")
    def read_current_user(current_user: User = Depends(get_current_user)):
        return current_user
    
    
    client = TestClient(app)
    
    
    def test_security_api_key():
        response = client.get("/users/me?key=secret")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial001_02_an.py

    app = FastAPI()
    
    
    async def common_parameters(
        q: Union[str, None] = None, skip: int = 0, limit: int = 100
    ):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    CommonsDep = Annotated[dict, Depends(common_parameters)]
    
    
    @app.get("/items/")
    async def read_items(commons: CommonsDep):
        return commons
    
    
    @app.get("/users/")
    async def read_users(commons: CommonsDep):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 495 bytes
    - Viewed (0)
  7. docs/fr/docs/async.md

    ```Python hl_lines="2"
    @app.get('/')
    def results():
        results = some_library()
        return results
    ```
    
    ---
    
    Si votre application n'a pas à communiquer avec une bibliothèque externe et pas à attendre de réponse, utilisez `async def`.
    
    ---
    
    Si vous ne savez pas, utilisez seulement `def` comme vous le feriez habituellement.
    
    ---
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_extra_models/test_tutorial003_py310.py

    from dirty_equals import IsOneOf
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.extra_models.tutorial003_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_get_car(client: TestClient):
        response = client.get("/items/item1")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 04 20:47:07 UTC 2023
    - 5.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_custom_docs_ui/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(scope="module")
    def client():
        static_dir: Path = Path(os.getcwd()) / "static"
        print(static_dir)
        static_dir.mkdir(exist_ok=True)
        from docs_src.custom_docs_ui.tutorial001 import app
    
        with TestClient(app) as client:
            yield client
        static_dir.rmdir()
    
    
    def test_swagger_ui_html(client: TestClient):
        response = client.get("/docs")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu May 23 22:59:02 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial006.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    
    app = FastAPI()
    
    
    async def verify_token(x_token: str = Header()):
        if x_token != "fake-super-secret-token":
            raise HTTPException(status_code=400, detail="X-Token header invalid")
    
    
    async def verify_key(x_key: str = Header()):
        if x_key != "fake-super-secret-key":
            raise HTTPException(status_code=400, detail="X-Key header invalid")
        return x_key
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 583 bytes
    - Viewed (0)
Back to top