Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for geturl (0.23 sec)

  1. docs_src/security/tutorial002.py

    
    def fake_decode_token(token):
        return User(
            username=token + "fakedecoded", email="******@****.***", full_name="John Doe"
        )
    
    
    async def get_current_user(token: str = Depends(oauth2_scheme)):
        user = fake_decode_token(token)
        return user
    
    
    @app.get("/users/me")
    async def read_users_me(current_user: User = Depends(get_current_user)):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 755 bytes
    - Viewed (0)
  2. docs_src/generate_clients/tutorial002.py

    async def create_item(item: Item):
        return {"message": "Item received"}
    
    
    @app.get("/items/", response_model=List[Item], tags=["items"])
    async def get_items():
        return [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
        ]
    
    
    @app.post("/users/", response_model=ResponseMessage, tags=["users"])
    async def create_user(user: User):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Mar 04 22:02:18 GMT 2022
    - 755 bytes
    - Viewed (0)
  3. docs_src/path_params_numeric_validations/tutorial002.py

    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(q: str, item_id: int = Path(title="The ID of the item to get")):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 265 bytes
    - Viewed (0)
  4. docs_src/handling_errors/tutorial002.py

        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "There goes my error"},
            )
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 404 bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial002.py

        response = {}
        if commons.q:
            response.update({"q": commons.q})
        items = fake_items_db[commons.skip : commons.skip + commons.limit]
        response.update({"items": items})
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 656 bytes
    - Viewed (0)
  6. docs_src/custom_docs_ui/tutorial002.py

        )
    
    
    @app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)
    async def swagger_ui_redirect():
        return get_swagger_ui_oauth2_redirect_html()
    
    
    @app.get("/redoc", include_in_schema=False)
    async def redoc_html():
        return get_redoc_html(
            openapi_url=app.openapi_url,
            title=app.title + " - ReDoc",
            redoc_js_url="/static/redoc.standalone.js",
        )
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/path_operation_configuration/tutorial002.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 Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 580 bytes
    - Viewed (0)
  8. docs_src/custom_request_and_route/tutorial002.py

                try:
                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
                    detail = {"errors": exc.errors(), "body": body.decode()}
                    raise HTTPException(status_code=422, detail=detail)
    
            return custom_route_handler
    
    
    app = FastAPI()
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  9. docs_src/extra_models/tutorial002.py

        hashed_password: str
    
    
    def fake_password_hasher(raw_password: str):
        return "supersecret" + raw_password
    
    
    def fake_save_user(user_in: UserIn):
        hashed_password = fake_password_hasher(user_in.password)
        user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 824 bytes
    - Viewed (0)
  10. docs_src/body_updates/tutorial002.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.patch("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        stored_item_data = items[item_id]
        stored_item_model = Item(**stored_item_data)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 1K bytes
    - Viewed (0)
Back to top