Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 1,148 for async (0.15 sec)

  1. docs_src/dependencies/tutorial012.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    
    
    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
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 696 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial012_an.py

    from fastapi import Depends, FastAPI, Header, HTTPException
    from typing_extensions import Annotated
    
    
    async def verify_token(x_token: Annotated[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: Annotated[str, Header()]):
        if x_key != "fake-super-secret-key":
            raise HTTPException(status_code=400, detail="X-Key header invalid")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 756 bytes
    - Viewed (0)
  3. tensorflow/c/eager/c_api_remote_test.cc

      TestRemoteExecuteSilentCopiesOp(/*async=*/false, /*remote=*/true);
    }
    TEST(CAPI, RemoteExecuteSilentCopiesAsync) {
      TestRemoteExecuteSilentCopiesOp(/*async=*/true, /*remote=*/true);
    }
    TEST(CAPI, RemoteExecuteSilentCopiesLocal) {
      TestRemoteExecuteSilentCopiesOp(/*async=*/false, /*remote=*/false);
    }
    TEST(CAPI, RemoteExecuteSilentCopiesLocalAsync) {
      TestRemoteExecuteSilentCopiesOp(/*async=*/true, /*remote=*/false);
    }
    
    C++
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Wed Aug 12 00:14:22 GMT 2020
    - 5.4K bytes
    - Viewed (0)
  4. tests/test_dependency_cache.py

    counter_holder = {"counter": 0}
    
    
    async def dep_counter():
        counter_holder["counter"] += 1
        return counter_holder["counter"]
    
    
    async def super_dep(count: int = Depends(dep_counter)):
        return count
    
    
    @app.get("/counter/")
    async def get_counter(count: int = Depends(dep_counter)):
        return {"counter": count}
    
    
    @app.get("/sub-counter/")
    async def get_sub_counter(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Aug 23 13:30:24 GMT 2022
    - 2.7K bytes
    - Viewed (0)
  5. docs_src/security/tutorial003_an_py39.py

        return user
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        if not user:
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Invalid authentication credentials",
                headers={"WWW-Authenticate": "Bearer"},
            )
        return user
    
    
    async def get_current_active_user(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  6. docs_src/security/tutorial005_an.py

                )
        return user
    
    
    async def get_current_active_user(
        current_user: Annotated[User, Security(get_current_user, scopes=["me"])],
    ):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  7. docs_src/websockets/tutorial003_py39.py

        async def broadcast(self, message: str):
            for connection in self.active_connections:
                await connection.send_text(message)
    
    
    manager = ConnectionManager()
    
    
    @app.get("/")
    async def get():
        return HTMLResponse(html)
    
    
    @app.websocket("/ws/{client_id}")
    async def websocket_endpoint(websocket: WebSocket, client_id: int):
        await manager.connect(websocket)
        try:
            while True:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.5K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/events.md

    ```Python
    async with lifespan(app):
        await do_stuff()
    ```
    
    When you create a context manager or an async context manager like above, what it does is that, before entering the `with` block, it will execute the code before the `yield`, and after exiting the `with` block, it will execute the code after the `yield`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  9. docs_src/security/tutorial004.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(current_user: User = Depends(get_current_user)):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: OAuth2PasswordRequestForm = Depends(),
    ) -> Token:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  10. docs_src/security/tutorial004_an.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(
        current_user: Annotated[User, Depends(get_current_user)],
    ):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
Back to top