pycentral.workflows package
pycentral.workflows.workflows_utils module
- pycentral.workflows.workflows_utils.dict_list_to_csv(filename, csv_data_list, logger=None)
Write list of dictionaries into a CSV File via csv.DictWriter()
- Parameters:
filename (str) – Name of the file to be created or overwritten
csv_data_list (list) – A list of dictionaries, where each dict is a row in CSV file
logger (class:logging.logger, optional) – Provide an instance of class:logging.logger.
- pycentral.workflows.workflows_utils.get_conn_from_file(filename, account=None, logger=None)
Creates an instance of class`pycentral.ArubaCentralBase` based on the information provided in the YAML/JSON file.
keyword central_info: A dict containing arguments as accepted by class`pycentral.ArubaCentralBase`
keyword ssl_verify: A boolean when set to True, the python client validates Aruba Central’s SSL certs.
keyword token_store: Optional. Defaults to None.
- Parameters:
filename (str) – Name of a JSON/YAML file containing the keywords required for class:pycentral.ArubaCentralBase
logger (class:logging.logger, optional) – Provide an instance of class:logging.logger, defaults to logger class with name “ARUBA_BASE”.
- Returns:
An instance of class:pycentral.ArubaCentralBase to make API calls and manage access tokens.
- Return type:
class:pycentral.ArubaCentralBase
- pycentral.workflows.workflows_utils.get_file_contents(filename, logger=None)
Function to open a JSON/YAML/CSV file and return the contents of the file in dict format. (A list of dict is returned for a CSV file.)
- Parameters:
filename (str) – Name of an existing JSON/YAML/CSV file.
logger (class:logging.logger, optional) – Provide an instance of class:logging.logger.
- Raises:
UserWarning – Raises warning when supported filetypes are not provided.
- Returns:
Data loaded from JSON/YAML/CSV file
- Return type:
dict (a list of dict for CSV)