Skip to content

Commit 474adb7

Browse files
committed
Correct minor utf8, PEP8 and docstrings issues
1 parent 4fe4134 commit 474adb7

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

ciscosparkapi/api/people.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ def list(self, email=None, displayName=None, max=None):
9191
9292
An email address or displayName must be provided.
9393
94-
This method supports Cisco Spark's implmentation of RFC5988 Web Linking
95-
to provide pagination support. It returns a generator container that
96-
incrementally yield all people returned by the query. The generator
97-
will automatically request additional 'pages' of responses from Spark
98-
as needed until all responses have been returned. The container makes
99-
the generator safe for reuse. A new API call will be made, using the
100-
same parameters that were specified when the generator was created,
101-
every time a new iterator is requested from the container.
94+
This method supports Cisco Spark's implementation of RFC5988 Web
95+
Linking to provide pagination support. It returns a generator
96+
container that incrementally yield all people returned by the
97+
query. The generator will automatically request additional 'pages' of
98+
responses from Spark as needed until all responses have been returned.
99+
The container makes the generator safe for reuse. A new API call will
100+
be made, using the same parameters that were specified when the
101+
generator was created, every time a new iterator is requested from the
102+
container.
102103
103104
Args:
104105
email(unicode, str): The e-mail address of the person to be found.
@@ -123,9 +124,9 @@ def list(self, email=None, displayName=None, max=None):
123124
assert max is None or isinstance(max, int)
124125
params = {}
125126
if email:
126-
params[u'email'] = email
127+
params[u'email'] = utf8(email)
127128
elif displayName:
128-
params[u'displayName'] = displayName
129+
params[u'displayName'] = utf8(displayName)
129130
else:
130131
error_message = "An email or displayName argument must be " \
131132
"specified."

ciscosparkapi/api/rooms.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ def list(self, max=None, **query_params):
102102
103103
By default, lists rooms to which the authenticated user belongs.
104104
105-
This method supports Cisco Spark's implmentation of RFC5988 Web Linking
106-
to provide pagination support. It returns a generator container that
107-
incrementally yield all rooms returned by the query. The generator
108-
will automatically request additional 'pages' of responses from Spark
109-
as needed until all responses have been returned. The container makes
110-
the generator safe for reuse. A new API call will be made, using the
111-
same parameters that were specified when the generator was created,
112-
every time a new iterator is requested from the container.
105+
This method supports Cisco Spark's implementation of RFC5988 Web
106+
Linking to provide pagination support. It returns a generator
107+
container that incrementally yield all rooms returned by the
108+
query. The generator will automatically request additional 'pages' of
109+
responses from Spark as needed until all responses have been returned.
110+
The container makes the generator safe for reuse. A new API call will
111+
be made, using the same parameters that were specified when the
112+
generator was created, every time a new iterator is requested from the
113+
container.
113114
114115
Args:
115116
max(int): Limits the maximum number of rooms returned from the
@@ -132,11 +133,13 @@ def list(self, max=None, **query_params):
132133
# Process args
133134
assert max is None or isinstance(max, int)
134135
params = {}
135-
if max: params[u'max'] = max
136+
if max:
137+
params[u'max'] = max
136138
# Process query_param keyword arguments
137139
if query_params:
138140
for param, value in query_params.items():
139-
if isinstance(value, basestring): value = utf8(value)
141+
if isinstance(value, basestring):
142+
value = utf8(value)
140143
params[utf8(param)] = value
141144
# API request - get items
142145
items = self.session.get_items('rooms', params=params)
@@ -164,10 +167,11 @@ def create(self, title, teamId=None):
164167
assert teamId is None or isinstance(teamId, basestring)
165168
post_data = {}
166169
post_data[u'title'] = utf8(title)
167-
if teamId: post_data[u'teamId'] = utf8(teamId)
170+
if teamId:
171+
post_data[u'teamId'] = utf8(teamId)
168172
# API request
169173
json_obj = self.session.post('rooms', json=post_data)
170-
# Return a Person object created from the response JSON data
174+
# Return a Room object created from the response JSON data
171175
return Room(json_obj)
172176

173177
def get(self, roomId):
@@ -185,7 +189,7 @@ def get(self, roomId):
185189
assert isinstance(roomId, basestring)
186190
# API request
187191
json_obj = self.session.get('rooms/'+roomId)
188-
# Return a Person object created from the response JSON data
192+
# Return a Room object created from the response JSON data
189193
return Room(json_obj)
190194

191195
def update(self, roomId, **update_attributes):
@@ -215,11 +219,12 @@ def update(self, roomId, **update_attributes):
215219
raise ciscosparkapiException(error_message)
216220
put_data = {}
217221
for param, value in update_attributes.items():
218-
if isinstance(value, basestring): value = utf8(value)
222+
if isinstance(value, basestring):
223+
value = utf8(value)
219224
put_data[utf8(param)] = value
220225
# API request
221226
json_obj = self.session.post('rooms', json=put_data)
222-
# Return a Person object created from the response JSON data
227+
# Return a Room object created from the response JSON data
223228
return Room(json_obj)
224229

225230
def delete(self, roomId):

0 commit comments

Comments
 (0)