Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for ready (0.2 sec)

  1. docs_src/extra_models/tutorial003.py

            "description": "Music is my aeroplane, it's my aeroplane",
            "type": "plane",
            "size": 5,
        },
    }
    
    
    @app.get("/items/{item_id}", response_model=Union[PlaneItem, CarItem])
    async def read_item(item_id: str):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 644 bytes
    - Viewed (1)
  2. docs_src/dependencies/tutorial003.py

    class CommonQueryParams:
        def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
            self.q = q
            self.skip = skip
            self.limit = limit
    
    
    @app.get("/items/")
    async def read_items(commons=Depends(CommonQueryParams)):
        response = {}
        if commons.q:
            response.update({"q": commons.q})
        items = fake_items_db[commons.skip : commons.skip + commons.limit]
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 635 bytes
    - Viewed (0)
  3. docs_src/handling_errors/tutorial003.py

        return JSONResponse(
            status_code=418,
            content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
        )
    
    
    @app.get("/unicorns/{name}")
    async def read_unicorn(name: str):
        if name == "yolo":
            raise UnicornException(name=name)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 626 bytes
    - Viewed (0)
  4. docs_src/additional_responses/tutorial003.py

                "content": {
                    "application/json": {
                        "example": {"id": "bar", "value": "The bar tenders"}
                    }
                },
            },
        },
    )
    async def read_item(item_id: str):
        if item_id == "foo":
            return {"id": "foo", "value": "there goes my hero"}
        else:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 837 bytes
    - Viewed (0)
  5. docs_src/path_params/tutorial003.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/users/me")
    async def read_user_me():
        return {"user_id": "the current user"}
    
    
    @app.get("/users/{user_id}")
    async def read_user(user_id: str):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 236 bytes
    - Viewed (0)
  6. docs_src/path_operation_advanced_configuration/tutorial003.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", include_in_schema=False)
    async def read_items():
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 148 bytes
    - Viewed (0)
  7. docs_src/configure_swagger_ui/tutorial003.py

    from fastapi import FastAPI
    
    app = FastAPI(swagger_ui_parameters={"deepLinking": False})
    
    
    @app.get("/users/{username}")
    async def read_user(username: str):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 201 bytes
    - Viewed (0)
  8. docs_src/app_testing/tutorial003.py

    
    @app.on_event("startup")
    async def startup_event():
        items["foo"] = {"name": "Fighters"}
        items["bar"] = {"name": "Tenders"}
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
        return items[item_id]
    
    
    def test_read_items():
        with TestClient(app) as client:
            response = client.get("/items/foo")
            assert response.status_code == 200
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 528 bytes
    - Viewed (0)
  9. docs_src/query_params/tutorial003.py

    from typing import Union
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str, q: Union[str, None] = None, short: bool = False):
        item = {"item_id": item_id}
        if q:
            item.update({"q": q})
        if not short:
            item.update(
                {"description": "This is an amazing item that has a long description"}
            )
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 406 bytes
    - Viewed (0)
  10. docs_src/security/tutorial003.py

            raise HTTPException(status_code=400, detail="Incorrect username or password")
    
        return {"access_token": user.username, "token_type": "bearer"}
    
    
    @app.get("/users/me")
    async def read_users_me(current_user: User = Depends(get_current_active_user)):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 2.4K bytes
    - Viewed (0)
Back to top