fastpix-python 0.1.0__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. fastpix_python-0.1.3/PKG-INFO +503 -0
  2. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/README.md +1 -1
  3. fastpix_python-0.1.3/fastpix_python.egg-info/PKG-INFO +503 -0
  4. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/setup.py +7 -2
  5. fastpix_python-0.1.0/PKG-INFO +0 -28
  6. fastpix_python-0.1.0/fastpix_python.egg-info/PKG-INFO +0 -28
  7. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/LICENSE +0 -0
  8. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/__init__.py +0 -0
  9. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/__init__.py +0 -0
  10. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/api.py +0 -0
  11. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/client.py +0 -0
  12. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/live_streams.py +0 -0
  13. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/media.py +0 -0
  14. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/async_client/playback_ids.py +0 -0
  15. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/__init__.py +0 -0
  16. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/api.py +0 -0
  17. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/client.py +0 -0
  18. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/live_streams.py +0 -0
  19. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/media.py +0 -0
  20. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/client/playback_ids.py +0 -0
  21. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/utilis/__init__.py +0 -0
  22. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/utilis/constants.py +0 -0
  23. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/utilis/exceptions.py +0 -0
  24. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix/utilis/utilis.py +0 -0
  25. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix_python.egg-info/SOURCES.txt +0 -0
  26. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix_python.egg-info/dependency_links.txt +0 -0
  27. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix_python.egg-info/requires.txt +0 -0
  28. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/fastpix_python.egg-info/top_level.txt +0 -0
  29. {fastpix_python-0.1.0 → fastpix_python-0.1.3}/setup.cfg +0 -0
@@ -0,0 +1,503 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastpix-python
3
+ Version: 0.1.3
4
+ Summary: FastPix SDK with both sync and async support
5
+ Home-page: https://github.com/fastpix-io/fastpix-python-server-sdk
6
+ Author: FastPix
7
+ Author-email: dev@fastpix.io
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: requests>=2.25.0
19
+ Provides-Extra: async
20
+ Requires-Dist: aiohttp>=3.8.0; extra == "async"
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: license-file
28
+ Dynamic: provides-extra
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ # Introduction:
34
+
35
+ The FastPix Python SDK simplifies integration with the FastPix platform. This SDK is designed for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, and simulcasting. It is intended for use with Python 3.7 or later.
36
+
37
+ ## Key Features:
38
+
39
+ - ### Media API:
40
+
41
+ - **Upload Media**: Upload media files seamlessly from URLs or devices.
42
+ - **Manage Media**: Perform operations such as listing, fetching, updating, and deleting media assets.
43
+ - **Playback IDs**: Generate and manage playback IDs for media access.
44
+
45
+ - ### Live API:
46
+
47
+ - **Create & Manage Live Streams:**: Create, list, update, and delete live streams effortlessly.
48
+ - **Control Stream Access**: Generate playback IDs for live streams to control and manage access.
49
+ - **Simulcast to Multiple Platforms**: Stream content to multiple platforms simultaneously.
50
+
51
+ For detailed usage, refer to the [FastPix API Reference](https://docs.fastpix.io/reference).
52
+
53
+ ## Latest Release
54
+ - Current Version: 0.1.3
55
+ - View our [changelog](CHANELOG.md) for details on recent updates
56
+ - Download the latest release from our [releases page](https://github.com/FastPix/python-server-sdk/releases/tag/v1.0.0)
57
+
58
+ ## Prerequisites:
59
+
60
+ ### Getting started with FastPix:
61
+
62
+ To get started with the **FastPix Python SDK**, ensure you have the following:
63
+
64
+ - The FastPix APIs are authenticated using an **Access Token** and a **Secret Key**. You must generate these credentials to use the SDK.
65
+
66
+ - Follow the steps in the [Authentication with Access Tokens](https://docs.fastpix.io/docs/authentication-with-access-tokens) guide to obtain your credentials.
67
+
68
+ ## Installation:
69
+
70
+ To install the SDK, use pip with the GitHub repository URL to easily download and install the required libraries.
71
+
72
+ ```bash
73
+ pip install git+https://github.com/FastPix/fastpix-python
74
+ ```
75
+ (you may need to run `pip` with root permission)
76
+
77
+ ## Basic Usage:
78
+
79
+ ### Importing the SDK
80
+
81
+ ```python
82
+ from fastpix-python import Client
83
+ ```
84
+
85
+ ### Initialization:
86
+
87
+ Initialize the FastPix SDK with your API credentials.
88
+
89
+ ```python
90
+ from fastpix-python import Client
91
+
92
+ client = Client(username="your-access-token-id", password="your-secret-key")
93
+ ```
94
+
95
+ ### Example Usage:
96
+
97
+ Below is an example of configuring `FastPix Python SDK` into your project.
98
+
99
+ `Note:-` For Async SDK Users: When using the AsyncClient, all SDK methods must be prefixed with the await keyword.
100
+ ```python
101
+ # Sync Usage
102
+ from fastpix-python import Client
103
+
104
+ client = Client(username="your-access-token-id", password="your-secret-key")
105
+
106
+ # Define the parameters for fetching media assets in a separate variable.
107
+ media_request_params = {
108
+ "limit": 10, # Number of media assets to fetch in one request.
109
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
110
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
111
+ }
112
+
113
+ try:
114
+ media = client.media.get_all_media(params=media_request_params)
115
+ print("Media:", media)
116
+ except Exception as e:
117
+ print(f"Error fetching media: {str(e)}")
118
+
119
+ # Async Usage
120
+ from fastpix import AsyncClient as Client
121
+ import asyncio
122
+
123
+ async def main():
124
+ # Initialize the AsyncClient with username and password.
125
+ client = Client(username="your-access-token-id", password="your-secret-key")
126
+
127
+ # Define the parameters for fetching media assets in a separate variable.
128
+ media_request_params = {
129
+ "limit": 10, # Number of media assets to fetch in one request.
130
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
131
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
132
+ }
133
+
134
+ try:
135
+ # Fetch media assets asynchronously using the await keyword.
136
+ media = await client.media.get_all_media(params=media_request_params)
137
+ print("Media:", media)
138
+ except Exception as e:
139
+ print(f"Error fetching media: {str(e)}")
140
+
141
+ # Run the async function
142
+ asyncio.run(main())
143
+ ```
144
+
145
+ ## Usage:
146
+
147
+ ### 1. Media Operations:
148
+
149
+ #### 1.1. Media Uploads:
150
+
151
+ ##### Upload Media from a URL:
152
+
153
+ Use the `client.media.create_pull_video()` method to upload media directly from a URL. For detailed configuration options, refer to the [Create media from URL](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/UploadMedia.md#method-clientmediacreate_pull_video) API documentation.
154
+
155
+ ```python
156
+ # Define the request payload for uploading media from a URL.
157
+ media_from_url_request = {
158
+ "inputs": [{
159
+ "type": "video", # Specifies the type of media being uploaded (e.g., "video").
160
+ "url": "https://static.fastpix.io/sample.mp4" # URL of the media file to be uploaded.
161
+ }],
162
+ "metadata": {
163
+ "video_title": "Big_Buck_Bunny" # Metadata to associate with the media, such as its title.
164
+ },
165
+ "accessPolicy": "public", # Access policy for the media ("public" or "private").
166
+ "maxResolution": "1080p"
167
+ }
168
+
169
+ media_response = client.media.create_pull_video(media_from_url_request)
170
+ print("media_response", media_response)
171
+ ```
172
+
173
+ ##### Upload Media from a Local Device:
174
+
175
+ Use the `client.media.get_presigned_url()` method to obtain a `signedUrl` and upload media directly from a local device. For more details on configuration options, refer to the [Upload media from device](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/UploadMedia.md#method-clientmediaget_presigned_url) API documentation.
176
+
177
+ ```python
178
+ # Define the request payload for uploading media from a device.
179
+ media_from_device_request = {
180
+ "corsOrigin": "*", # Specifies the allowed origin for CORS (Cross-Origin Resource Sharing). "*" allows all origins.
181
+ "pushMediaSettings": {
182
+ "accessPolicy": "private", # Sets the access policy for the uploaded media (e.g., "private" or "public").
183
+ "optimizeAudio": True, # Enables audio optimization for the uploaded media.
184
+ "maxResolution": "1080p" # Specifies the maximum resolution allowed for the uploaded media.
185
+ },
186
+ }
187
+
188
+ media_from_device_response = client.media.get_presigned_url(media_from_device_request)
189
+ print("Upload Response:", media_from_device_response)
190
+ ```
191
+
192
+ #### 1.2. Media Management:
193
+
194
+ ##### Get List of All Media:
195
+
196
+ Use the `client.media.get_all_media()` method to fetch a list of all media assets. You can customize the query by modifying parameters such as `limit`, `offset`, and `orderBy`. Refer to the [Get list of all media](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_all_media) API documentation for the accepted values.
197
+
198
+ ```python
199
+ # Define the parameters for fetching media assets in a separate variable.
200
+ media_request_params = {
201
+ "limit": 10, # Number of media assets to fetch in one request.
202
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
203
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
204
+ }
205
+
206
+ # Assuming `client` is already initialized with the proper credentials
207
+ all_media_assets = client.media.get_all_media(media_request_params)
208
+
209
+ # Print the fetched media assets
210
+ print("All Media Assets:", all_media_assets)
211
+ ```
212
+
213
+ ##### Get Media Asset by ID:
214
+
215
+ Use the `client.media.get_by_mediaId()` method to retrieve a specific media asset by its ID. Provide `media_id`of the asset to fetch its details. Refer to the [Get a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_by_mediaid) API documentation for more details.
216
+
217
+ ```python
218
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
219
+
220
+ get_media_asset = client.media.get_by_mediaId(media_id)
221
+
222
+ # Print the retrieved media asset by ID
223
+ print("Retrieved media asset by ID:", get_media_asset)
224
+ ```
225
+
226
+ ##### Update Media Asset:
227
+
228
+ Use the `client.media.update()` method to update metadata or other properties of a specific media asset. Provide the `media_id` of the asset along with the metadata to be updated. Refer to the [Update a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaupdate) API documentation for more details.
229
+
230
+ ```python
231
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
232
+
233
+ # Define the payload with the updates to be applied to the media asset.
234
+ update_payload = {
235
+ "metadata": {
236
+ "key": "value" # Replace "key" and "value" with actual metadata keys and values
237
+ },
238
+ }
239
+
240
+ update_media_asset = client.media.update(media_id, update_payload)
241
+
242
+ # Print the updated media asset details
243
+ print("Updated Media Asset:", update_media_asset)
244
+ ```
245
+
246
+ ##### Delete Media Asset:
247
+
248
+ Use the `client.media.delete()` method to delete a specific media asset by its ID. Pass the `media_id` of the asset you want to delete. Refer to the [Delete a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediadelete) API documentation for more information.
249
+
250
+ ```python
251
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
252
+
253
+ # Assuming `client` is already initialized with the necessary credentials
254
+ delete_media_asset = client.media.delete(media_id)
255
+
256
+ # Print the response indicating the media asset has been deleted
257
+ print("Deleted Media Asset:", delete_media_asset)
258
+ ```
259
+
260
+ ##### Get Media Asset Info:
261
+
262
+ Use the `client.media.get_media_info()` method to retrieve detailed information about a specific media asset. Pass the `media_id` to fetch its details. Refer to the [Get info of media inputs](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_media_info) API documentation for more details.
263
+
264
+ ```python
265
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
266
+
267
+ get_media_info = client.media.get_media_info(media_id)
268
+ print("Media Asset Info:", get_media_info)
269
+ ```
270
+
271
+ #### 1.3. Manage Media Playback:
272
+
273
+ ##### Generate Media Playback ID:
274
+
275
+ Use the `client.media_playback_ids.create()` method to generate a playback ID for a specific media asset. You can pass an `media_id` and configure options such as the `accessPolicy`. For detailed configuration options, refer to the [Create a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMediaPlayback.md#method-clientmedia_playback_idscreate) API documentation.
276
+
277
+ ```python
278
+ # Define the media_id and accessPolicy dynamically
279
+ media_type = "video_on_demand"
280
+ media_id = "media-id" # Unique identifier for the media asset.
281
+
282
+ playback_options = {
283
+ "accessPolicy": "public", # Can be 'public' or 'private'.
284
+ }
285
+
286
+ playback_id_response = client.playback_ids.create(media_type, media_id, playback_options)
287
+
288
+ print("Playback ID Creation Response:", playback_id_response)
289
+ ```
290
+
291
+ ##### Delete Media Playback ID:
292
+
293
+ Use the `client.media_playback_ids.delete()` method to delete a playback ID for a specific media asset. You need to pass both the `media_id` and the `playback_id` to delete the playback ID. For detailed configuration options, refer to the [Delete a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMediaPlayback.md#method-clientmedia_playback_idsdelete) API documentation.
294
+
295
+ ```python
296
+ # Define the media_id and playback_id dynamically
297
+ media_type = "video_on_demand"
298
+ media_id = "media-id"; # The ID of the media asset for which you want to delete the playback ID.
299
+ playback_ids = ["id1", "id2"]; # The playback ID that you want to delete.
300
+
301
+ delete_playback_response = client.playback_ids.delete(media_type, media_id, playback_ids)
302
+
303
+ print("Playback ID Deletion Response:", delete_playback_response)
304
+ ```
305
+
306
+ ----
307
+
308
+ ### 2. Live Stream Operations:
309
+
310
+ #### 2.1. Start Live Stream:
311
+
312
+ Use the `client.livestreams.create()` method to start a live stream with specific configurations. For detailed configuration options, refer to the [Create a new stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/CreateLiveStream.md#method-clientlivestreamscreate) API documentation.
313
+
314
+ ```python
315
+ livestream_request = {
316
+ "playbackSettings": {
317
+ "accessPolicy": "public", # Defines the access level of the live stream (public or private)
318
+ },
319
+ "inputMediaSettings": {
320
+ "maxResolution": "1080p", # Set the maximum resolution of the live stream
321
+ "reconnectWindow": 1800, # Set the duration for reconnecting the stream in seconds
322
+ "mediaPolicy": "private", # Define media policy (private or public)
323
+ "metadata": {
324
+ "liveStream": "fp_livestream", # Custom metadata for the live stream
325
+ },
326
+ "enableDvrMode": True, # Enable DVR mode to allow viewers to rewind the live stream
327
+ },
328
+ }
329
+
330
+ # Initiating the live stream
331
+ generate_livestream = client.livestreams.create(livestream_request)
332
+ print("Live Stream initiated successfully:", generate_livestream)
333
+ ```
334
+
335
+ #### 2.2. Live Stream Management:
336
+
337
+ ##### Get List of All Live Streams:
338
+
339
+ Use the `client.livestreams.list()` method to fetch a list of all live streams. You can customize the query by modifying parameters such as `limit`, `offset`, and `orderBy`. For detailed configuration options, refer to the [Get all live streams](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamslist) API documentation.
340
+
341
+ ```python
342
+ get_all_livestream_pagination = {
343
+ "limit": 10, # Limit the number of live streams retrieved.
344
+ "offset": 1, # Skip a specified number of streams for pagination.
345
+ "orderBy": "asc", # Order the results based on the specified criteria ("asc" or "desc").
346
+ }
347
+
348
+ get_all_livestreams = client.livestreams.list(get_all_livestream_pagination)
349
+ print("All Live Streams:", get_all_livestreams)
350
+ ```
351
+
352
+ ##### Get Live Stream by ID:
353
+
354
+ Use the `client.livestreams.get()` method to retrieve a specific live stream by its ID. Provide the `stream_id` of the stream you wish to fetch. For more details, refer to the [Get stream by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsget) API documentation.
355
+
356
+ ```python
357
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
358
+ get_livestream_by_id = client.livestreams.get(stream_id)
359
+
360
+ print("Live Stream Details:", get_livestream_by_id)
361
+ ```
362
+
363
+ ##### Update Live Stream:
364
+
365
+ Use the `client.livestreams.update()` method to update a live stream's configuration. Provide the `stream_id` of the stream and specify the fields you want to update. For more details, refer to the [Update a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsupdate) API documentation.
366
+
367
+ ```python
368
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Provide the stream ID for the live stream to update
369
+ update_livestream_request = {
370
+ "metadata": {
371
+ "livestream_name": "Game_streaming",
372
+ },
373
+ "reconnectWindow": 100,
374
+ }
375
+
376
+ update_livestream = client.livestreams.update(stream_id,update_livestream_request)
377
+
378
+ print("Updated Live Stream:", update_livestream)
379
+ ```
380
+
381
+ ##### Delete Live Stream:
382
+
383
+ Use the `client.livestreams.delete()` method to delete a live stream by its ID. Provide `stream_id` of the stream you want to delete. For more details, refer to the [Delete a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsdelete) API documentation.
384
+
385
+ ```python
386
+ delete_livestream = client.livestreams.delete("a09f3e958c16ed00e85bfe798abd9845") # Provide the stream ID of the live stream to delete
387
+ print("Deleted Live Stream:", delete_livestream)
388
+ ```
389
+
390
+ #### 2.3. Manage Live Stream Playback:
391
+
392
+ ##### Generate Live Stream Playback ID:
393
+
394
+ Use the `client.livestream_playback_ids.create()` method to generate a playback ID for a live stream. Replace `stream_id` with the actual ID of the live stream and specify the desired `accessPolicy`. For more details, refer to the [Create a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idscreate) API documentation.
395
+
396
+ ```python
397
+ media_type = "livestream"
398
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
399
+ body = { "accessPolicy": "public" }
400
+
401
+ generate_livestream_playback_id = client.playback_ids.create(media_type, stream_id, body)
402
+
403
+ print("Generated Live Stream Playback ID:", generate_livestream_playback_id)
404
+ ```
405
+
406
+ ##### Delete Live Stream Playback ID:
407
+
408
+ Use the `client.livestream_playback_ids.delete()` method to delete a specific playback ID for a live stream. You need to provide both the `stream_id` of the live stream and the `playback_id` to delete. For more details, refer to the [Delete a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idsdelete) API documentation.
409
+
410
+ ```python
411
+ media_type = "livestream"
412
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
413
+ playback_id = "632029b4-7c53-4dcf-a4d3-1884c29e90f8" # Replace with actual playback ID
414
+
415
+ delete_livestream_playback_id = client.playback_ids.delete(media_type, stream_id, playback_id)
416
+
417
+ print("Deleted Live Stream Playback ID:", delete_livestream_playback_id)
418
+ ```
419
+
420
+ ##### Get Live Stream Playback Policy:
421
+
422
+ Use the `client.livestream_playback_ids.get()` method to retrieve the playback policy for a specific live stream playback ID. Replace `stream_id` with the stream's ID and `playback_id` with the actual playback ID to fetch the policy. For more details, refer to the [Get stream's playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idsget) API documentation.
423
+
424
+ ```python
425
+ media_type = "livestream"
426
+ stream_id = "1c5e8abcc2080cba74f5d0ac91c7833e" # Replace with the actual stream ID
427
+ playback_id = "95ce872d-0b58-44f3-be72-8ed8b97ee2c9" # Replace with the actual playback ID
428
+
429
+ get_livestream_playback_policy = client.playback_ids.get(media_type, stream_id, playback_id)
430
+
431
+ print("Live Stream Playback Policy:", get_livestream_playback_policy )
432
+ ```
433
+
434
+ #### 2.4. Manage Live Stream Simulcast:
435
+
436
+ ##### Initiate Live Stream Simulcast:
437
+
438
+ Use the `client.livestreams.create_simulcast()` method to create a new simulcast for a live stream. Provide the stream ID and simulcast payload with the URL and stream key. For more details, refer to the [Create a simulcast](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamscreate_simulcast) API documentation.
439
+
440
+ ```python
441
+ simulcast_payload = {
442
+ "url": "rtmps://live.fastpix.io:443/live",
443
+ "streamKey": "46c3457fa8a579b2d4da64125a2b6e83ka09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream key
444
+ }
445
+
446
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
447
+
448
+ generate_simulcast = client.livestreams.create_simulcast(stream_id, simulcast_payload)
449
+
450
+ print("Generate Simulcast:", generate_simulcast)
451
+ ```
452
+
453
+ ##### Get Live Stream Simulcast:
454
+
455
+ Use the `client.livestreams.get_simulcast()` method to retrieve details of a specific simulcast stream. Provide the `stream_id` and `simulcast_id` of the simulcast you want to fetch. For more details, refer to the [Get a specific simulcast of a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamsget_simulcast) API documentation.
456
+
457
+ ```python
458
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
459
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
460
+
461
+ get_livestream_simulcast = client.livestreams.get_simulcast(stream_id, simulcast_id)
462
+
463
+ print("Live Stream Simulcast Details:", get_livestream_simulcast )
464
+ ```
465
+
466
+ ##### Update Live Stream Simulcast:
467
+
468
+ Use the `client.livestreams.update_simulcast()` method to update the configuration of a simulcast stream. Provide the `stream_id`, `simulcast_id`, and the fields you want to update. For more details, refer to the [Update a specific simulcast of a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamsupdate_simulcast) API documentation.
469
+
470
+ ```python
471
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
472
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
473
+
474
+ update_payload = {
475
+ "isEnabled": False, # Disable the simulcast stream (set to True to enable)
476
+ "metadata": {
477
+ "simulcast2": "media" # Update the metadata as needed
478
+ }
479
+ }
480
+
481
+ update_live_simulcast = client.livestreams.update_simulcast(stream_id, simulcast_id, update_payload)
482
+
483
+ print("Updated Live Stream Simulcast:", update_live_simulcast)
484
+ ```
485
+
486
+ ##### Delete Live Stream Simulcast:
487
+
488
+ Use the `client.livestreams.delete_simulcast()` method to remove a specific simulcast from a live stream. Provide the `stream_id` and `simulcast_id` for the simulcast you want to delete. For more details, refer to the [Delete a simulcast](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-deletelivestreamsimulcast) API documentation.
489
+
490
+ ```python
491
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
492
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
493
+
494
+ delete_live_simulcast = client.livestreams.delete_simulcast(stream_id, simulcast_id)
495
+
496
+ print("Deleted Live Stream Simulcast:", delete_live_simulcast)
497
+ ```
498
+
499
+ ### Detailed Usage:
500
+
501
+ For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the [FastPix API Reference](https://docs.fastpix.io/reference/signingkeys-overview).
502
+
503
+ The API reference provides comprehensive documentation for all available endpoints and features, ensuring developers can integrate and utilize FastPix APIs efficiently.
@@ -19,7 +19,7 @@ The FastPix Python SDK simplifies integration with the FastPix platform. This SD
19
19
  For detailed usage, refer to the [FastPix API Reference](https://docs.fastpix.io/reference).
20
20
 
21
21
  ## Latest Release
22
- - Current Version: 0.1.0
22
+ - Current Version: 0.1.3
23
23
  - View our [changelog](CHANELOG.md) for details on recent updates
24
24
  - Download the latest release from our [releases page](https://github.com/FastPix/python-server-sdk/releases/tag/v1.0.0)
25
25
 
@@ -0,0 +1,503 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastpix-python
3
+ Version: 0.1.3
4
+ Summary: FastPix SDK with both sync and async support
5
+ Home-page: https://github.com/fastpix-io/fastpix-python-server-sdk
6
+ Author: FastPix
7
+ Author-email: dev@fastpix.io
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Requires-Python: >=3.7
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: requests>=2.25.0
19
+ Provides-Extra: async
20
+ Requires-Dist: aiohttp>=3.8.0; extra == "async"
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: license-file
28
+ Dynamic: provides-extra
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
32
+
33
+ # Introduction:
34
+
35
+ The FastPix Python SDK simplifies integration with the FastPix platform. This SDK is designed for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, and simulcasting. It is intended for use with Python 3.7 or later.
36
+
37
+ ## Key Features:
38
+
39
+ - ### Media API:
40
+
41
+ - **Upload Media**: Upload media files seamlessly from URLs or devices.
42
+ - **Manage Media**: Perform operations such as listing, fetching, updating, and deleting media assets.
43
+ - **Playback IDs**: Generate and manage playback IDs for media access.
44
+
45
+ - ### Live API:
46
+
47
+ - **Create & Manage Live Streams:**: Create, list, update, and delete live streams effortlessly.
48
+ - **Control Stream Access**: Generate playback IDs for live streams to control and manage access.
49
+ - **Simulcast to Multiple Platforms**: Stream content to multiple platforms simultaneously.
50
+
51
+ For detailed usage, refer to the [FastPix API Reference](https://docs.fastpix.io/reference).
52
+
53
+ ## Latest Release
54
+ - Current Version: 0.1.3
55
+ - View our [changelog](CHANELOG.md) for details on recent updates
56
+ - Download the latest release from our [releases page](https://github.com/FastPix/python-server-sdk/releases/tag/v1.0.0)
57
+
58
+ ## Prerequisites:
59
+
60
+ ### Getting started with FastPix:
61
+
62
+ To get started with the **FastPix Python SDK**, ensure you have the following:
63
+
64
+ - The FastPix APIs are authenticated using an **Access Token** and a **Secret Key**. You must generate these credentials to use the SDK.
65
+
66
+ - Follow the steps in the [Authentication with Access Tokens](https://docs.fastpix.io/docs/authentication-with-access-tokens) guide to obtain your credentials.
67
+
68
+ ## Installation:
69
+
70
+ To install the SDK, use pip with the GitHub repository URL to easily download and install the required libraries.
71
+
72
+ ```bash
73
+ pip install git+https://github.com/FastPix/fastpix-python
74
+ ```
75
+ (you may need to run `pip` with root permission)
76
+
77
+ ## Basic Usage:
78
+
79
+ ### Importing the SDK
80
+
81
+ ```python
82
+ from fastpix-python import Client
83
+ ```
84
+
85
+ ### Initialization:
86
+
87
+ Initialize the FastPix SDK with your API credentials.
88
+
89
+ ```python
90
+ from fastpix-python import Client
91
+
92
+ client = Client(username="your-access-token-id", password="your-secret-key")
93
+ ```
94
+
95
+ ### Example Usage:
96
+
97
+ Below is an example of configuring `FastPix Python SDK` into your project.
98
+
99
+ `Note:-` For Async SDK Users: When using the AsyncClient, all SDK methods must be prefixed with the await keyword.
100
+ ```python
101
+ # Sync Usage
102
+ from fastpix-python import Client
103
+
104
+ client = Client(username="your-access-token-id", password="your-secret-key")
105
+
106
+ # Define the parameters for fetching media assets in a separate variable.
107
+ media_request_params = {
108
+ "limit": 10, # Number of media assets to fetch in one request.
109
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
110
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
111
+ }
112
+
113
+ try:
114
+ media = client.media.get_all_media(params=media_request_params)
115
+ print("Media:", media)
116
+ except Exception as e:
117
+ print(f"Error fetching media: {str(e)}")
118
+
119
+ # Async Usage
120
+ from fastpix import AsyncClient as Client
121
+ import asyncio
122
+
123
+ async def main():
124
+ # Initialize the AsyncClient with username and password.
125
+ client = Client(username="your-access-token-id", password="your-secret-key")
126
+
127
+ # Define the parameters for fetching media assets in a separate variable.
128
+ media_request_params = {
129
+ "limit": 10, # Number of media assets to fetch in one request.
130
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
131
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
132
+ }
133
+
134
+ try:
135
+ # Fetch media assets asynchronously using the await keyword.
136
+ media = await client.media.get_all_media(params=media_request_params)
137
+ print("Media:", media)
138
+ except Exception as e:
139
+ print(f"Error fetching media: {str(e)}")
140
+
141
+ # Run the async function
142
+ asyncio.run(main())
143
+ ```
144
+
145
+ ## Usage:
146
+
147
+ ### 1. Media Operations:
148
+
149
+ #### 1.1. Media Uploads:
150
+
151
+ ##### Upload Media from a URL:
152
+
153
+ Use the `client.media.create_pull_video()` method to upload media directly from a URL. For detailed configuration options, refer to the [Create media from URL](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/UploadMedia.md#method-clientmediacreate_pull_video) API documentation.
154
+
155
+ ```python
156
+ # Define the request payload for uploading media from a URL.
157
+ media_from_url_request = {
158
+ "inputs": [{
159
+ "type": "video", # Specifies the type of media being uploaded (e.g., "video").
160
+ "url": "https://static.fastpix.io/sample.mp4" # URL of the media file to be uploaded.
161
+ }],
162
+ "metadata": {
163
+ "video_title": "Big_Buck_Bunny" # Metadata to associate with the media, such as its title.
164
+ },
165
+ "accessPolicy": "public", # Access policy for the media ("public" or "private").
166
+ "maxResolution": "1080p"
167
+ }
168
+
169
+ media_response = client.media.create_pull_video(media_from_url_request)
170
+ print("media_response", media_response)
171
+ ```
172
+
173
+ ##### Upload Media from a Local Device:
174
+
175
+ Use the `client.media.get_presigned_url()` method to obtain a `signedUrl` and upload media directly from a local device. For more details on configuration options, refer to the [Upload media from device](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/UploadMedia.md#method-clientmediaget_presigned_url) API documentation.
176
+
177
+ ```python
178
+ # Define the request payload for uploading media from a device.
179
+ media_from_device_request = {
180
+ "corsOrigin": "*", # Specifies the allowed origin for CORS (Cross-Origin Resource Sharing). "*" allows all origins.
181
+ "pushMediaSettings": {
182
+ "accessPolicy": "private", # Sets the access policy for the uploaded media (e.g., "private" or "public").
183
+ "optimizeAudio": True, # Enables audio optimization for the uploaded media.
184
+ "maxResolution": "1080p" # Specifies the maximum resolution allowed for the uploaded media.
185
+ },
186
+ }
187
+
188
+ media_from_device_response = client.media.get_presigned_url(media_from_device_request)
189
+ print("Upload Response:", media_from_device_response)
190
+ ```
191
+
192
+ #### 1.2. Media Management:
193
+
194
+ ##### Get List of All Media:
195
+
196
+ Use the `client.media.get_all_media()` method to fetch a list of all media assets. You can customize the query by modifying parameters such as `limit`, `offset`, and `orderBy`. Refer to the [Get list of all media](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_all_media) API documentation for the accepted values.
197
+
198
+ ```python
199
+ # Define the parameters for fetching media assets in a separate variable.
200
+ media_request_params = {
201
+ "limit": 10, # Number of media assets to fetch in one request.
202
+ "offset": 1, # Starting position for the list of media assets (useful for pagination).
203
+ "orderBy": "desc" # Sort order for the media assets ("desc" for descending, "asc" for ascending).
204
+ }
205
+
206
+ # Assuming `client` is already initialized with the proper credentials
207
+ all_media_assets = client.media.get_all_media(media_request_params)
208
+
209
+ # Print the fetched media assets
210
+ print("All Media Assets:", all_media_assets)
211
+ ```
212
+
213
+ ##### Get Media Asset by ID:
214
+
215
+ Use the `client.media.get_by_mediaId()` method to retrieve a specific media asset by its ID. Provide `media_id`of the asset to fetch its details. Refer to the [Get a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_by_mediaid) API documentation for more details.
216
+
217
+ ```python
218
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
219
+
220
+ get_media_asset = client.media.get_by_mediaId(media_id)
221
+
222
+ # Print the retrieved media asset by ID
223
+ print("Retrieved media asset by ID:", get_media_asset)
224
+ ```
225
+
226
+ ##### Update Media Asset:
227
+
228
+ Use the `client.media.update()` method to update metadata or other properties of a specific media asset. Provide the `media_id` of the asset along with the metadata to be updated. Refer to the [Update a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaupdate) API documentation for more details.
229
+
230
+ ```python
231
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
232
+
233
+ # Define the payload with the updates to be applied to the media asset.
234
+ update_payload = {
235
+ "metadata": {
236
+ "key": "value" # Replace "key" and "value" with actual metadata keys and values
237
+ },
238
+ }
239
+
240
+ update_media_asset = client.media.update(media_id, update_payload)
241
+
242
+ # Print the updated media asset details
243
+ print("Updated Media Asset:", update_media_asset)
244
+ ```
245
+
246
+ ##### Delete Media Asset:
247
+
248
+ Use the `client.media.delete()` method to delete a specific media asset by its ID. Pass the `media_id` of the asset you want to delete. Refer to the [Delete a media by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediadelete) API documentation for more information.
249
+
250
+ ```python
251
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
252
+
253
+ # Assuming `client` is already initialized with the necessary credentials
254
+ delete_media_asset = client.media.delete(media_id)
255
+
256
+ # Print the response indicating the media asset has been deleted
257
+ print("Deleted Media Asset:", delete_media_asset)
258
+ ```
259
+
260
+ ##### Get Media Asset Info:
261
+
262
+ Use the `client.media.get_media_info()` method to retrieve detailed information about a specific media asset. Pass the `media_id` to fetch its details. Refer to the [Get info of media inputs](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMedia.md#method-clientmediaget_media_info) API documentation for more details.
263
+
264
+ ```python
265
+ media_id = "media_id" # Unique identifier for the media asset to be retrieved
266
+
267
+ get_media_info = client.media.get_media_info(media_id)
268
+ print("Media Asset Info:", get_media_info)
269
+ ```
270
+
271
+ #### 1.3. Manage Media Playback:
272
+
273
+ ##### Generate Media Playback ID:
274
+
275
+ Use the `client.media_playback_ids.create()` method to generate a playback ID for a specific media asset. You can pass an `media_id` and configure options such as the `accessPolicy`. For detailed configuration options, refer to the [Create a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMediaPlayback.md#method-clientmedia_playback_idscreate) API documentation.
276
+
277
+ ```python
278
+ # Define the media_id and accessPolicy dynamically
279
+ media_type = "video_on_demand"
280
+ media_id = "media-id" # Unique identifier for the media asset.
281
+
282
+ playback_options = {
283
+ "accessPolicy": "public", # Can be 'public' or 'private'.
284
+ }
285
+
286
+ playback_id_response = client.playback_ids.create(media_type, media_id, playback_options)
287
+
288
+ print("Playback ID Creation Response:", playback_id_response)
289
+ ```
290
+
291
+ ##### Delete Media Playback ID:
292
+
293
+ Use the `client.media_playback_ids.delete()` method to delete a playback ID for a specific media asset. You need to pass both the `media_id` and the `playback_id` to delete the playback ID. For detailed configuration options, refer to the [Delete a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/VideoOnDemand/ManageMediaPlayback.md#method-clientmedia_playback_idsdelete) API documentation.
294
+
295
+ ```python
296
+ # Define the media_id and playback_id dynamically
297
+ media_type = "video_on_demand"
298
+ media_id = "media-id"; # The ID of the media asset for which you want to delete the playback ID.
299
+ playback_ids = ["id1", "id2"]; # The playback ID that you want to delete.
300
+
301
+ delete_playback_response = client.playback_ids.delete(media_type, media_id, playback_ids)
302
+
303
+ print("Playback ID Deletion Response:", delete_playback_response)
304
+ ```
305
+
306
+ ----
307
+
308
+ ### 2. Live Stream Operations:
309
+
310
+ #### 2.1. Start Live Stream:
311
+
312
+ Use the `client.livestreams.create()` method to start a live stream with specific configurations. For detailed configuration options, refer to the [Create a new stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/CreateLiveStream.md#method-clientlivestreamscreate) API documentation.
313
+
314
+ ```python
315
+ livestream_request = {
316
+ "playbackSettings": {
317
+ "accessPolicy": "public", # Defines the access level of the live stream (public or private)
318
+ },
319
+ "inputMediaSettings": {
320
+ "maxResolution": "1080p", # Set the maximum resolution of the live stream
321
+ "reconnectWindow": 1800, # Set the duration for reconnecting the stream in seconds
322
+ "mediaPolicy": "private", # Define media policy (private or public)
323
+ "metadata": {
324
+ "liveStream": "fp_livestream", # Custom metadata for the live stream
325
+ },
326
+ "enableDvrMode": True, # Enable DVR mode to allow viewers to rewind the live stream
327
+ },
328
+ }
329
+
330
+ # Initiating the live stream
331
+ generate_livestream = client.livestreams.create(livestream_request)
332
+ print("Live Stream initiated successfully:", generate_livestream)
333
+ ```
334
+
335
+ #### 2.2. Live Stream Management:
336
+
337
+ ##### Get List of All Live Streams:
338
+
339
+ Use the `client.livestreams.list()` method to fetch a list of all live streams. You can customize the query by modifying parameters such as `limit`, `offset`, and `orderBy`. For detailed configuration options, refer to the [Get all live streams](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamslist) API documentation.
340
+
341
+ ```python
342
+ get_all_livestream_pagination = {
343
+ "limit": 10, # Limit the number of live streams retrieved.
344
+ "offset": 1, # Skip a specified number of streams for pagination.
345
+ "orderBy": "asc", # Order the results based on the specified criteria ("asc" or "desc").
346
+ }
347
+
348
+ get_all_livestreams = client.livestreams.list(get_all_livestream_pagination)
349
+ print("All Live Streams:", get_all_livestreams)
350
+ ```
351
+
352
+ ##### Get Live Stream by ID:
353
+
354
+ Use the `client.livestreams.get()` method to retrieve a specific live stream by its ID. Provide the `stream_id` of the stream you wish to fetch. For more details, refer to the [Get stream by ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsget) API documentation.
355
+
356
+ ```python
357
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
358
+ get_livestream_by_id = client.livestreams.get(stream_id)
359
+
360
+ print("Live Stream Details:", get_livestream_by_id)
361
+ ```
362
+
363
+ ##### Update Live Stream:
364
+
365
+ Use the `client.livestreams.update()` method to update a live stream's configuration. Provide the `stream_id` of the stream and specify the fields you want to update. For more details, refer to the [Update a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsupdate) API documentation.
366
+
367
+ ```python
368
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Provide the stream ID for the live stream to update
369
+ update_livestream_request = {
370
+ "metadata": {
371
+ "livestream_name": "Game_streaming",
372
+ },
373
+ "reconnectWindow": 100,
374
+ }
375
+
376
+ update_livestream = client.livestreams.update(stream_id,update_livestream_request)
377
+
378
+ print("Updated Live Stream:", update_livestream)
379
+ ```
380
+
381
+ ##### Delete Live Stream:
382
+
383
+ Use the `client.livestreams.delete()` method to delete a live stream by its ID. Provide `stream_id` of the stream you want to delete. For more details, refer to the [Delete a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageLiveStreams.md#method-clientlivestreamsdelete) API documentation.
384
+
385
+ ```python
386
+ delete_livestream = client.livestreams.delete("a09f3e958c16ed00e85bfe798abd9845") # Provide the stream ID of the live stream to delete
387
+ print("Deleted Live Stream:", delete_livestream)
388
+ ```
389
+
390
+ #### 2.3. Manage Live Stream Playback:
391
+
392
+ ##### Generate Live Stream Playback ID:
393
+
394
+ Use the `client.livestream_playback_ids.create()` method to generate a playback ID for a live stream. Replace `stream_id` with the actual ID of the live stream and specify the desired `accessPolicy`. For more details, refer to the [Create a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idscreate) API documentation.
395
+
396
+ ```python
397
+ media_type = "livestream"
398
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
399
+ body = { "accessPolicy": "public" }
400
+
401
+ generate_livestream_playback_id = client.playback_ids.create(media_type, stream_id, body)
402
+
403
+ print("Generated Live Stream Playback ID:", generate_livestream_playback_id)
404
+ ```
405
+
406
+ ##### Delete Live Stream Playback ID:
407
+
408
+ Use the `client.livestream_playback_ids.delete()` method to delete a specific playback ID for a live stream. You need to provide both the `stream_id` of the live stream and the `playback_id` to delete. For more details, refer to the [Delete a playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idsdelete) API documentation.
409
+
410
+ ```python
411
+ media_type = "livestream"
412
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
413
+ playback_id = "632029b4-7c53-4dcf-a4d3-1884c29e90f8" # Replace with actual playback ID
414
+
415
+ delete_livestream_playback_id = client.playback_ids.delete(media_type, stream_id, playback_id)
416
+
417
+ print("Deleted Live Stream Playback ID:", delete_livestream_playback_id)
418
+ ```
419
+
420
+ ##### Get Live Stream Playback Policy:
421
+
422
+ Use the `client.livestream_playback_ids.get()` method to retrieve the playback policy for a specific live stream playback ID. Replace `stream_id` with the stream's ID and `playback_id` with the actual playback ID to fetch the policy. For more details, refer to the [Get stream's playback ID](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamPlayback.md#method-clientlivestream_playback_idsget) API documentation.
423
+
424
+ ```python
425
+ media_type = "livestream"
426
+ stream_id = "1c5e8abcc2080cba74f5d0ac91c7833e" # Replace with the actual stream ID
427
+ playback_id = "95ce872d-0b58-44f3-be72-8ed8b97ee2c9" # Replace with the actual playback ID
428
+
429
+ get_livestream_playback_policy = client.playback_ids.get(media_type, stream_id, playback_id)
430
+
431
+ print("Live Stream Playback Policy:", get_livestream_playback_policy )
432
+ ```
433
+
434
+ #### 2.4. Manage Live Stream Simulcast:
435
+
436
+ ##### Initiate Live Stream Simulcast:
437
+
438
+ Use the `client.livestreams.create_simulcast()` method to create a new simulcast for a live stream. Provide the stream ID and simulcast payload with the URL and stream key. For more details, refer to the [Create a simulcast](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamscreate_simulcast) API documentation.
439
+
440
+ ```python
441
+ simulcast_payload = {
442
+ "url": "rtmps://live.fastpix.io:443/live",
443
+ "streamKey": "46c3457fa8a579b2d4da64125a2b6e83ka09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream key
444
+ }
445
+
446
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
447
+
448
+ generate_simulcast = client.livestreams.create_simulcast(stream_id, simulcast_payload)
449
+
450
+ print("Generate Simulcast:", generate_simulcast)
451
+ ```
452
+
453
+ ##### Get Live Stream Simulcast:
454
+
455
+ Use the `client.livestreams.get_simulcast()` method to retrieve details of a specific simulcast stream. Provide the `stream_id` and `simulcast_id` of the simulcast you want to fetch. For more details, refer to the [Get a specific simulcast of a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamsget_simulcast) API documentation.
456
+
457
+ ```python
458
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
459
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
460
+
461
+ get_livestream_simulcast = client.livestreams.get_simulcast(stream_id, simulcast_id)
462
+
463
+ print("Live Stream Simulcast Details:", get_livestream_simulcast )
464
+ ```
465
+
466
+ ##### Update Live Stream Simulcast:
467
+
468
+ Use the `client.livestreams.update_simulcast()` method to update the configuration of a simulcast stream. Provide the `stream_id`, `simulcast_id`, and the fields you want to update. For more details, refer to the [Update a specific simulcast of a stream](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-clientlivestreamsupdate_simulcast) API documentation.
469
+
470
+ ```python
471
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
472
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
473
+
474
+ update_payload = {
475
+ "isEnabled": False, # Disable the simulcast stream (set to True to enable)
476
+ "metadata": {
477
+ "simulcast2": "media" # Update the metadata as needed
478
+ }
479
+ }
480
+
481
+ update_live_simulcast = client.livestreams.update_simulcast(stream_id, simulcast_id, update_payload)
482
+
483
+ print("Updated Live Stream Simulcast:", update_live_simulcast)
484
+ ```
485
+
486
+ ##### Delete Live Stream Simulcast:
487
+
488
+ Use the `client.livestreams.delete_simulcast()` method to remove a specific simulcast from a live stream. Provide the `stream_id` and `simulcast_id` for the simulcast you want to delete. For more details, refer to the [Delete a simulcast](https://github.com/FastPix/python-server-sdk/blob/main/fastpix/docs/Live/ManageStreamSimulcast.md#method-deletelivestreamsimulcast) API documentation.
489
+
490
+ ```python
491
+ stream_id = "a09f3e958c16ed00e85bfe798abd9845" # Replace with actual stream ID
492
+ simulcast_id = "7269209ff0299319b6321c9a6e7850ff" # Replace with actual simulcast ID
493
+
494
+ delete_live_simulcast = client.livestreams.delete_simulcast(stream_id, simulcast_id)
495
+
496
+ print("Deleted Live Stream Simulcast:", delete_live_simulcast)
497
+ ```
498
+
499
+ ### Detailed Usage:
500
+
501
+ For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the [FastPix API Reference](https://docs.fastpix.io/reference/signingkeys-overview).
502
+
503
+ The API reference provides comprehensive documentation for all available endpoints and features, ensuring developers can integrate and utilize FastPix APIs efficiently.
@@ -1,8 +1,11 @@
1
1
  from setuptools import setup, find_packages
2
-
2
+
3
+ with open("README.md", "r", encoding="utf-8") as fh:
4
+ long_description = fh.read()
5
+
3
6
  setup(
4
7
  name="fastpix-python",
5
- version="0.1.0",
8
+ version="0.1.3",
6
9
  packages=find_packages(),
7
10
  install_requires=[
8
11
  "requests>=2.25.0",
@@ -13,6 +16,8 @@ setup(
13
16
  ]
14
17
  },
15
18
  description="FastPix SDK with both sync and async support",
19
+ long_description=long_description,
20
+ long_description_content_type="text/markdown",
16
21
  author="FastPix",
17
22
  author_email="dev@fastpix.io",
18
23
  url="https://github.com/fastpix-io/fastpix-python-server-sdk",
@@ -1,28 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastpix-python
3
- Version: 0.1.0
4
- Summary: FastPix SDK with both sync and async support
5
- Home-page: https://github.com/fastpix-io/fastpix-python-server-sdk
6
- Author: FastPix
7
- Author-email: dev@fastpix.io
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.7
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Requires-Python: >=3.7
16
- License-File: LICENSE
17
- Requires-Dist: requests>=2.25.0
18
- Provides-Extra: async
19
- Requires-Dist: aiohttp>=3.8.0; extra == "async"
20
- Dynamic: author
21
- Dynamic: author-email
22
- Dynamic: classifier
23
- Dynamic: home-page
24
- Dynamic: license-file
25
- Dynamic: provides-extra
26
- Dynamic: requires-dist
27
- Dynamic: requires-python
28
- Dynamic: summary
@@ -1,28 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastpix-python
3
- Version: 0.1.0
4
- Summary: FastPix SDK with both sync and async support
5
- Home-page: https://github.com/fastpix-io/fastpix-python-server-sdk
6
- Author: FastPix
7
- Author-email: dev@fastpix.io
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.7
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Requires-Python: >=3.7
16
- License-File: LICENSE
17
- Requires-Dist: requests>=2.25.0
18
- Provides-Extra: async
19
- Requires-Dist: aiohttp>=3.8.0; extra == "async"
20
- Dynamic: author
21
- Dynamic: author-email
22
- Dynamic: classifier
23
- Dynamic: home-page
24
- Dynamic: license-file
25
- Dynamic: provides-extra
26
- Dynamic: requires-dist
27
- Dynamic: requires-python
28
- Dynamic: summary
File without changes
File without changes