Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 32 for 42 (0.14 sec)

  1. docs_src/path_operation_configuration/tutorial002_py310.py

    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 537 bytes
    - Viewed (0)
  2. docs/en/docs/how-to/nosql-databases-couchbase.md

    ```Python hl_lines="36-42"
    {!../../../docs_src/nosql_databases/tutorial001.py!}
    ```
    
    ### f-strings
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 6K bytes
    - Viewed (0)
  3. tests/test_http_connection_injection.py

    
    def test_value_extracting_by_http():
        response = client.get("/http")
        assert response.status_code == 200
        assert response.json() == 42
    
    
    def test_value_extracting_by_ws():
        with client.websocket_connect("/ws") as websocket:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 13:56:41 GMT 2020
    - 972 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial004.py

    client = TestClient(app)
    
    
    def test_query_params_str_validations():
        response = client.post("/items/", json={"name": "Foo", "price": 42})
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "Foo",
            "price": 42,
            "description": None,
            "tax": None,
            "tags": [],
        }
    
    
    @needs_pydanticv2
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 8.7K bytes
    - Viewed (0)
  5. docs_src/path_operation_advanced_configuration/tutorial006.py

    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    def magic_data_reader(raw_body: bytes):
        return {
            "size": len(raw_body),
            "content": {
                "name": "Maaaagic",
                "price": 42,
                "description": "Just kiddin', no magic here. ✨",
            },
        }
    
    
    @app.post(
        "/items/",
        openapi_extra={
            "requestBody": {
                "content": {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jul 29 20:01:13 GMT 2021
    - 1K bytes
    - Viewed (0)
  6. tests/test_param_in_path_and_dependency.py

    
    @app.get("/users/{user_id}", dependencies=[Depends(user_exists)])
    async def read_users(user_id: int):
        pass
    
    
    client = TestClient(app)
    
    
    def test_read_users():
        response = client.get("/users/42")
        assert response.status_code == 200, response.text
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        data = response.json()
        assert data == {
            "openapi": "3.1.0",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial006.py

        assert response.status_code == 200, response.text
        assert response.json() == {
            "size": 30,
            "content": {
                "name": "Maaaagic",
                "price": 42,
                "description": "Just kiddin', no magic here. ✨",
            },
        }
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_operation_configurations/test_tutorial005_py310.py

    
    @needs_py310
    def test_query_params_str_validations(client: TestClient):
        response = client.post("/items/", json={"name": "Foo", "price": 42})
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "Foo",
            "price": 42,
            "description": None,
            "tax": None,
            "tags": [],
        }
    
    
    @needs_py310
    @needs_pydanticv2
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 8.9K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_path_operation_configurations/test_tutorial005_py39.py

    
    @needs_py39
    def test_query_params_str_validations(client: TestClient):
        response = client.post("/items/", json={"name": "Foo", "price": 42})
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "Foo",
            "price": 42,
            "description": None,
            "tax": None,
            "tags": [],
        }
    
    
    @needs_py39
    @needs_pydanticv2
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 8.9K bytes
    - Viewed (0)
  10. docs_src/path_operation_configuration/tutorial006.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "johndoe"}]
    
    
    @app.get("/elements/", tags=["items"], deprecated=True)
    async def read_elements():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 365 bytes
    - Viewed (0)
Back to top