@@ -33,8 +33,10 @@ def __init__(
3333
3434 `password` - Control4 account password.
3535
36- `session` - (Optional) Allows the use of an `aiohttp.ClientSession` object for all network requests. This session will not be closed by the library.
37- If not provided, the library will open and close its own `ClientSession`s as needed.
36+ `session` - (Optional) Allows the use of an `aiohttp.ClientSession`
37+ object for all network requests. This session will not be closed
38+ by the library. If not provided, the library will open and close
39+ its own `ClientSession`s as needed.
3840 """
3941 self .username = username
4042 self .password = password
@@ -88,7 +90,10 @@ async def __sendAccountGetRequest(self, uri):
8890 try :
8991 headers = {"Authorization" : "Bearer {}" .format (self .account_bearer_token )}
9092 except AttributeError :
91- msg = "The account bearer token is missing - was your username/password correct? "
93+ msg = (
94+ "The account bearer token is missing. "
95+ "Is your username/password correct?"
96+ )
9297 _LOGGER .error (msg )
9398 raise
9499 if self .session is None :
@@ -108,12 +113,16 @@ async def __sendControllerAuthRequest(self, controller_common_name):
108113 entire JSON response from the Control4 auth API.
109114
110115 Parameters:
111- `controller_common_name`: Common name of the controller. See `getAccountControllers()` for details.
116+ `controller_common_name`: Common name of the controller.
117+ See `getAccountControllers()` for details.
112118 """
113119 try :
114120 headers = {"Authorization" : "Bearer {}" .format (self .account_bearer_token )}
115121 except AttributeError :
116- msg = "The account bearer token is missing - was your username/password correct? "
122+ msg = (
123+ "The account bearer token is missing. "
124+ "Is your username/password correct?"
125+ )
117126 _LOGGER .error (msg )
118127 raise
119128 dataDictionary = {
@@ -150,12 +159,16 @@ async def getAccountBearerToken(self):
150159 self .account_bearer_token = jsonDictionary ["authToken" ]["token" ]
151160 return self .account_bearer_token
152161 except KeyError :
153- msg = "Did not recieve an account bearer token. Is your username/password correct? "
162+ msg = (
163+ "Did not recieve an account bearer token. "
164+ "Is your username/password correct?"
165+ )
154166 _LOGGER .error (msg + data )
155167 raise
156168
157169 async def getAccountControllers (self ):
158- """Returns a dictionary of the information for all controllers registered to an account.
170+ """Returns a dictionary of the information for all controllers registered
171+ to an account.
159172
160173 Returns:
161174 ```
@@ -174,7 +187,8 @@ async def getControllerInfo(self, controller_href):
174187 """Returns a dictionary of the information of a specific controller.
175188
176189 Parameters:
177- `controller_href` - The API `href` of the controller (get this from the output of `getAccountControllers()`)
190+ `controller_href` - The API `href` of the controller (get this from
191+ the output of `getAccountControllers()`)
178192
179193 Returns:
180194 ```
@@ -184,7 +198,7 @@ async def getControllerInfo(self, controller_href):
184198 'blockNotifications': False,
185199 'controllerCommonName': 'control4_MODEL_MACADDRESS',
186200 'controller': {
187- 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/controller'
201+ 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/controller' # noqa: E501
188202 },
189203 'created': '2017-08-26T18:33:31Z',
190204 'dealer': {
@@ -196,7 +210,7 @@ async def getControllerInfo(self, controller_href):
196210 'id': 000000,
197211 'lastCheckIn': '2020-06-13T21:52:34Z',
198212 'licenses': {
199- 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/licenses'
213+ 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/licenses' # noqa: E501
200214 },
201215 'modified': '2020-06-13T21:52:34Z',
202216 'name': 'Name',
@@ -206,7 +220,7 @@ async def getControllerInfo(self, controller_href):
206220 },
207221 'type': 'Consumer',
208222 'users': {
209- 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/users'
223+ 'href': 'https://apis.control4.com/account/v3/rest/accounts/000000/users' # noqa: E501
210224 }
211225 }
212226 ```
@@ -219,17 +233,20 @@ async def getControllerOSVersion(self, controller_href):
219233 """Returns the OS version of a controller as a string.
220234
221235 Parameters:
222- `controller_href` - The API `href` of the controller (get this from the output of `getAccountControllers()`)
236+ `controller_href` - The API `href` of the controller (get this from
237+ the output of `getAccountControllers()`)
223238 """
224239 data = await self .__sendAccountGetRequest (controller_href + "/controller" )
225240 jsonDictionary = json .loads (data )
226241 return jsonDictionary ["osVersion" ]
227242
228243 async def getDirectorBearerToken (self , controller_common_name ):
229- """Returns a dictionary with a director bearer token for making Control4 Director API requests, and its time valid in seconds (usually 86400 seconds)
244+ """Returns a dictionary with a director bearer token for making Control4
245+ Director API requests, and its time valid in seconds (usually 86400 seconds)
230246
231247 Parameters:
232- `controller_common_name`: Common name of the controller. See `getAccountControllers()` for details.
248+ `controller_common_name`: Common name of the controller.
249+ See `getAccountControllers()` for details.
233250 """
234251 data = await self .__sendControllerAuthRequest (controller_common_name )
235252 jsonDictionary = json .loads (data )
0 commit comments