Skip to content

API Parameters

cyhole.core.param

CyholeParam

Bases: Enum

Generic Enum representing a param for an API endpoint

check classmethod

check(value: Any) -> None

Function used to check the consistency of an input API parameter (param) belonging to the value list (enum.Enum).

The function will raise a ParamUnknownError if the value does not belong to the Enum.

Parameters:

Name Type Description Default
value Any

value to check.

required
Source code in src/cyhole/core/param.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@classmethod
def check(cls, value: Any) -> None:
    """
        Function used to check the consistency of an input API 
        parameter (param) belonging to the value list (enum.Enum).

        The function will raise a ParamUnknownError if the value
        does not belong to the Enum.

        Parameters:
            value: value to check.
    """
    if value not in cls:
        raise ParamUnknownError(value, cls)
    return

RequestType

Bases: CyholeParam

Enum class for RequestType