Skip to content

Commit f4c1d67

Browse files
committed
more unblackening
1 parent 72d6f33 commit f4c1d67

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

do not commit.md

Whitespace-only changes.

opentok/opentok.py

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,23 @@ def create_session(
367367
# build options
368368
options = {}
369369
if not isinstance(media_mode, MediaModes):
370-
raise OpenTokException(u("Cannot create session, {0} is not a valid media mode").format(media_mode))
370+
raise OpenTokException(
371+
u("Cannot create session, {0} is not a valid media mode").format(
372+
media_mode
373+
)
374+
)
371375
if not isinstance(archive_mode, ArchiveModes):
372-
raise OpenTokException(u("Cannot create session, {0} is not a valid archive mode").format(archive_mode))
376+
raise OpenTokException(
377+
u("Cannot create session, {0} is not a valid archive mode").format(
378+
archive_mode
379+
)
380+
)
373381
if archive_mode == ArchiveModes.always and media_mode != MediaModes.routed:
374-
raise OpenTokException(u("A session with always archive mode must also have the routed media mode."))
382+
raise OpenTokException(
383+
u(
384+
"A session with always archive mode must also have the routed media mode."
385+
)
386+
)
375387
options[u("p2p.preference")] = media_mode.value
376388
options[u("archiveMode")] = archive_mode.value
377389
if location:
@@ -380,9 +392,9 @@ def create_session(
380392
inet_aton(location)
381393
except:
382394
raise OpenTokException(
383-
u("Cannot create session. Location must be either None or a valid IPv4 address {0}").format(
384-
location
385-
)
395+
u(
396+
"Cannot create session. Location must be either None or a valid IPv4 address {0}"
397+
).format(location)
386398
)
387399
options[u("location")] = location
388400
options["e2ee"] = e2ee
@@ -402,7 +414,6 @@ def create_session(
402414
proxies=self.proxies,
403415
timeout=self.timeout,
404416
)
405-
406417
response.encoding = "utf-8"
407418

408419
if response.status_code == 403:
@@ -437,31 +448,6 @@ def create_session(
437448
except Exception as e:
438449
raise OpenTokException("Failed to generate session: %s" % str(e))
439450

440-
try:
441-
error = dom.getElementsByTagName("error")
442-
if error:
443-
error = error[0]
444-
raise AuthError(
445-
"Failed to create session (code=%s): %s"
446-
% (
447-
error.attributes["code"].value,
448-
error.firstChild.attributes["message"].value,
449-
)
450-
)
451-
452-
session_id = (
453-
dom.getElementsByTagName("session_id")[0].childNodes[0].nodeValue
454-
)
455-
return Session(
456-
self,
457-
session_id,
458-
location=location,
459-
media_mode=media_mode,
460-
archive_mode=archive_mode,
461-
)
462-
except Exception as e:
463-
raise OpenTokException("Failed to generate session: %s" % str(e))
464-
465451
def get_headers(self):
466452
"""For internal use."""
467453
return {

0 commit comments

Comments
 (0)