@@ -886,7 +886,7 @@ def add_archive_stream(
886
886
elif response .status_code == 409 :
887
887
raise ArchiveError (response .json ().get ("message" ))
888
888
else :
889
- raise RequestError ("An unexpected error occurred" , response .status_code )
889
+ raise RequestError ("An unexpected error occurred. " , response .status_code )
890
890
891
891
def remove_archive_stream (
892
892
self , archive_id : str , stream_id : str
@@ -933,7 +933,7 @@ def remove_archive_stream(
933
933
elif response .status_code == 409 :
934
934
raise ArchiveError (response .json ().get ("message" ))
935
935
else :
936
- raise RequestError ("An unexpected error occurred" , response .status_code )
936
+ raise RequestError ("An unexpected error occurred. " , response .status_code )
937
937
938
938
def send_signal (self , session_id , payload , connection_id = None ):
939
939
"""
@@ -966,26 +966,27 @@ def send_signal(self, session_id, payload, connection_id=None):
966
966
timeout = self .timeout ,
967
967
)
968
968
969
- if response .status_code == 204 :
970
- pass
971
- elif response .status_code == 400 :
972
- raise SignalingError (
973
- "One of the signal properties - data, type, sessionId or connectionId - is invalid."
974
- )
975
- elif response .status_code == 403 :
976
- raise AuthError (
977
- "You are not authorized to send the signal. Check your authentication credentials."
978
- )
979
- elif response .status_code == 404 :
980
- raise SignalingError (
981
- "The client specified by the connectionId property is not connected to the session."
982
- )
983
- elif response .status_code == 413 :
984
- raise SignalingError (
985
- "The type string exceeds the maximum length (128 bytes), or the data string exceeds the maximum size (8 kB)."
986
- )
969
+ if response :
970
+ if response .status_code == 204 :
971
+ return None
972
+ elif response .status_code == 400 :
973
+ raise SignalingError (
974
+ "One of the signal properties - data, type, sessionId or connectionId - is invalid."
975
+ )
976
+ elif response .status_code == 403 :
977
+ raise AuthError (
978
+ "You are not authorized to send the signal. Check your authentication credentials."
979
+ )
980
+ elif response .status_code == 404 :
981
+ raise SignalingError (
982
+ "The client specified by the connectionId property is not connected to the session."
983
+ )
984
+ elif response .status_code == 413 :
985
+ raise SignalingError (
986
+ "The type string exceeds the maximum length (128 bytes), or the data string exceeds the maximum size (8 kB)."
987
+ )
987
988
else :
988
- raise RequestError ("An unexpected error occurred" , response .status_code )
989
+ raise RequestError ("An unexpected error occurred. " , response .status_code )
989
990
990
991
def signal (self , session_id , payload , connection_id = None ):
991
992
warnings .warn (
@@ -1561,24 +1562,25 @@ def add_broadcast_stream(
1561
1562
)
1562
1563
1563
1564
if response :
1564
- return Broadcast (response .json ())
1565
- elif response .status_code == 400 :
1566
- raise BroadcastError (
1567
- "Invalid request. This response may indicate that data in your request data is "
1568
- "invalid JSON. It may also indicate that you passed in invalid layout options. "
1569
- "Or you have exceeded the limit of five simultaneous RTMP streams for an OpenTok "
1570
- "session. Or you specified and invalid resolution."
1571
- )
1572
- elif response .status_code == 403 :
1573
- raise AuthError ("Authentication error." )
1574
- elif response .status_code == 405 :
1575
- raise BroadcastStreamModeError (
1576
- "Your broadcast is configured with a streamMode that does not support stream manipulation."
1577
- )
1578
- elif response .status_code == 409 :
1579
- raise BroadcastError ("The broadcast has already started for the session." )
1565
+ if response .status_code == 204 :
1566
+ return None
1567
+ elif response .status_code == 400 :
1568
+ raise BroadcastError (
1569
+ "Invalid request. This response may indicate that data in your request data is "
1570
+ "invalid JSON. It may also indicate that you passed in invalid layout options. "
1571
+ "Or you have exceeded the limit of five simultaneous RTMP streams for an OpenTok "
1572
+ "session. Or you specified and invalid resolution."
1573
+ )
1574
+ elif response .status_code == 403 :
1575
+ raise AuthError ("Authentication error." )
1576
+ elif response .status_code == 405 :
1577
+ raise BroadcastStreamModeError (
1578
+ "Your broadcast is configured with a streamMode that does not support stream manipulation."
1579
+ )
1580
+ elif response .status_code == 409 :
1581
+ raise BroadcastError ("The broadcast has already started for the session." )
1580
1582
else :
1581
- raise RequestError ("OpenTok server error." , response .status_code )
1583
+ raise RequestError ("An unexpected error occurred ." , response .status_code )
1582
1584
1583
1585
def remove_broadcast_stream (
1584
1586
self , broadcast_id : str , stream_id : str
@@ -1603,22 +1605,23 @@ def remove_broadcast_stream(
1603
1605
)
1604
1606
1605
1607
if response :
1606
- return Broadcast (response .json ())
1607
- elif response .status_code == 400 :
1608
- raise BroadcastError (
1609
- "Invalid request. This response may indicate that data in your request data is "
1610
- "invalid JSON. It may also indicate that you passed in invalid layout options. "
1611
- "Or you have exceeded the limit of five simultaneous RTMP streams for an OpenTok "
1612
- "session. Or you specified and invalid resolution."
1613
- )
1614
- elif response .status_code == 403 :
1615
- raise AuthError ("Authentication error." )
1616
- elif response .status_code == 405 :
1617
- raise BroadcastStreamModeError (
1618
- "Your broadcast is configured with a streamMode that does not support stream manipulation."
1619
- )
1620
- elif response .status_code == 409 :
1621
- raise BroadcastError ("The broadcast has already started for the session." )
1608
+ if response .status_code == 204 :
1609
+ return None
1610
+ elif response .status_code == 400 :
1611
+ raise BroadcastError (
1612
+ "Invalid request. This response may indicate that data in your request data is "
1613
+ "invalid JSON. It may also indicate that you passed in invalid layout options. "
1614
+ "Or you have exceeded the limit of five simultaneous RTMP streams for an OpenTok "
1615
+ "session. Or you specified and invalid resolution."
1616
+ )
1617
+ elif response .status_code == 403 :
1618
+ raise AuthError ("Authentication error." )
1619
+ elif response .status_code == 405 :
1620
+ raise BroadcastStreamModeError (
1621
+ "Your broadcast is configured with a streamMode that does not support stream manipulation."
1622
+ )
1623
+ elif response .status_code == 409 :
1624
+ raise BroadcastError ("The broadcast has already started for the session." )
1622
1625
else :
1623
1626
raise RequestError ("OpenTok server error." , response .status_code )
1624
1627
0 commit comments