Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 190 for rakish (0.2 sec)

  1. docs_src/app_testing/app_b_an_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: Annotated[str, Header()]):
        if x_token != fake_secret_token:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  2. docs_src/app_testing/app_b_an_py39/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 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  3. tests/test_exception_handlers.py

    client = TestClient(app)
    
    
    @app.get("/http-exception")
    def route_with_http_exception():
        raise HTTPException(status_code=400)
    
    
    @app.get("/request-validation/{param}/")
    def route_with_request_validation_exception(param: int):
        pass  # pragma: no cover
    
    
    @app.get("/server-error")
    def route_with_server_error():
        raise RuntimeError("Oops!")
    
    
    def test_override_http_exception():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  4. tests/test_serialize_response.py

        ]
    
    
    client = TestClient(app)
    
    
    def test_valid():
        response = client.get("/items/valid")
        response.raise_for_status()
        assert response.json() == {"name": "valid", "price": 1.0, "owner_ids": None}
    
    
    def test_coerce():
        response = client.get("/items/coerce")
        response.raise_for_status()
        assert response.json() == {"name": "coerce", "price": 1.0, "owner_ids": None}
    
    
    def test_validlist():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Aug 03 12:29:07 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_websockets/test_tutorial002_an.py

                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
                )  # pragma: no cover
    
    
    def test_websocket_invalid_data():
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws?q=bar&token=some-token"):
                pytest.fail(
                    "did not raise WebSocketDisconnect on __enter__"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial008c.py

        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @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 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 660 bytes
    - Viewed (0)
  7. docs_src/bigger_applications/app_an/dependencies.py

    
    async def get_token_header(x_token: Annotated[str, Header()]):
        if x_token != "fake-super-secret-token":
            raise HTTPException(status_code=400, detail="X-Token header invalid")
    
    
    async def get_query_token(token: str):
        if token != "jessica":
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 419 bytes
    - Viewed (0)
  8. docs/sts/client_grants/sts_element.py

            :return: Returns an STSElement.
            """
            try:
                return cls(root_name, cElementTree.fromstring(data))
            except _ETREE_EXCEPTIONS as error:
                raise InvalidXMLError(
                    '"{}" XML is not parsable. Message: {}'.format(
                        root_name, error.message
                    )
                )
    
        def findall(self, name):
    Python
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 23 18:58:53 GMT 2021
    - 2.5K bytes
    - Viewed (0)
  9. fastapi/security/api_key.py

        async def __call__(self, request: Request) -> Optional[str]:
            api_key = request.query_params.get(self.model.name)
            if not api_key:
                if self.auto_error:
                    raise HTTPException(
                        status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"
                    )
                else:
                    return None
            return api_key
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  10. docs_src/path_operation_advanced_configuration/tutorial007_pv1.py

        raw_body = await request.body()
        try:
            data = yaml.safe_load(raw_body)
        except yaml.YAMLError:
            raise HTTPException(status_code=422, detail="Invalid YAML")
        try:
            item = Item.parse_obj(data)
        except ValidationError as e:
            raise HTTPException(status_code=422, detail=e.errors())
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 789 bytes
    - Viewed (0)
Back to top