99from .api .admins import Admins
1010from .api .alert_settings import AlertSettings
1111from .api .bluetooth_clients import BluetoothClients
12+ from .api .bluetooth_settings import BluetoothSettings
1213from .api .camera_quality_retention_profiles import CameraQualityRetentionProfiles
1314from .api .cameras import Cameras
15+ from .api .change_log import ChangeLog
1416from .api .clients import Clients
1517from .api .config_templates import ConfigTemplates
1618from .api .connectivity_monitoring_destinations import ConnectivityMonitoringDestinations
4951from .api .malware_settings import MalwareSettings
5052from .api .management_interface_settings import ManagementInterfaceSettings
5153from .api .meraki_auth_users import MerakiAuthUsers
54+ from .api .monitored_media_servers import MonitoredMediaServers
5255from .api .named_tag_scope import NamedTagScope
5356from .api .netflow_settings import NetFlowSettings
5457from .api .networks import Networks
7982from .api .wireless_settings import WirelessSettings
8083from .config import (
8184 API_KEY_ENVIRONMENT_VARIABLE , DEFAULT_BASE_URL , SINGLE_REQUEST_TIMEOUT , CERTIFICATE_PATH , WAIT_ON_RATE_LIMIT ,
82- MAXIMUM_RETRIES , OUTPUT_LOG , LOG_FILE_PREFIX , PRINT_TO_CONSOLE , SIMULATE_API_CALLS
85+ MAXIMUM_RETRIES , OUTPUT_LOG , LOG_PATH , LOG_FILE_PREFIX , PRINT_TO_CONSOLE , SIMULATE_API_CALLS
8386)
8487
88+ __version__ = '0.90.1'
8589
8690class DashboardAPI (object ):
8791 """
@@ -92,38 +96,45 @@ class DashboardAPI(object):
9296 - single_request_timeout (integer): maximum number of seconds for each API call
9397 - certificate_path (string): path for TLS/SSL certificate verification if behind local proxy
9498 - wait_on_rate_limit (boolean): retry if 429 rate limit error encountered?
95- - maximum_retries_on_rate_limit (integer): retry up to this many times when encountering 429s or other server-side errors
99+ - maximum_retries (integer): retry up to this many times when encountering 429s or other server-side errors
96100 - output_log (boolean): create an output log file?
101+ - log_path (string): path to output log; by default, working directory of script if not specified
97102 - log_file_prefix (string): log file name appended with date and timestamp
98- - print_console (boolean): if output log used, output to console too ?
103+ - print_console (boolean): print logging output to console?
99104 - simulate (boolean): simulate POST/PUT/DELETE calls to prevent changes?
100105 """
101106
102107 def __init__ (self , api_key = None , base_url = DEFAULT_BASE_URL , single_request_timeout = SINGLE_REQUEST_TIMEOUT ,
103108 certificate_path = CERTIFICATE_PATH , wait_on_rate_limit = WAIT_ON_RATE_LIMIT ,
104- maximum_retries = MAXIMUM_RETRIES , output_log = OUTPUT_LOG , log_file_prefix = LOG_FILE_PREFIX ,
105- print_console = PRINT_TO_CONSOLE , simulate = SIMULATE_API_CALLS ):
109+ maximum_retries = MAXIMUM_RETRIES , output_log = OUTPUT_LOG , log_path = LOG_PATH ,
110+ log_file_prefix = LOG_FILE_PREFIX , print_console = PRINT_TO_CONSOLE , simulate = SIMULATE_API_CALLS ):
106111 # Check API key
107112 api_key = api_key or os .environ .get (API_KEY_ENVIRONMENT_VARIABLE )
108113 if not api_key :
109114 raise APIKeyError ()
110115
111116 # Configure logging
112117 self ._logger = logging .getLogger (__name__ )
113- self ._log_file = f'{ log_file_prefix } _log__{ datetime .now ():%Y-%m-%d_%H-%M-%S} .log'
118+ if log_path and log_path [- 1 ] != '/' :
119+ log_path += '/'
120+ self ._log_file = f'{ log_path } { log_file_prefix } _log__{ datetime .now ():%Y-%m-%d_%H-%M-%S} .log'
114121 if output_log :
115122 logging .basicConfig (
116123 filename = self ._log_file ,
117124 level = logging .DEBUG ,
118125 format = '%(asctime)s %(name)12s: %(levelname)8s > %(message)s' ,
119126 datefmt = '%Y-%m-%d %H:%M:%S' )
120-
121127 if print_console :
122128 console = logging .StreamHandler ()
123129 console .setLevel (logging .INFO )
124130 formatter = logging .Formatter ('%(name)12s: %(levelname)8s > %(message)s' )
125131 console .setFormatter (formatter )
126132 logging .getLogger ('' ).addHandler (console )
133+ elif print_console :
134+ logging .basicConfig (
135+ level = logging .DEBUG ,
136+ format = '%(asctime)s %(name)12s: %(levelname)8s > %(message)s' ,
137+ datefmt = '%Y-%m-%d %H:%M:%S' )
127138
128139 # Creates the API session
129140 self ._session = RestSession (
@@ -143,8 +154,10 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
143154 self .admins = Admins (self ._session )
144155 self .alert_settings = AlertSettings (self ._session )
145156 self .bluetooth_clients = BluetoothClients (self ._session )
157+ self .bluetooth_settings = BluetoothSettings (self ._session )
146158 self .camera_quality_retention_profiles = CameraQualityRetentionProfiles (self ._session )
147159 self .cameras = Cameras (self ._session )
160+ self .change_log = ChangeLog (self ._session )
148161 self .clients = Clients (self ._session )
149162 self .config_templates = ConfigTemplates (self ._session )
150163 self .connectivity_monitoring_destinations = ConnectivityMonitoringDestinations (self ._session )
@@ -183,6 +196,7 @@ def __init__(self, api_key=None, base_url=DEFAULT_BASE_URL, single_request_timeo
183196 self .malware_settings = MalwareSettings (self ._session )
184197 self .management_interface_settings = ManagementInterfaceSettings (self ._session )
185198 self .meraki_auth_users = MerakiAuthUsers (self ._session )
199+ self .monitored_media_servers = MonitoredMediaServers (self ._session )
186200 self .named_tag_scope = NamedTagScope (self ._session )
187201 self .netflow_settings = NetFlowSettings (self ._session )
188202 self .networks = Networks (self ._session )
0 commit comments