Skip to content

Commit 68c696a

Browse files
authored
Validate session_id is a string in Session constructor (fixes #116) (#119)
* Validate session_id is a string in Session constructor (fixes #116)
1 parent 169715e commit 68c696a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

opentok/session.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from six import text_type, u
2+
from .exceptions import OpenTokException
3+
14
class Session(object):
25
"""
36
Represents an OpenTok session.
@@ -8,6 +11,8 @@ class Session(object):
811
:ivar String session_id: The session ID.
912
"""
1013
def __init__(self, sdk, session_id, **kwargs):
14+
if not text_type(session_id):
15+
raise OpenTokException(u('Cannot instantiate Session, session_id was not valid {0}').format(session_id))
1116
self.session_id = session_id
1217
self.sdk = sdk
1318
for key, value in kwargs.items():

0 commit comments

Comments
 (0)