@@ -52,17 +52,17 @@ def __init__(
52
52
proxy_info : Optional [Dict [str , Any ]] = None ,
53
53
):
54
54
"""
55
- Args:
56
- auth_info: When specified, a service account or a web auth JSON dict.
57
- api_info: When specified, a JSON dict containing the description of your
58
- api. Defaults to LumApps API.
59
- user: Email of user on behalf of whom to authenticate using domain-wide
60
- delegation.
61
- token: A bearer access token.
62
- token_getter: A bearer access token getter function.
63
- prune: Whether or not to use FILTERS to prune LumApps API responses.
64
- no_verify: Disables SSL verification.
65
- proxy_info: When specified, a JSON dict with proxy parameters.
55
+ Args:
56
+ auth_info: When specified, a service account or a web auth JSON dict.
57
+ api_info: When specified, a JSON dict containing the description of your
58
+ api. Defaults to LumApps API.
59
+ user: Email of user on behalf of whom to authenticate using domain-wide
60
+ delegation.
61
+ token: A bearer access token.
62
+ token_getter: A bearer access token getter function.
63
+ prune: Whether or not to use FILTERS to prune LumApps API responses.
64
+ no_verify: Disables SSL verification.
65
+ proxy_info: When specified, a JSON dict with proxy parameters.
66
66
"""
67
67
self ._token_expiry = 0
68
68
self .no_verify = no_verify
@@ -200,8 +200,7 @@ def _check_access_token(self):
200
200
self .token , self ._token_expiry = self .token_getter ()
201
201
202
202
def _prune (self , name_parts , content ):
203
- """Prune the api response.
204
- """
203
+ """Prune the api response."""
205
204
if not self .prune :
206
205
return content
207
206
for ep_filter in FILTERS :
@@ -221,7 +220,7 @@ def _prune(self, name_parts, content):
221
220
return content
222
221
223
222
def get_new_client_as_using_dwd (self , user_email : str ) -> "BaseClient" :
224
- """ Get a new BaseClient using domain-wide delegation """
223
+ """Get a new BaseClient using domain-wide delegation"""
225
224
return BaseClient (
226
225
auth_info = self ._auth_info ,
227
226
api_info = self .api_info ,
@@ -234,15 +233,15 @@ def get_new_client_as_using_dwd(self, user_email: str) -> "BaseClient":
234
233
def get_new_client_as (
235
234
self , user_email : str , customer_id : Optional [str ] = None
236
235
) -> "BaseClient" :
237
- """ Get a new BaseClient using an authorized client account by obtaining a
238
- token using the user/getToken endpoint.
236
+ """Get a new BaseClient using an authorized client account by obtaining a
237
+ token using the user/getToken endpoint.
239
238
240
- Args:
241
- user_email (str): User you want to authenticate on behalf of
242
- customer_id (str): Id of the LumApps customer the user belong to
239
+ Args:
240
+ user_email (str): User you want to authenticate on behalf of
241
+ customer_id (str): Id of the LumApps customer the user belong to
243
242
244
- Returns:
245
- BaseClient: A new instance of the BaseClient correctly authenticated.
243
+ Returns:
244
+ BaseClient: A new instance of the BaseClient correctly authenticated.
246
245
"""
247
246
client = BaseClient (
248
247
auth_info = self ._auth_info ,
@@ -353,7 +352,7 @@ def _get_verb_path_params(self, name_parts, params: dict):
353
352
return verb , path , params
354
353
355
354
def _call (self , name_parts : Sequence [str ], params : dict , json = None ):
356
- """ Construct the call """
355
+ """Construct the call"""
357
356
verb , path , params = self ._get_verb_path_params (name_parts , params )
358
357
resp = self .client .request (verb , path , params = params , json = json )
359
358
resp .raise_for_status ()
@@ -398,21 +397,21 @@ def get_call(
398
397
) -> Union [Dict [str , Any ], List [Dict [str , Any ]], None ]:
399
398
"""Generic function to call a lumapps endpoint
400
399
401
- Args:
402
- *name_parts: Endpoint, eg user/get or "user", "get"
403
- **params: Parameters of the call
400
+ Args:
401
+ *name_parts: Endpoint, eg user/get or "user", "get"
402
+ **params: Parameters of the call
404
403
405
- Returns:
406
- Object or objects returned by the endpoint call.
404
+ Returns:
405
+ Object or objects returned by the endpoint call.
407
406
408
- Example:
409
- List feedtypes in LumApps:
410
- -> GET https://.../_ah/api/lumsites/v1/feedtype/list
407
+ Example:
408
+ List feedtypes in LumApps:
409
+ -> GET https://.../_ah/api/lumsites/v1/feedtype/list
411
410
412
- With this endpoint:
411
+ With this endpoint:
413
412
414
- >>> feedtypes = get_call("feedtype/list")
415
- >>> print(feedtypes)
413
+ >>> feedtypes = get_call("feedtype/list")
414
+ >>> print(feedtypes)
416
415
"""
417
416
name_parts = _parse_endpoint_parts (name_parts )
418
417
items : List [dict ] = []
@@ -459,22 +458,22 @@ def iter_call(
459
458
None ,
460
459
]:
461
460
"""
462
- Args:
463
- *name_parts: Endpoint, eg user/get or "user", "get"
464
- **params: Parameters of the call
461
+ Args:
462
+ *name_parts: Endpoint, eg user/get or "user", "get"
463
+ **params: Parameters of the call
465
464
466
- Yields:
467
- Objects returned by the endpoint call
465
+ Yields:
466
+ Objects returned by the endpoint call
468
467
469
468
470
- Example:
471
- List feedtypes in LumApps:
472
- -> GET https://.../_ah/api/lumsites/v1/feedtype/list
469
+ Example:
470
+ List feedtypes in LumApps:
471
+ -> GET https://.../_ah/api/lumsites/v1/feedtype/list
473
472
474
- With this endpoint:
473
+ With this endpoint:
475
474
476
- >>> feedtypes = iter_call("feedtype/list")
477
- >>> for feedtype in feedtypes: print(feedtype)
475
+ >>> feedtypes = iter_call("feedtype/list")
476
+ >>> for feedtype in feedtypes: print(feedtype)
478
477
"""
479
478
name_parts = _parse_endpoint_parts (name_parts )
480
479
self .cursor = cursor = params .pop ("cursor" , None )
0 commit comments