Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 591 for _id (0.16 sec)

  1. fastapi/security/open_id_connect_url.py

    Aleksei Kotenko <******@****.***> 1712026131 +0100
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  2. tests/test_route_scope.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/users/{user_id}")
    async def get_user(user_id: str, request: Request):
        route: APIRoute = request.scope["route"]
        return {"user_id": user_id, "path": route.path}
    
    
    @app.websocket("/items/{item_id}")
    async def websocket_item(item_id: str, websocket: WebSocket):
        route: APIWebSocketRoute = websocket.scope["route"]
        await websocket.accept()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Feb 08 10:23:07 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  3. docs_src/bigger_applications/app_an/routers/items.py

    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return {"name": fake_items_db[item_id]["name"], "item_id": item_id}
    
    
    @router.put(
        "/{item_id}",
        tags=["custom"],
        responses={403: {"description": "Operation forbidden"}},
    )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1011 bytes
    - Viewed (0)
  4. tests/main.py

        return "Hello World"
    
    
    @app.get("/path/{item_id}")
    def get_id(item_id):
        return item_id
    
    
    @app.get("/path/str/{item_id}")
    def get_str_id(item_id: str):
        return item_id
    
    
    @app.get("/path/int/{item_id}")
    def get_int_id(item_id: int):
        return item_id
    
    
    @app.get("/path/float/{item_id}")
    def get_float_id(item_id: float):
        return item_id
    
    
    @app.get("/path/bool/{item_id}")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  5. docs_src/sql_databases/sql_app_py39/main.py

        return users
    
    
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        if db_user is None:
            raise HTTPException(status_code=404, detail="User not found")
        return db_user
    
    
    @app.post("/users/{user_id}/items/", response_model=schemas.Item)
    def create_item_for_user(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  6. docs_src/sql_databases/sql_app_py310/alt_main.py

        return users
    
    
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        if db_user is None:
            raise HTTPException(status_code=404, detail="User not found")
        return db_user
    
    
    @app.post("/users/{user_id}/items/", response_model=schemas.Item)
    def create_item_for_user(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_extra_data_types/test_tutorial001_an.py

        expected_response.update(
            {
                "start_process": "2018-12-22T14:05:00+00:00",
                "duration": 176_100,
                "item_id": item_id,
            }
        )
        response = client.put(f"/items/{item_id}", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == expected_response
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 6.8K bytes
    - Viewed (0)
  8. docs_src/sql_databases/sql_app/alt_main.py

        return users
    
    
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        if db_user is None:
            raise HTTPException(status_code=404, detail="User not found")
        return db_user
    
    
    @app.post("/users/{user_id}/items/", response_model=schemas.Item)
    def create_item_for_user(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_extra_data_types/test_tutorial001_an_py39.py

        expected_response = data.copy()
        expected_response.update(
            {
                "start_process": "2018-12-22T14:05:00+00:00",
                "duration": 176_100,
                "item_id": item_id,
            }
        )
        response = client.put(f"/items/{item_id}", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == expected_response
    
    
    @needs_py39
    def test_openapi_schema(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 7K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_extra_data_types/test_tutorial001_py310.py

        expected_response = data.copy()
        expected_response.update(
            {
                "start_process": "2018-12-22T14:05:00+00:00",
                "duration": 176_100,
                "item_id": item_id,
            }
        )
        response = client.put(f"/items/{item_id}", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == expected_response
    
    
    @needs_py310
    def test_openapi_schema(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 7K bytes
    - Viewed (0)
Back to top