22
22
SOFTWARE.
23
23
"""
24
24
25
+ import os
26
+
25
27
from past .types import basestring
26
28
27
29
from webexteamssdk .config import (
28
- DEFAULT_BASE_URL , DEFAULT_SINGLE_REQUEST_TIMEOUT ,
30
+ DEFAULT_BASE_URL ,
31
+ DEFAULT_SINGLE_REQUEST_TIMEOUT ,
29
32
DEFAULT_WAIT_ON_RATE_LIMIT ,
30
33
)
31
34
from webexteamssdk .environment import WEBEX_TEAMS_ACCESS_TOKEN
32
35
from webexteamssdk .exceptions import AccessTokenError
33
36
from webexteamssdk .models .immutable import immutable_data_factory
34
37
from webexteamssdk .restsession import RestSession
35
38
from webexteamssdk .utils import check_type
39
+
36
40
from .access_tokens import AccessTokensAPI
37
41
from .admin_audit_events import AdminAuditEventsAPI
38
42
from .attachment_actions import AttachmentActionsAPI
39
43
from .events import EventsAPI
40
44
from .guest_issuer import GuestIssuerAPI
41
45
from .licenses import LicensesAPI
46
+ from .meeting_invitees import MeetingInviteesAPI
47
+ from .meeting_templates import MeetingTemplatesAPI
48
+ from .meetings import MeetingsAPI
42
49
from .memberships import MembershipsAPI
43
50
from .messages import MessagesAPI
44
51
from .organizations import OrganizationsAPI
45
52
from .people import PeopleAPI
53
+ from .recording_report import RecordingReportAPI
54
+ from .recordings import RecordingsAPI
46
55
from .roles import RolesAPI
47
56
from .rooms import RoomsAPI
48
- from .recordings import RecordingsAPI
49
57
from .team_memberships import TeamMembershipsAPI
50
58
from .teams import TeamsAPI
51
59
from .webhooks import WebhooksAPI
52
- from .meetings import MeetingsAPI
53
- from .meeting_templates import MeetingTemplatesAPI
54
- from .meeting_invitees import MeetingInviteesAPI
55
-
56
- import os
57
60
58
61
59
62
class WebexTeamsAPI (object ):
@@ -67,18 +70,22 @@ class WebexTeamsAPI(object):
67
70
them in a simple hierarchical structure.
68
71
"""
69
72
70
- def __init__ (self , access_token = None , base_url = DEFAULT_BASE_URL ,
71
- single_request_timeout = DEFAULT_SINGLE_REQUEST_TIMEOUT ,
72
- wait_on_rate_limit = DEFAULT_WAIT_ON_RATE_LIMIT ,
73
- object_factory = immutable_data_factory ,
74
- client_id = None ,
75
- client_secret = None ,
76
- oauth_code = None ,
77
- redirect_uri = None ,
78
- proxies = None ,
79
- be_geo_id = None ,
80
- caller = None ,
81
- disable_ssl_verify = False ):
73
+ def __init__ (
74
+ self ,
75
+ access_token = None ,
76
+ base_url = DEFAULT_BASE_URL ,
77
+ single_request_timeout = DEFAULT_SINGLE_REQUEST_TIMEOUT ,
78
+ wait_on_rate_limit = DEFAULT_WAIT_ON_RATE_LIMIT ,
79
+ object_factory = immutable_data_factory ,
80
+ client_id = None ,
81
+ client_secret = None ,
82
+ oauth_code = None ,
83
+ redirect_uri = None ,
84
+ proxies = None ,
85
+ be_geo_id = None ,
86
+ caller = None ,
87
+ disable_ssl_verify = False ,
88
+ ):
82
89
"""Create a new WebexTeamsAPI object.
83
90
84
91
An access token must be used when interacting with the Webex Teams API.
@@ -158,7 +165,8 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
158
165
159
166
# Init AccessTokensAPI wrapper early to use for oauth requests
160
167
self .access_tokens = AccessTokensAPI (
161
- base_url , object_factory ,
168
+ base_url ,
169
+ object_factory ,
162
170
single_request_timeout = single_request_timeout ,
163
171
)
164
172
@@ -169,12 +177,12 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
169
177
client_id = client_id ,
170
178
client_secret = client_secret ,
171
179
code = oauth_code ,
172
- redirect_uri = redirect_uri
180
+ redirect_uri = redirect_uri ,
173
181
).access_token
174
182
175
183
# Set optional API metrics tracking variables from env vars if there
176
- be_geo_id = be_geo_id or os .environ .get (' BE_GEO_ID' )
177
- caller = caller or os .environ .get (' WEBEX_PYTHON_SDK_CALLER' )
184
+ be_geo_id = be_geo_id or os .environ .get (" BE_GEO_ID" )
185
+ caller = caller or os .environ .get (" WEBEX_PYTHON_SDK_CALLER" )
178
186
179
187
# If an access token hasn't been provided as a parameter, environment
180
188
# variable, or obtained via an OAuth exchange raise an error.
@@ -197,15 +205,17 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
197
205
proxies = proxies ,
198
206
be_geo_id = be_geo_id ,
199
207
caller = caller ,
200
- disable_ssl_verify = disable_ssl_verify
208
+ disable_ssl_verify = disable_ssl_verify ,
201
209
)
202
210
203
211
# API wrappers
204
212
self .admin_audit_events = AdminAuditEventsAPI (
205
- self ._session , object_factory ,
213
+ self ._session ,
214
+ object_factory ,
206
215
)
207
216
self .attachment_actions = AttachmentActionsAPI (
208
- self ._session , object_factory ,
217
+ self ._session ,
218
+ object_factory ,
209
219
)
210
220
self .events = EventsAPI (self ._session , object_factory )
211
221
self .guest_issuer = GuestIssuerAPI (self ._session , object_factory )
@@ -218,13 +228,16 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
218
228
self .rooms = RoomsAPI (self ._session , object_factory )
219
229
self .teams = TeamsAPI (self ._session , object_factory )
220
230
self .team_memberships = TeamMembershipsAPI (
221
- self ._session , object_factory ,
231
+ self ._session ,
232
+ object_factory ,
222
233
)
223
234
self .webhooks = WebhooksAPI (self ._session , object_factory )
224
235
self .recordings = RecordingsAPI (self ._session , object_factory )
236
+ self .recording_report = RecordingReportAPI (self ._session , object_factory )
225
237
self .meetings = MeetingsAPI (self ._session , object_factory )
226
238
self .meeting_templates = MeetingTemplatesAPI (self ._session , object_factory )
227
239
self .meeting_invitees = MeetingInviteesAPI (self ._session , object_factory )
240
+
228
241
@property
229
242
def access_token (self ):
230
243
"""The access token used for API calls to the Webex Teams service."""
@@ -277,8 +290,7 @@ def from_oauth_code(cls, client_id, client_secret, code, redirect_uri):
277
290
TypeError: If the parameter types are incorrect.
278
291
ApiError: If the Webex Teams cloud returns an error.
279
292
"""
280
- token_obj = cls .access_tokens .get (client_id , client_secret , code ,
281
- redirect_uri )
293
+ token_obj = cls .access_tokens .get (client_id , client_secret , code , redirect_uri )
282
294
283
295
return cls (access_token = token_obj .access_token )
284
296
@@ -304,6 +316,5 @@ def from_oauth_refresh(cls, client_id, client_secret, refresh_token):
304
316
TypeError: If the parameter types are incorrect.
305
317
ApiError: If the Webex Teams cloud returns an error.
306
318
"""
307
- token_obj = cls .access_tokens .refresh (client_id , client_secret ,
308
- refresh_token )
319
+ token_obj = cls .access_tokens .refresh (client_id , client_secret , refresh_token )
309
320
return cls (access_token = token_obj .access_token )
0 commit comments