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.

Parameters:

Name Type Description Default
url str

The URL of the API.

getenv('RECEPTIVITI_URL', '')
key str

Your API key.

getenv('RECEPTIVITI_KEY', '')
secret str

Your API secret.

getenv('RECEPTIVITI_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.

False

Returns:

Type 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:
        ```
        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 []