Skip to content

Commit e249eb6

Browse files
committed
Merge branch 'development'
2 parents 8c438b7 + cbed76f commit e249eb6

30 files changed

+178
-290
lines changed

ciscosparkapi/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
unicode_literals,
1111
)
1212
from builtins import *
13-
1413
from past.builtins import basestring
1514

1615
import os
@@ -101,10 +100,10 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
101100
via one of these two methods.
102101
103102
Args:
104-
access_token(str): The access token to be used for API
103+
access_token(basestring): The access token to be used for API
105104
calls to the Cisco Spark service. Defaults to checking for a
106105
SPARK_ACCESS_TOKEN environment variable.
107-
base_url(str): The base URL to be prefixed to the
106+
base_url(basestring): The base URL to be prefixed to the
108107
individual API endpoint suffixes.
109108
Defaults to ciscosparkapi.DEFAULT_BASE_URL.
110109
timeout(int): Timeout (in seconds) for RESTful HTTP requests.
@@ -122,7 +121,7 @@ def __init__(self, access_token=None, base_url=DEFAULT_BASE_URL,
122121
"""
123122
# Process args
124123
assert access_token is None or isinstance(access_token, basestring)
125-
assert isinstance(base_url, str)
124+
assert isinstance(base_url, basestring)
126125
assert isinstance(timeout, int)
127126
spark_access_token = os.environ.get(ACCESS_TOKEN_ENVIRONMENT_VARIABLE)
128127
access_token = access_token if access_token else spark_access_token

ciscosparkapi/api/accesstokens.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
unicode_literals,
1919
)
2020
from builtins import *
21+
from past.builtins import basestring
2122
from future import standard_library
2223
standard_library.install_aliases()
2324

@@ -50,7 +51,7 @@ def __init__(self, json):
5051
"""Init a new AccessToken data object from a JSON dictionary or string.
5152
5253
Args:
53-
json(dict, str): Input JSON object.
54+
json(dict, basestring): Input JSON object.
5455
5556
Raises:
5657
TypeError: If the input object is not a dictionary or string.
@@ -91,14 +92,14 @@ def __init__(self, base_url, timeout=None):
9192
"""Init a new AccessTokensAPI object with the provided RestSession.
9293
9394
Args:
94-
base_url(str): The base URL the API endpoints.
95+
base_url(basestring): The base URL the API endpoints.
9596
timeout(int): Timeout in seconds for the API requests.
9697
9798
Raises:
9899
AssertionError: If the parameter types are incorrect.
99100
100101
"""
101-
assert isinstance(base_url, str)
102+
assert isinstance(base_url, basestring)
102103
assert timeout is None or isinstance(timeout, int)
103104
super(AccessTokensAPI, self).__init__()
104105
self._base_url = str(validate_base_url(base_url))
@@ -122,13 +123,13 @@ def get(self, client_id, client_secret, code, redirect_uri):
122123
invoke the APIs.
123124
124125
Args:
125-
client_id(str): Provided when you created your
126+
client_id(basestring): Provided when you created your
126127
integration.
127-
client_secret(str): Provided when you created your
128+
client_secret(basestring): Provided when you created your
128129
integration.
129-
code(str): The Authorization Code provided by the user
130+
code(basestring): The Authorization Code provided by the user
130131
OAuth process.
131-
redirect_uri(str): The redirect URI used in the user OAuth
132+
redirect_uri(basestring): The redirect URI used in the user OAuth
132133
process.
133134
134135
Returns:
@@ -141,10 +142,10 @@ def get(self, client_id, client_secret, code, redirect_uri):
141142
142143
"""
143144
# Process args
144-
assert isinstance(client_id, str)
145-
assert isinstance(client_secret, str)
146-
assert isinstance(code, str)
147-
assert isinstance(redirect_uri, str)
145+
assert isinstance(client_id, basestring)
146+
assert isinstance(client_secret, basestring)
147+
assert isinstance(code, basestring)
148+
assert isinstance(redirect_uri, basestring)
148149
# Build request parameters
149150
data = {}
150151
data["grant_type"] = "authorization_code"
@@ -164,11 +165,11 @@ def refresh(self, client_id, client_secret, refresh_token):
164165
"""Return a refreshed Access Token via the provided refresh_token.
165166
166167
Args:
167-
client_id(str): Provided when you created your
168+
client_id(basestring): Provided when you created your
168169
integration.
169-
client_secret(str): Provided when you created your
170+
client_secret(basestring): Provided when you created your
170171
integration.
171-
refresh_token(str): Provided when you requested the Access
172+
refresh_token(basestring): Provided when you requested the Access
172173
Token.
173174
174175
Returns:
@@ -181,9 +182,9 @@ def refresh(self, client_id, client_secret, refresh_token):
181182
182183
"""
183184
# Process args
184-
assert isinstance(client_id, str)
185-
assert isinstance(client_secret, str)
186-
assert isinstance(refresh_token, str)
185+
assert isinstance(client_id, basestring)
186+
assert isinstance(client_secret, basestring)
187+
assert isinstance(refresh_token, basestring)
187188
# Build request parameters
188189
data = {}
189190
data["grant_type"] = "refresh_token"

ciscosparkapi/api/licenses.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
unicode_literals,
1818
)
1919
from builtins import *
20+
from past.builtins import basestring
2021

2122
from ciscosparkapi.utils import generator_container
2223
from ciscosparkapi.restsession import RestSession
@@ -36,7 +37,7 @@ def __init__(self, json):
3637
"""Init a new License data object from a dict or JSON string.
3738
3839
Args:
39-
json(dict, str): Input JSON object.
40+
json(dict, basestring): Input JSON object.
4041
4142
Raises:
4243
TypeError: If the input object is not a dictionary or string.
@@ -105,7 +106,7 @@ def list(self, orgId=None, max=None):
105106
container.
106107
107108
Args:
108-
orgId(str): Filters the returned licenses to only include
109+
orgId(basestring): Filters the returned licenses to only include
109110
those liceses associated with the specified Organization
110111
(orgId).
111112
max(int): Limits the maximum number of entries returned from the
@@ -122,7 +123,7 @@ def list(self, orgId=None, max=None):
122123
123124
"""
124125
# Process args
125-
assert orgId is None or isinstance(orgId, str)
126+
assert orgId is None or isinstance(orgId, basestring)
126127
assert max is None or isinstance(max, int)
127128
params = {}
128129
if orgId:
@@ -139,7 +140,7 @@ def get(self, licenseId):
139140
"""Get the details of a License, by id.
140141
141142
Args:
142-
licenseId(str): The id of the License.
143+
licenseId(basestring): The id of the License.
143144
144145
Returns:
145146
License: With the details of the requested License.
@@ -150,7 +151,7 @@ def get(self, licenseId):
150151
151152
"""
152153
# Process args
153-
assert isinstance(licenseId, str)
154+
assert isinstance(licenseId, basestring)
154155
# API request
155156
json_obj = self._session.get('licenses/' + licenseId)
156157
# Return a License object created from the returned JSON object

ciscosparkapi/api/memberships.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
unicode_literals,
1919
)
2020
from builtins import *
21+
from past.builtins import basestring
2122

2223
from ciscosparkapi.exceptions import ciscosparkapiException
2324
from ciscosparkapi.utils import generator_container
@@ -38,7 +39,7 @@ def __init__(self, json):
3839
"""Init a new Membership data object from a JSON dictionary or string.
3940
4041
Args:
41-
json(dict, str): Input JSON object.
42+
json(dict, basestring): Input JSON object.
4243
4344
Raises:
4445
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):
126127
container.
127128
128129
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
131132
personId.
132-
personEmail(str): Filter results to include only those
133+
personEmail(basestring): Filter results to include only those
133134
with personEmail.
134135
max(int): Limits the maximum number of memberships returned from
135136
the Spark service per request.
@@ -147,9 +148,9 @@ def list(self, roomId=None, personId=None, personEmail=None, max=None):
147148
148149
"""
149150
# 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)
153154
assert max is None or isinstance(max, int)
154155
params = {}
155156
if roomId:
@@ -180,10 +181,10 @@ def create(self, roomId, personId=None, personEmail=None,
180181
making them a moderator.
181182
182183
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
184185
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
187188
to the room.
188189
isModerator(bool): If True, adds the person as a moderator for the
189190
room. If False, adds the person as normal member of the room.
@@ -199,9 +200,9 @@ def create(self, roomId, personId=None, personEmail=None,
199200
200201
"""
201202
# 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)
205206
assert isModerator is None or isinstance(isModerator, bool)
206207
post_data = {}
207208
post_data['roomId'] = roomId
@@ -223,7 +224,7 @@ def get(self, membershipId):
223224
"""Get details for a membership by ID.
224225
225226
Args:
226-
membershipId(str): The membershipId of the membership.
227+
membershipId(basestring): The membershipId of the membership.
227228
228229
Returns:
229230
Membership: With the details of the requested membership.
@@ -234,7 +235,7 @@ def get(self, membershipId):
234235
235236
"""
236237
# Process args
237-
assert isinstance(membershipId, str)
238+
assert isinstance(membershipId, basestring)
238239
# API request
239240
json_obj = self._session.get('memberships/' + membershipId)
240241
# Return a Membership object created from the response JSON data
@@ -244,7 +245,7 @@ def update(self, membershipId, **update_attributes):
244245
"""Update details for a membership.
245246
246247
Args:
247-
membershipId(str): The membershipId of the membership to
248+
membershipId(basestring): The membershipId of the membership to
248249
be updated.
249250
isModerator(bool): If True, sets the person as a moderator for the
250251
room. If False, removes the person as a moderator for the room.
@@ -259,7 +260,7 @@ def update(self, membershipId, **update_attributes):
259260
260261
"""
261262
# Process args
262-
assert isinstance(membershipId, str)
263+
assert isinstance(membershipId, basestring)
263264
# Process update_attributes keyword arguments
264265
if not update_attributes:
265266
error_message = "At least one **update_attributes keyword " \
@@ -275,7 +276,7 @@ def delete(self, membershipId):
275276
"""Delete a membership, by ID.
276277
277278
Args:
278-
membershipId(str): The membershipId of the membership to
279+
membershipId(basestring): The membershipId of the membership to
279280
be deleted.
280281
281282
Raises:
@@ -284,6 +285,6 @@ def delete(self, membershipId):
284285
285286
"""
286287
# Process args
287-
assert isinstance(membershipId, str)
288+
assert isinstance(membershipId, basestring)
288289
# API request
289290
self._session.delete('memberships/' + membershipId)

0 commit comments

Comments
 (0)