{"id":18465159,"url":"https://github.com/fishjam-dev/python-server-sdk","last_synced_at":"2026-01-25T10:32:31.713Z","repository":{"id":192582194,"uuid":"685002721","full_name":"fishjam-dev/python-server-sdk","owner":"fishjam-dev","description":"Python server SDK for Fishjam","archived":false,"fork":false,"pushed_at":"2024-06-17T12:38:18.000Z","size":8513,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T23:06:35.552Z","etag":null,"topics":["fishjam","membrane-framework","python","video","webrtc"],"latest_commit_sha":null,"homepage":"https://jellyfish-dev.github.io/python-server-sdk/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fishjam-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-30T09:55:00.000Z","updated_at":"2024-10-08T21:14:42.000Z","dependencies_parsed_at":"2024-01-09T16:00:54.910Z","dependency_job_id":"79108ff8-9d3b-49b3-a967-e2af2b4177e6","html_url":"https://github.com/fishjam-dev/python-server-sdk","commit_stats":null,"previous_names":["jellyfish-dev/python-server-sdk","fishjam-dev/python-server-sdk"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjam-dev%2Fpython-server-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjam-dev%2Fpython-server-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjam-dev%2Fpython-server-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fishjam-dev%2Fpython-server-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fishjam-dev","download_url":"https://codeload.github.com/fishjam-dev/python-server-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804548,"owners_count":20999010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fishjam","membrane-framework","python","video","webrtc"],"created_at":"2024-11-06T09:12:10.640Z","updated_at":"2026-01-25T10:32:31.700Z","avatar_url":"https://github.com/fishjam-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fishjam Python Server SDK\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/fishjam-dev/python-server-sdk/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/fishjam-dev/python-server-sdk/tree/main)\n\nPython server SDK for the [Fishjam Media Server](https://github.com/fishjam-dev/fishjam).\n\nRead the docs [here](https://fishjam-dev.github.io/python-server-sdk)\n\n## Installation\n\n```\npip install fishjam-server-sdk\n```\n\n## Usage\n\nThe SDK exports two main classes for interacting with Fishjam server:\n`RoomApi` and `Notifier`.\n\n`RoomApi` wraps http REST api calls, while `Notifier` is responsible for receiving real-time updates from the server.\n\n#### RoomApi\n\nCreate a `RoomApi` instance, providing the fishjam server address and api token\n\n```python\nfrom fishjam import RoomApi\n\nroom_api = RoomApi(server_address=\"localhost:5002\", server_api_token=\"development\")\n```\n\nYou can use it to interact with Fishjam, manage rooms, peers and components\n\n```python\n# Create a room\nfishjam_address, room = room_api.create_room(video_codec=\"h264\", webhook_url=\"http://localhost:5000/webhook\")\n# '127.0.0.1:5002', Room(components=[], config=RoomConfig(max_peers=None, video_codec=\u003cRoomConfigVideoCodec.H264: 'h264'\u003e, webhook_url='http://localhost:5000/webhook'), id='1d905478-ccfc-44d6-a6e7-8ccb1b38d955', peers=[])\n\n# Add peer to the room\nfrom fishjam import PeerOptionsWebRTC\n\npeer_token, peer_webrtc = room_api.add_peer(room.id, options=PeerOptionsWebRTC())\n# 'M8TUGhj-L11KpyG-2zBPIo', Peer(id='b1232c7e-c969-4450-acdf-ea24f3cdd7f6', status=\u003cPeerStatus.DISCONNECTED: 'disconnected'\u003e, type='webrtc')\n\n# Add component to the room\nfrom fishjam import ComponentOptionsHLS\n\ncomponent_hls = room_api.add_component(room.id, options=ComponentOptionsHLS())\n# ComponentHLS(id='5f062447-a9f7-45ed-8d1b-511f77dc78ae', properties=ComponentPropertiesHLS(low_latency=False, persistent=False, playable=False, subscribe_mode=\u003cComponentPropertiesHLSSubscribeMode.AUTO: 'auto'\u003e, target_window_duration=None), type='hls')\n```\n\nAll methods in `RoomApi` may raise one of the exceptions deriving from `fishjam.errors.HTTPError`. They are defined in `fishjam.errors`.\n\n#### Notifier\n\nNotifier allows for receiving real-time updates from the Fishjam Server.\n\nYou can read more about notifications in the [Fishjam Docs](https://fishjam-dev.github.io/fishjam-docs/next/getting_started/notifications).\n\nCreate `Notifier` instance\n```python\nfrom fishjam import Notifier\n\nnotifier = Notifier(server_address='localhost:5002', server_api_token='development')\n```\n\nThen define handlers for incoming messages\n```python\n@notifier.on_server_notification\ndef handle_notification(server_notification):\n    print(f'Received a notification: {server_notification}')\n\n@notifier.on_metrics\ndef handle_metrics(metrics_report):\n    print(f'Received WebRTC metrics: {metrics_report}')\n```\n\nAfter that you can start the notifier\n```python\nasync def test_notifier():\n    notifier_task = asyncio.create_task(notifier.connect())\n\n    # Wait for notifier to be ready to receive messages\n    await notifier.wait_ready()\n\n    # Create a room to trigger a server notification\n    room_api = RoomApi()\n    room_api.create_room()\n\n    await notifier_task\n\nasyncio.run(test_notifier())\n\n# Received a notification: ServerMessageRoomCreated(room_id='69a3fd1a-6a4d-47bc-ae54-0c72b0d05e29')\n# Received WebRTC metrics: ServerMessageMetricsReport(metrics='{}')\n```\n\n#### Cluster of Fishjams\n\nThe cluster of fishjams has got embedded load balancer, which means that a new room will be created on fishjam with the least usage. At the moment to modify this specific room you must communicate with the fishjam on which this room was created.\n\n```python\nroom_api = RoomApi(server_address='localhost:5002')\n\n# Create a room to trigger a server notification with h264 as a codec,\n# that allow to use HLS.\naddress, room = room_api.create_room(video_codec=\"h264\")\n\n# Create new room api with returned fishjam address as a room could be\n# created on a different fishjam instance\n# (if you communicate with a cluster of fishjams)\nnew_room_api = RoomApi(server_address=address)\n\n# Add HLS component with manual subscribe mode, we use here `new_room_api` as we are sure that this API refers to the fishjam on which this room was created.\n_hls_component = new_room_api.add_component(\n    room.id,\n    ComponentOptionsHLS(subscribe_mode=ComponentOptionsHLSSubscribeMode.MANUAL),\n)\n```\n\n## Testing\n\nYou can test the SDK by running\n```console\npoetry run ci_test\n```\n\nIn local development you can use\n```console\npoetry run local_test\n```\n\n## Format \u0026 Lint\nYou can format code by running\n```console\npoetry run format\n```\n\nYou can check linter by running\n```console\npoetry run lint\n```\n\n## Copyright and License\n\nCopyright 2023, [Software Mansion](https://swmansion.com/?utm_source=git\u0026utm_medium=readme\u0026utm_campaign=fishjam)\n\n[![Software Mansion](https://logo.swmansion.com/logo?color=white\u0026variant=desktop\u0026width=200\u0026tag=membrane-github)](https://swmansion.com/?utm_source=git\u0026utm_medium=readme\u0026utm_campaign=fishjam)\n\nLicensed under the [Apache License, Version 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishjam-dev%2Fpython-server-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishjam-dev%2Fpython-server-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishjam-dev%2Fpython-server-sdk/lists"}