18
18
unicode_literals ,
19
19
)
20
20
from builtins import *
21
+ from past .builtins import basestring
21
22
22
23
from ciscosparkapi .exceptions import ciscosparkapiException
23
24
from ciscosparkapi .utils import generator_container
@@ -38,7 +39,7 @@ def __init__(self, json):
38
39
"""Init a new Membership data object from a JSON dictionary or string.
39
40
40
41
Args:
41
- json(dict, str ): Input JSON object.
42
+ json(dict, basestring ): Input JSON object.
42
43
43
44
Raises:
44
45
TypeError: If the input object is not a dictionary or string.
@@ -126,10 +127,10 @@ def list(self, roomId=None, personId=None, personEmail=None, max=None):
126
127
container.
127
128
128
129
Args:
129
- roomId(str ): List memberships for the room with roomId.
130
- personId(str ): Filter results to include only those with
130
+ roomId(basestring ): List memberships for the room with roomId.
131
+ personId(basestring ): Filter results to include only those with
131
132
personId.
132
- personEmail(str ): Filter results to include only those
133
+ personEmail(basestring ): Filter results to include only those
133
134
with personEmail.
134
135
max(int): Limits the maximum number of memberships returned from
135
136
the Spark service per request.
@@ -147,9 +148,9 @@ def list(self, roomId=None, personId=None, personEmail=None, max=None):
147
148
148
149
"""
149
150
# Process args
150
- assert roomId is None or isinstance (roomId , str )
151
- assert personId is None or isinstance (personId , str )
152
- assert personEmail is None or isinstance (personEmail , str )
151
+ assert roomId is None or isinstance (roomId , basestring )
152
+ assert personId is None or isinstance (personId , basestring )
153
+ assert personEmail is None or isinstance (personEmail , basestring )
153
154
assert max is None or isinstance (max , int )
154
155
params = {}
155
156
if roomId :
@@ -180,10 +181,10 @@ def create(self, roomId, personId=None, personEmail=None,
180
181
making them a moderator.
181
182
182
183
Args:
183
- roomId(str ): ID of the room to which the person will be
184
+ roomId(basestring ): ID of the room to which the person will be
184
185
added.
185
- personId(str ): ID of the person to be added to the room.
186
- personEmail(str ): Email address of the person to be added
186
+ personId(basestring ): ID of the person to be added to the room.
187
+ personEmail(basestring ): Email address of the person to be added
187
188
to the room.
188
189
isModerator(bool): If True, adds the person as a moderator for the
189
190
room. If False, adds the person as normal member of the room.
@@ -199,9 +200,9 @@ def create(self, roomId, personId=None, personEmail=None,
199
200
200
201
"""
201
202
# Process args
202
- assert isinstance (roomId , str )
203
- assert personId is None or isinstance (personId , str )
204
- assert personEmail is None or isinstance (personEmail , str )
203
+ assert isinstance (roomId , basestring )
204
+ assert personId is None or isinstance (personId , basestring )
205
+ assert personEmail is None or isinstance (personEmail , basestring )
205
206
assert isModerator is None or isinstance (isModerator , bool )
206
207
post_data = {}
207
208
post_data ['roomId' ] = roomId
@@ -223,7 +224,7 @@ def get(self, membershipId):
223
224
"""Get details for a membership by ID.
224
225
225
226
Args:
226
- membershipId(str ): The membershipId of the membership.
227
+ membershipId(basestring ): The membershipId of the membership.
227
228
228
229
Returns:
229
230
Membership: With the details of the requested membership.
@@ -234,7 +235,7 @@ def get(self, membershipId):
234
235
235
236
"""
236
237
# Process args
237
- assert isinstance (membershipId , str )
238
+ assert isinstance (membershipId , basestring )
238
239
# API request
239
240
json_obj = self ._session .get ('memberships/' + membershipId )
240
241
# Return a Membership object created from the response JSON data
@@ -244,7 +245,7 @@ def update(self, membershipId, **update_attributes):
244
245
"""Update details for a membership.
245
246
246
247
Args:
247
- membershipId(str ): The membershipId of the membership to
248
+ membershipId(basestring ): The membershipId of the membership to
248
249
be updated.
249
250
isModerator(bool): If True, sets the person as a moderator for the
250
251
room. If False, removes the person as a moderator for the room.
@@ -259,7 +260,7 @@ def update(self, membershipId, **update_attributes):
259
260
260
261
"""
261
262
# Process args
262
- assert isinstance (membershipId , str )
263
+ assert isinstance (membershipId , basestring )
263
264
# Process update_attributes keyword arguments
264
265
if not update_attributes :
265
266
error_message = "At least one **update_attributes keyword " \
@@ -275,7 +276,7 @@ def delete(self, membershipId):
275
276
"""Delete a membership, by ID.
276
277
277
278
Args:
278
- membershipId(str ): The membershipId of the membership to
279
+ membershipId(basestring ): The membershipId of the membership to
279
280
be deleted.
280
281
281
282
Raises:
@@ -284,6 +285,6 @@ def delete(self, membershipId):
284
285
285
286
"""
286
287
# Process args
287
- assert isinstance (membershipId , str )
288
+ assert isinstance (membershipId , basestring )
288
289
# API request
289
290
self ._session .delete ('memberships/' + membershipId )
0 commit comments