diff --git a/go2rtc_client/models.py b/go2rtc_client/models.py index d9804f5..964594b 100644 --- a/go2rtc_client/models.py +++ b/go2rtc_client/models.py @@ -58,7 +58,7 @@ def __pre_deserialize__(cls, d: dict[Any, Any]) -> dict[Any, Any]: class Producer: """Producer model.""" - url: str + url: str | None = None @dataclass diff --git a/tests/__snapshots__/test_rest.ambr b/tests/__snapshots__/test_rest.ambr index 032290b..a5e8360 100644 --- a/tests/__snapshots__/test_rest.ambr +++ b/tests/__snapshots__/test_rest.ambr @@ -45,6 +45,17 @@ }), }) # --- +# name: test_streams_get[whip producer without url] + dict({ + 'camera.kiosk_tablet': dict({ + 'producers': list([ + dict({ + 'url': None, + }), + ]), + }), + }) +# --- # name: test_streams_get[without producers] dict({ 'camera.12mp_fluent': dict({ diff --git a/tests/fixtures/streams_whip_producer.json b/tests/fixtures/streams_whip_producer.json new file mode 100644 index 0000000..8640f3e --- /dev/null +++ b/tests/fixtures/streams_whip_producer.json @@ -0,0 +1,34 @@ +{ + "camera.kiosk_tablet": { + "producers": [ + { + "id": 4439, + "format_name": "webrtc", + "protocol": "http+udp", + "remote_addr": "192.168.10.212:59793 host", + "user_agent": "Mozilla/5.0 (Linux; Android 8.1.0; Lenovo StarView Build/OPM7.181205.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/138.0.7204.181 Safari/537.36", + "medias": [ + "video, recvonly, H264", + "video, sendonly, VP8, VP9, H264" + ], + "receivers": [ + { + "id": 4440, + "codec": { + "codec_name": "h264", + "codec_type": "video" + }, + "childs": [ + 4447, + 4456 + ], + "bytes": 37630084, + "packets": 34687 + } + ], + "bytes_recv": 38330115 + } + ], + "consumers": [] + } +} diff --git a/tests/test_rest.py b/tests/test_rest.py index 9dfd83a..94afe0d 100644 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -50,11 +50,17 @@ async def test_application_info( @pytest.mark.parametrize( "filename", - ["streams_one.json", "streams_none.json", "streams_without_producers.json"], + [ + "streams_one.json", + "streams_none.json", + "streams_without_producers.json", + "streams_whip_producer.json", + ], ids=[ "one stream", "empty", "without producers", + "whip producer without url", ], ) async def test_streams_get(