Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 190 for rakish (0.23 sec)

  1. tests/test_dependency_contextmanager.py

    
    def test_async_raise_other():
        assert state["/async_raise"] == "asyncgen raise not started"
        with pytest.raises(OtherDependencyError):
            client.get("/async_raise_other")
        assert state["/async_raise"] == "asyncgen raise finalized"
        assert "/async_raise" not in errors
    
    
    def test_sync_raise_other():
        assert state["/sync_raise"] == "generator raise not started"
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

        Note over client,operation: Can raise exceptions, including HTTPException
        client ->> dep: Start request
        Note over dep: Run code up to yield
        opt raise Exception
            dep -->> handler: Raise Exception
            handler -->> client: HTTP error response
        end
        dep ->> operation: Run dependency, e.g. DB session
        opt raise
            operation -->> dep: Raise Exception (e.g. HTTPException)
            opt handle
    Plain Text
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  3. docs_src/app_testing/app_b_py310/main.py

        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: str = Header()):
        if x_token != fake_secret_token:
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Tue Jan 09 14:44:08 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  4. docs_src/app_testing/app_b_an/main.py

        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: Annotated[str, Header()]):
        if x_token != fake_secret_token:
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial008c_an_py39.py

        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 700 bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial008d.py

            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 694 bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial008d_an.py

            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 744 bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial008d_an_py39.py

            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 734 bytes
    - Viewed (0)
  9. docs_src/security/tutorial004_py310.py

            username: str = payload.get("sub")
            if username is None:
                raise credentials_exception
            token_data = TokenData(username=username)
        except JWTError:
            raise credentials_exception
        user = get_user(fake_users_db, username=token_data.username)
        if user is None:
            raise credentials_exception
        return user
    
    
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  10. tests/test_serialize_response_dataclass.py

    
    def test_valid():
        response = client.get("/items/valid")
        response.raise_for_status()
        assert response.json() == {
            "name": "valid",
            "date": datetime(2021, 7, 26).isoformat(),
            "price": 1.0,
            "owner_ids": None,
        }
    
    
    def test_object():
        response = client.get("/items/object")
        response.raise_for_status()
        assert response.json() == {
            "name": "object",
    Python
    - Registered: Sun Apr 14 07:19:09 GMT 2024
    - Last Modified: Fri Aug 26 13:56:47 GMT 2022
    - 4.9K bytes
    - Viewed (0)
Back to top