Skip to content

Commit f81f4a6

Browse files
authored
Drop undocumented create_user_session_token (#102)
This method on `client` is exactly same with `create_user_token` and the implementation delegates to create_user_token and it is undocumented. To keep the code clean, dropped it.
1 parent 587e4af commit f81f4a6

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

stream/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,15 @@ def _parse_response(self, response):
169169
return parsed_result
170170

171171
def create_user_token(self, user_id, **extra_data):
172-
"""Setup the payload for the given user_id with optional
172+
"""
173+
Setup the payload for the given user_id with optional
173174
extra data (key, value pairs) and encode it using jwt
174175
"""
175176
payload = {"user_id": user_id}
176177
for k, v in extra_data.items():
177178
payload[k] = v
178179
return jwt.encode(payload, self.api_secret, algorithm="HS256").decode("utf-8")
179180

180-
def create_user_session_token(self, user_id, **extra_data):
181-
return self.create_user_token(user_id, **extra_data)
182-
183181
def create_jwt_token(self, resource, action, feed_id=None, user_id=None):
184182
"""
185183
Setup the payload for the given resource, action, feed or user

stream/tests/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,12 @@ def test_token_retrieval(self):
373373
self.user1.token
374374
self.user1.get_readonly_token()
375375

376-
def test_user_session_token(self):
376+
def test_user_token(self):
377377
client = stream.connect(self.c.api_key, self.c.api_secret)
378-
token = client.create_user_session_token("user")
378+
token = client.create_user_token("user")
379379
payload = jwt.decode(token, self.c.api_secret, algorithms=["HS256"])
380380
self.assertEqual(payload["user_id"], "user")
381-
token = client.create_user_session_token("user", client="python", testing=True)
381+
token = client.create_user_token("user", client="python", testing=True)
382382
payload = jwt.decode(token, self.c.api_secret, algorithms=["HS256"])
383383
self.assertEqual(payload["client"], "python")
384384
self.assertEqual(payload["testing"], True)

0 commit comments

Comments
 (0)