Skip to content

Frameworks

Check the status of the API.

frameworks(url=os.getenv('RECEPTIVITI_URL', ''), key=os.getenv('RECEPTIVITI_KEY', ''), secret=os.getenv('RECEPTIVITI_SECRET', ''), dotenv=False)

List Available Frameworks.

Retrieve a list of all frameworks available to your account.

PARAMETER DESCRIPTION
url

The URL of the API.

TYPE: str DEFAULT: getenv('RECEPTIVITI_URL', '')

key

Your API key.

TYPE: str DEFAULT: getenv('RECEPTIVITI_KEY', '')

secret

Your API secret.

TYPE: str DEFAULT: getenv('RECEPTIVITI_SECRET', '')

dotenv

Path to a .env file to read environment variables from, or True to look for a file in the current directory.

TYPE: bool | str DEFAULT: False

RETURNS DESCRIPTION
List[str]

List of framework names.

Examples:

receptiviti.frameworks()
Source code in src\receptiviti\frameworks.py
def frameworks(
    url: str = os.getenv("RECEPTIVITI_URL", ""),
    key: str = os.getenv("RECEPTIVITI_KEY", ""),
    secret: str = os.getenv("RECEPTIVITI_SECRET", ""),
    dotenv: Union[bool, str] = False,
) -> List[str]:
    """
    List Available Frameworks.

    Retrieve a list of all frameworks available to your account.

    Args:
      url (str): The URL of the API.
      key (str): Your API key.
      secret (str): Your API secret.
      dotenv (bool | str): Path to a .env file to read environment variables from, or `True`
        to look for a file in the current directory.

    Returns:
      List of framework names.

    Examples:
        ```python
        receptiviti.frameworks()
        ```
    """
    _, url, key, secret = _resolve_request_def(url, key, secret, dotenv)
    res = requests.get(url.lower() + "/v2/frameworks", auth=(key, secret), timeout=9999)
    content = res.json() if res.text[:1] == "[" else {"message": res.text}
    if res.status_code != 200:
        msg = f"Request Error ({res.status_code!s})" + (
            (" (" + str(content["code"]) + ")" if "code" in content else "") + ": " + content["message"]
        )
        raise RuntimeError(msg)
    return content if isinstance(content, list) else []