stouputils.continuous_delivery.cd_utils module
This module contains utilities for continuous delivery, such as loading credentials from a file. It is mainly used by the stouputils.continuous_delivery.github module.
- load_credentials(credentials_path: str) dict[str, Any] [source]
Load credentials from a JSON or YAML file into a dictionary.
Loads credentials from either a JSON or YAML file and returns them as a dictionary. The file must contain the required credentials in the appropriate format.
- Parameters:
credentials_path (str) – Path to the credentials file (.json or .yml)
- Returns:
Dictionary containing the credentials
- Return type:
dict[str, Any]
Example JSON format:
{ "github": { "username": "Stoupy51", "api_key": "ghp_XXXXXXXXXXXXXXXXXXXXXXXXXX" } }
Example YAML format:
github: username: "Stoupy51" api_key: "ghp_XXXXXXXXXXXXXXXXXXXXXXXXXX"
- handle_response(response: Response, error_message: str) None [source]
Handle a response from the API by raising an error if the response is not successful (status code not in 200-299).
- Parameters:
response (requests.Response) – The response from the API
error_message (str) – The error message to raise if the response is not successful