@@ -886,7 +886,7 @@ def add_archive_stream(
886886 elif response .status_code == 409 :
887887 raise ArchiveError (response .json ().get ("message" ))
888888 else :
889- raise RequestError ("An unexpected error occurred" , response .status_code )
889+ raise RequestError ("An unexpected error occurred. " , response .status_code )
890890
891891 def remove_archive_stream (
892892 self , archive_id : str , stream_id : str
@@ -933,7 +933,7 @@ def remove_archive_stream(
933933 elif response .status_code == 409 :
934934 raise ArchiveError (response .json ().get ("message" ))
935935 else :
936- raise RequestError ("An unexpected error occurred" , response .status_code )
936+ raise RequestError ("An unexpected error occurred. " , response .status_code )
937937
938938 def send_signal (self , session_id , payload , connection_id = None ):
939939 """
@@ -966,26 +966,27 @@ def send_signal(self, session_id, payload, connection_id=None):
966966 timeout = self .timeout ,
967967 )
968968
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+ )
987988 else :
988- raise RequestError ("An unexpected error occurred" , response .status_code )
989+ raise RequestError ("An unexpected error occurred. " , response .status_code )
989990
990991 def signal (self , session_id , payload , connection_id = None ):
991992 warnings .warn (
@@ -1561,24 +1562,25 @@ def add_broadcast_stream(
15611562 )
15621563
15631564 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." )
15801582 else :
1581- raise RequestError ("OpenTok server error." , response .status_code )
1583+ raise RequestError ("An unexpected error occurred ." , response .status_code )
15821584
15831585 def remove_broadcast_stream (
15841586 self , broadcast_id : str , stream_id : str
@@ -1603,22 +1605,23 @@ def remove_broadcast_stream(
16031605 )
16041606
16051607 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." )
16221625 else :
16231626 raise RequestError ("OpenTok server error." , response .status_code )
16241627
0 commit comments