remotion-lambda 4.0.341__tar.gz → 4.0.345__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 (20) hide show
  1. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/PKG-INFO +1 -1
  2. remotion_lambda-4.0.345/remotion_lambda/__init__.py +24 -0
  3. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda/models.py +73 -45
  4. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda/remotionclient.py +92 -57
  5. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda/version.py +1 -1
  6. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda.egg-info/PKG-INFO +1 -1
  7. remotion_lambda-4.0.341/remotion_lambda/__init__.py +0 -14
  8. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/LICENSE +0 -0
  9. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/README.md +0 -0
  10. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda.egg-info/SOURCES.txt +0 -0
  11. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda.egg-info/dependency_links.txt +0 -0
  12. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda.egg-info/requires.txt +0 -0
  13. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/remotion_lambda.egg-info/top_level.txt +0 -0
  14. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/setup.cfg +0 -0
  15. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/setup.py +0 -0
  16. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/tests/__init__.py +0 -0
  17. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/tests/test_get_render_progress_client.py +0 -0
  18. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/tests/test_large_payload_compression.py +0 -0
  19. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/tests/test_render_client_render_media.py +0 -0
  20. {remotion_lambda-4.0.341 → remotion_lambda-4.0.345}/tests/test_render_client_render_still.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotion_lambda
3
- Version: 4.0.341
3
+ Version: 4.0.345
4
4
  Summary: Remotion Lambda client
5
5
  Home-page: https://github.com/remotion-dev/remotion/tree/main/packages/lambda-python
6
6
  Author: Jonny Burger
@@ -0,0 +1,24 @@
1
+ # pylint: disable=missing-module-docstring
2
+ from .models import (
3
+ RenderMediaParams,
4
+ RenderMediaProgress,
5
+ RenderMediaResponse,
6
+ RenderProgressParams,
7
+ RenderStillParams,
8
+ RenderStillResponse,
9
+ CostsInfo,
10
+ Privacy,
11
+ ValidStillImageFormats,
12
+ LogLevel,
13
+ OpenGlRenderer,
14
+ ChromiumOptions,
15
+ CustomCredentialsWithoutSensitiveData,
16
+ CustomCredentials,
17
+ OutNameInputObject,
18
+ PlayInBrowser,
19
+ ShouldDownload,
20
+ DeleteAfter,
21
+ Webhook,
22
+ )
23
+ from .remotionclient import RemotionClient
24
+ from .version import VERSION
@@ -1,7 +1,7 @@
1
1
  # pylint: disable=too-few-public-methods, missing-module-docstring, broad-exception-caught,invalid-name
2
2
 
3
3
  from enum import Enum
4
- from typing import Optional, Dict, Any, Union, Literal
4
+ from typing import Optional, Dict, Any, Union, Literal, List
5
5
  from dataclasses import dataclass, field
6
6
  from .version import VERSION
7
7
 
@@ -10,6 +10,7 @@ from .version import VERSION
10
10
 
11
11
  RenderType = Union[Literal["video-or-audio"], Literal["still"]]
12
12
 
13
+
13
14
  class ValidStillImageFormats(str, Enum):
14
15
  """
15
16
  Enumeration of valid image formats for still images.
@@ -20,6 +21,7 @@ class ValidStillImageFormats(str, Enum):
20
21
  PDF: Represents the PDF format for images.
21
22
  WEBP: Represents the WEBP image format.
22
23
  """
24
+
23
25
  PNG = 'png'
24
26
  JPEG = 'jpeg'
25
27
  PDF = 'pdf'
@@ -34,6 +36,7 @@ class Privacy(str, Enum):
34
36
  PUBLIC: Indicates a public setting.
35
37
  PRIVATE: Indicates a private setting.
36
38
  """
39
+
37
40
  PUBLIC = 'public'
38
41
  PRIVATE = 'private'
39
42
  NO_ACL = 'no-acl'
@@ -49,6 +52,7 @@ class LogLevel(str, Enum):
49
52
  WARN: Warning logging level.
50
53
  ERROR: Error logging level.
51
54
  """
55
+
52
56
  VERBOSE = 'verbose'
53
57
  INFO = 'info'
54
58
  WARN = 'warn'
@@ -66,6 +70,7 @@ class OpenGlRenderer(str, Enum):
66
70
  SWIFTSHADER: Represents the SWIFTSHADER OpenGL renderer.
67
71
  VULKAN: Represents the VULKAN OpenGL renderer.
68
72
  """
73
+
69
74
  SWANGLE = 'swangle'
70
75
  ANGLE = 'angle'
71
76
  EGL = 'egl'
@@ -84,9 +89,10 @@ class ChromiumOptions:
84
89
  gl (Optional[OpenGlRenderer]): Specifies the OpenGL renderer to use.
85
90
  headless (Optional[bool]): If True, runs Chromium in headless mode.
86
91
  user_agent (Optional[str]): Specifies a custom user agent.
87
- enable_multi_process_on_linux (Optional[bool]):
92
+ enable_multi_process_on_linux (Optional[bool]):
88
93
  If True, enables multi-process mode on Linux.
89
94
  """
95
+
90
96
  ignore_certificate_errors: Optional[bool] = None
91
97
  disable_web_security: Optional[bool] = None
92
98
  gl: Optional[OpenGlRenderer] = None
@@ -103,18 +109,20 @@ class CustomCredentialsWithoutSensitiveData:
103
109
  Attributes:
104
110
  endpoint (str): The endpoint associated with the credentials.
105
111
  """
112
+
106
113
  endpoint: str
107
114
 
108
115
 
109
116
  @dataclass
110
117
  class CustomCredentials(CustomCredentialsWithoutSensitiveData):
111
118
  """
112
- Represents custom credentials, extending credentials without sensitive data.
119
+ Represents custom credentials, extending credentials without sensitive data.
120
+
121
+ Attributes:
122
+ access_key_id (Optional[str]): The access key ID.
123
+ secret_access_key (Optional[str]): The secret access key.
124
+ """
113
125
 
114
- Attributes:
115
- access_key_id (Optional[str]): The access key ID.
116
- secret_access_key (Optional[str]): The secret access key.
117
- """
118
126
  access_key_id: Optional[str] = None
119
127
  secret_access_key: Optional[str] = None
120
128
  region: Optional[str] = None
@@ -143,6 +151,7 @@ class OutNameInputObject:
143
151
  s3_output_provider (Optional[CustomCredentials]):
144
152
  Optional custom credentials for the S3 output provider.
145
153
  """
154
+
146
155
  bucketName: str
147
156
  key: str
148
157
  s3_output_provider: Optional[CustomCredentials] = None
@@ -158,6 +167,7 @@ class DeleteAfter(Enum):
158
167
  SEVEN_DAYS: Represents deletion after seven days.
159
168
  THIRTY_DAYS: Represents deletion after thirty days.
160
169
  """
170
+
161
171
  ONE_DAY = '1-day'
162
172
  THREE_DAYS = '3-days'
163
173
  SEVEN_DAYS = '7-days'
@@ -169,6 +179,7 @@ class RenderMediaResponse:
169
179
  """
170
180
  Response data after rendering.
171
181
  """
182
+
172
183
  bucket_name: str
173
184
  render_id: str
174
185
 
@@ -222,6 +233,7 @@ class CostsInfo:
222
233
  currency (str): The type of currency used for the costs, e.g., 'USD', 'EUR'.
223
234
  disclaimer (str): Any disclaimer or additional information related to the costs.
224
235
  """
236
+
225
237
  accrued_so_far: float
226
238
  display_cost: str
227
239
  currency: str
@@ -233,6 +245,7 @@ class PlayInBrowser:
233
245
  """
234
246
  The video should play in the browser when the link is clicked.
235
247
  """
248
+
236
249
  type: Literal['play-in-browser']
237
250
  # You can define additional fields as needed
238
251
 
@@ -242,6 +255,7 @@ class ShouldDownload:
242
255
  """
243
256
  The video should download when the link is clicked.
244
257
  """
258
+
245
259
  type: Literal['download']
246
260
  fileName: str # Additional fields for this type
247
261
 
@@ -251,6 +265,7 @@ class Webhook:
251
265
  """
252
266
  Represents a webhook.
253
267
  """
268
+
254
269
  secret: str
255
270
  url: str
256
271
  customData: Optional[Dict] = None
@@ -261,6 +276,7 @@ class RenderMediaParams:
261
276
  """
262
277
  Parameters for video rendering.
263
278
  """
279
+
264
280
  input_props: Optional[Dict[str, Any]] = None
265
281
  bucket_name: Optional[str] = None
266
282
  region: Optional[str] = None
@@ -290,7 +306,8 @@ class RenderMediaParams:
290
306
  concurrency_per_lambda: Optional[int] = 1
291
307
  concurrency: Optional[int] = None
292
308
  download_behavior: Optional[Union[PlayInBrowser, ShouldDownload]] = field(
293
- default_factory=lambda: PlayInBrowser(type='play-in-browser'))
309
+ default_factory=lambda: PlayInBrowser(type='play-in-browser')
310
+ )
294
311
  muted: bool = False
295
312
  overwrite: bool = False
296
313
  force_path_style: Optional[bool] = None
@@ -337,7 +354,9 @@ class RenderMediaParams:
337
354
  'outName': self.out_name,
338
355
  'preferLossless': self.prefer_lossless,
339
356
  'timeoutInMilliseconds': self.timeout_in_milliseconds,
340
- 'chromiumOptions': self.chromium_options if self.chromium_options is not None else {},
357
+ 'chromiumOptions': (
358
+ self.chromium_options if self.chromium_options is not None else {}
359
+ ),
341
360
  'scale': self.scale,
342
361
  'everyNthFrame': self.every_nth_frame,
343
362
  'numberOfGifLoops': self.number_of_gif_loops,
@@ -360,7 +379,7 @@ class RenderMediaParams:
360
379
  'deleteAfter': self.delete_after,
361
380
  'encodingBufferSize': self.encoding_buffer_size,
362
381
  'encodingMaxRate': self.encoding_max_rate,
363
- 'type': 'start'
382
+ 'type': 'start',
364
383
  }
365
384
 
366
385
  if self.crf is not None:
@@ -399,6 +418,7 @@ class RenderStillParams:
399
418
  """
400
419
  Parameters for video rendering.
401
420
  """
421
+
402
422
  composition: str
403
423
  serve_url: str = ""
404
424
  input_props: Optional[Dict[str, Any]] = None
@@ -415,7 +435,9 @@ class RenderStillParams:
415
435
  timeout_in_milliseconds: Optional[int] = 30000
416
436
  chromium_options: Optional[ChromiumOptions] = None
417
437
  scale: Optional[float] = 1
418
- download_behavior: Dict = field(default_factory=lambda: PlayInBrowser(type='play-in-browser'))
438
+ download_behavior: Union[PlayInBrowser, ShouldDownload] = field(
439
+ default_factory=lambda: PlayInBrowser(type='play-in-browser')
440
+ )
419
441
  force_width: Optional[int] = None
420
442
  api_key: Optional[int] = None
421
443
  storage_class: Optional[str] = None
@@ -430,21 +452,21 @@ class RenderStillParams:
430
452
 
431
453
  def serialize_params(self) -> Dict:
432
454
  """
433
- Serializes the parameters of the current object into a dictionary.
455
+ Serializes the parameters of the current object into a dictionary.
434
456
 
435
- This method consolidates both mandatory and optional attributes of the object
436
- into a single dictionary. Mandatory attributes include region, functionName,
437
- serveUrl, composition, inputProps, imageFormat, and privacy. Optional attributes
438
- are added to the dictionary only if they are not None.
457
+ This method consolidates both mandatory and optional attributes of the object
458
+ into a single dictionary. Mandatory attributes include region, functionName,
459
+ serveUrl, composition, inputProps, imageFormat, and privacy. Optional attributes
460
+ are added to the dictionary only if they are not None.
439
461
 
440
- The optional attributes include maxRetries, envVariables, jpegQuality, frame,
441
- logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior,
442
- forceWidth, forceHeight, forceBucketName, and deleteAfter.
443
- Default values are provided for 'inputProps' (empty dictionary) and 'downloadBehavior'
444
- ('type': 'play-in-browser') if they are not explicitly set.
462
+ The optional attributes include maxRetries, envVariables, jpegQuality, frame,
463
+ logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior,
464
+ forceWidth, forceHeight, forceBucketName, and deleteAfter.
465
+ Default values are provided for 'inputProps' (empty dictionary) and 'downloadBehavior'
466
+ ('type': 'play-in-browser') if they are not explicitly set.
445
467
 
446
- Returns:
447
- Dict: A dictionary containing all the serialized parameters of the object.
468
+ Returns:
469
+ Dict: A dictionary containing all the serialized parameters of the object.
448
470
  """
449
471
  parameters = {
450
472
  'type': 'still',
@@ -456,15 +478,20 @@ class RenderStillParams:
456
478
  'version': VERSION,
457
479
  'timeoutInMilliseconds': self.timeout_in_milliseconds,
458
480
  'maxRetries': self.max_retries,
459
- 'envVariables': self.env_variables if self.env_variables is not None else {},
481
+ 'envVariables': (
482
+ self.env_variables if self.env_variables is not None else {}
483
+ ),
460
484
  'jpegQuality': self.jpeg_quality,
461
485
  'storageClass': self.storage_class,
462
486
  'frame': self.frame,
463
487
  'logLevel': self.log_level,
464
488
  'outName': self.out_name,
465
- 'chromiumOptions': self.chromium_options if self.chromium_options is not None else {},
489
+ 'chromiumOptions': (
490
+ self.chromium_options if self.chromium_options is not None else {}
491
+ ),
466
492
  'scale': self.scale,
467
- 'downloadBehavior': self.download_behavior or PlayInBrowser(type='play-in-browser'),
493
+ 'downloadBehavior': self.download_behavior
494
+ or PlayInBrowser(type='play-in-browser'),
468
495
  'forceWidth': self.force_width,
469
496
  'apiKey': self.api_key,
470
497
  'forceHeight': self.force_height,
@@ -490,7 +517,7 @@ class RenderStillResponse:
490
517
  Represents the output information of a rendering operation performed on AWS Lambda.
491
518
 
492
519
  Attributes:
493
- estimated_price (CostsInfo):
520
+ estimated_price (CostsInfo):
494
521
  An object containing detailed cost information related to the rendering.
495
522
  url (str): The URL where the rendered image is stored or can be accessed.
496
523
  size_in_bytes (int): The size of the rendered image file in bytes.
@@ -498,6 +525,7 @@ class RenderStillResponse:
498
525
  render_id (str): A unique identifier for the rendering operation.
499
526
  cloud_watch_logs (str): The CloudWatch logs associated with the rendering operation.
500
527
  """
528
+
501
529
  estimated_price: CostsInfo
502
530
  url: str
503
531
  size_in_bytes: int
@@ -506,26 +534,26 @@ class RenderStillResponse:
506
534
  outKey: str
507
535
 
508
536
 
537
+ @dataclass
509
538
  class RenderMediaProgress:
510
539
  """
511
540
  Progress of video rendering.
512
541
  """
513
542
 
514
- def __init__(self):
515
- self.overallProgress = float()
516
- self.chunks = int()
517
- self.done = bool()
518
- self.encodingStatus = None
519
- self.costs = None
520
- self.renderId = str()
521
- self.renderMetadata = None
522
- self.outputFile = None
523
- self.outKey = None
524
- self.timeToFinish = None
525
- self.errors = []
526
- self.fatalErrorEncountered = bool()
527
- self.currentTime = int()
528
- self.renderSize = int()
529
- self.outputSizeInBytes = None
530
- self.lambdasInvoked = int()
531
- self.framesRendered = None
543
+ overallProgress: float = 0.0
544
+ chunks: int = 0
545
+ done: bool = False
546
+ encodingStatus: Optional[Any] = None
547
+ costs: Optional[Any] = None
548
+ renderId: str = ""
549
+ renderMetadata: Optional[Any] = None
550
+ outputFile: Optional[Any] = None
551
+ outKey: Optional[str] = None
552
+ timeToFinish: Optional[float] = None
553
+ errors: List[Any] = field(default_factory=list)
554
+ fatalErrorEncountered: bool = False
555
+ currentTime: int = 0
556
+ renderSize: int = 0
557
+ outputSizeInBytes: Optional[int] = None
558
+ lambdasInvoked: int = 0
559
+ framesRendered: Optional[int] = None
@@ -9,17 +9,32 @@ from enum import Enum
9
9
  import boto3
10
10
  from botocore.exceptions import ClientError
11
11
  from botocore.config import Config
12
- from .models import (CostsInfo, CustomCredentials, RenderMediaParams, RenderMediaProgress,
13
- RenderMediaResponse, RenderProgressParams, RenderStillResponse,
14
- RenderStillParams, RenderType)
12
+ from .models import (
13
+ CostsInfo,
14
+ CustomCredentials,
15
+ RenderMediaParams,
16
+ RenderMediaProgress,
17
+ RenderMediaResponse,
18
+ RenderProgressParams,
19
+ RenderStillResponse,
20
+ RenderStillParams,
21
+ RenderType,
22
+ )
15
23
 
16
24
 
17
25
  class RemotionClient:
18
26
  """A client for interacting with the Remotion service."""
19
27
 
20
28
  # pylint: disable=too-many-arguments
21
- def __init__(self, region, serve_url, function_name, access_key=None, secret_key=None,
22
- force_path_style=False):
29
+ def __init__(
30
+ self,
31
+ region,
32
+ serve_url,
33
+ function_name,
34
+ access_key=None,
35
+ secret_key=None,
36
+ force_path_style=False,
37
+ ):
23
38
  """
24
39
  Initialize the RemotionClient.
25
40
 
@@ -65,11 +80,13 @@ class RemotionClient:
65
80
  config = Config(s3={'addressing_style': 'path'})
66
81
 
67
82
  if self.access_key and self.secret_key:
68
- return boto3.client('s3',
69
- aws_access_key_id=self.access_key,
70
- aws_secret_access_key=self.secret_key,
71
- region_name=self.region,
72
- config=config)
83
+ return boto3.client(
84
+ 's3',
85
+ aws_access_key_id=self.access_key,
86
+ aws_secret_access_key=self.secret_key,
87
+ region_name=self.region,
88
+ config=config,
89
+ )
73
90
  return boto3.client('s3', region_name=self.region, config=config)
74
91
 
75
92
  def _get_remotion_buckets(self):
@@ -83,10 +100,14 @@ class RemotionClient:
83
100
  if bucket_name.startswith('remotionlambda-'):
84
101
  # Check if bucket is in the correct region
85
102
  try:
86
- bucket_region = s3_client.get_bucket_location(Bucket=bucket_name)
103
+ bucket_region = s3_client.get_bucket_location(
104
+ Bucket=bucket_name
105
+ )
87
106
  location = bucket_region.get('LocationConstraint')
88
107
  # us-east-1 returns None for LocationConstraint
89
- if location == self.region or (location is None and self.region == 'us-east-1'):
108
+ if location == self.region or (
109
+ location is None and self.region == 'us-east-1'
110
+ ):
90
111
  buckets.append(bucket_name)
91
112
  except ClientError:
92
113
  # Ignore buckets we can't access
@@ -120,7 +141,7 @@ class RemotionClient:
120
141
  else:
121
142
  s3_client.create_bucket(
122
143
  Bucket=bucket_name,
123
- CreateBucketConfiguration={'LocationConstraint': self.region}
144
+ CreateBucketConfiguration={'LocationConstraint': self.region},
124
145
  )
125
146
  return bucket_name
126
147
  except ClientError as e:
@@ -134,7 +155,7 @@ class RemotionClient:
134
155
  Bucket=bucket_name,
135
156
  Key=key,
136
157
  Body=payload,
137
- ContentType='application/json'
158
+ ContentType='application/json',
138
159
  )
139
160
  except ClientError as e:
140
161
  raise ValueError(f"Failed to upload to S3: {str(e)}") from e
@@ -146,7 +167,9 @@ class RemotionClient:
146
167
  max_still_inline_size = 5_000_000 - margin
147
168
  max_video_inline_size = 200_000 - margin
148
169
 
149
- max_size = max_still_inline_size if render_type == 'still' else max_video_inline_size
170
+ max_size = (
171
+ max_still_inline_size if render_type == 'still' else max_video_inline_size
172
+ )
150
173
 
151
174
  if payload_size > max_size:
152
175
  # Log warning similar to JavaScript implementation
@@ -184,27 +207,29 @@ class RemotionClient:
184
207
  return {
185
208
  'type': 'bucket-url',
186
209
  'hash': hash_value,
187
- 'bucketName': bucket_name
210
+ 'bucketName': bucket_name,
188
211
  }
189
212
  # Return payload format for smaller payloads
190
213
  return {
191
214
  'type': 'payload',
192
- 'payload': payload if payload not in ('', 'null') else json.dumps({})
215
+ 'payload': payload if payload not in ('', 'null') else json.dumps({}),
193
216
  }
194
217
  except (ValueError, TypeError) as error:
195
218
  raise ValueError(
196
- 'Error serializing InputProps. Check for circular ' +
197
- 'references or reduce the object size.'
219
+ 'Error serializing InputProps. Check for circular '
220
+ + 'references or reduce the object size.'
198
221
  ) from error
199
222
 
200
223
  def _create_lambda_client(self):
201
224
  if self.access_key and self.secret_key and self.region:
202
- return boto3.client('lambda',
203
- aws_access_key_id=self.access_key,
204
- aws_secret_access_key=self.secret_key,
205
- region_name=self.region)
225
+ return boto3.client(
226
+ 'lambda',
227
+ aws_access_key_id=self.access_key,
228
+ aws_secret_access_key=self.secret_key,
229
+ region_name=self.region,
230
+ )
206
231
 
207
- return boto3.client('lambda', region_name=self.region)
232
+ return boto3.client('lambda', region_name=self.region)
208
233
 
209
234
  def _find_json_objects(self, input_string):
210
235
  """Finds and returns a list of complete JSON object strings."""
@@ -220,7 +245,7 @@ class RemotionClient:
220
245
  elif char == '}':
221
246
  depth -= 1
222
247
  if depth == 0:
223
- objects.append(input_string[start_index:i + 1])
248
+ objects.append(input_string[start_index : i + 1])
224
249
 
225
250
  return objects
226
251
 
@@ -234,20 +259,17 @@ class RemotionClient:
234
259
 
235
260
  client = self._create_lambda_client()
236
261
  try:
237
- response = client.invoke(
238
- FunctionName=function_name, Payload=payload)
262
+ response = client.invoke(FunctionName=function_name, Payload=payload)
239
263
  result = response['Payload'].read().decode('utf-8')
240
264
  decoded_result = self._parse_stream(result)[-1]
241
265
  except client.exceptions.ResourceNotFoundException as e:
242
- raise ValueError(
243
- f"The function {function_name} does not exist.") from e
266
+ raise ValueError(f"The function {function_name} does not exist.") from e
244
267
  except client.exceptions.InvalidRequestContentException as e:
245
268
  raise ValueError("The request content is invalid.") from e
246
269
  except client.exceptions.RequestTooLargeException as e:
247
270
  raise ValueError("The request payload is too large.") from e
248
271
  except client.exceptions.ServiceException as e:
249
- raise ValueError(
250
- f"An internal service error occurred: {str(e)}") from e
272
+ raise ValueError(f"An internal service error occurred: {str(e)}") from e
251
273
  except Exception as e:
252
274
  raise ValueError(f"An unexpected error occurred: {str(e)}") from e
253
275
 
@@ -272,8 +294,11 @@ class RemotionClient:
272
294
  return list(obj)
273
295
  return asdict(obj)
274
296
 
275
- def construct_render_request(self, render_params: Union[RenderMediaParams, RenderStillParams],
276
- render_type: RenderType) -> str:
297
+ def construct_render_request(
298
+ self,
299
+ render_params: Union[RenderMediaParams, RenderStillParams],
300
+ render_type: RenderType,
301
+ ) -> str:
277
302
  """
278
303
  Construct a render request in JSON format.
279
304
 
@@ -286,19 +311,19 @@ class RemotionClient:
286
311
  render_params.serve_url = self.serve_url
287
312
 
288
313
  render_params.private_serialized_input_props = self._serialize_input_props(
289
- input_props=render_params.input_props,
290
- render_type=render_type
314
+ input_props=render_params.input_props, render_type=render_type
291
315
  )
292
316
 
293
317
  payload = render_params.serialize_params()
294
318
  return json.dumps(payload, default=self._custom_serializer)
295
319
 
296
- def construct_render_progress_request(self,
297
- render_id: str,
298
- bucket_name: str,
299
- log_level="info",
300
- s3_output_provider: Optional[CustomCredentials] = None
301
- ) -> str:
320
+ def construct_render_progress_request(
321
+ self,
322
+ render_id: str,
323
+ bucket_name: str,
324
+ log_level="info",
325
+ s3_output_provider: Optional[CustomCredentials] = None,
326
+ ) -> str:
302
327
  """
303
328
  Construct a render progress request in JSON format.
304
329
 
@@ -315,7 +340,7 @@ class RemotionClient:
315
340
  function_name=self.function_name,
316
341
  region=self.region,
317
342
  log_level=log_level,
318
- s3_output_provider=s3_output_provider
343
+ s3_output_provider=s3_output_provider,
319
344
  )
320
345
  return json.dumps(progress_params.serialize_params())
321
346
 
@@ -332,11 +357,15 @@ class RemotionClient:
332
357
  RenderResponse: Response from the render operation.
333
358
  """
334
359
  params = self.construct_render_request(
335
- render_params, render_type="video-or-audio")
360
+ render_params, render_type="video-or-audio"
361
+ )
336
362
  body_object = self._invoke_lambda(
337
- function_name=self.function_name, payload=params)
363
+ function_name=self.function_name, payload=params
364
+ )
338
365
  if body_object:
339
- return RenderMediaResponse(body_object['bucketName'], body_object['renderId'])
366
+ return RenderMediaResponse(
367
+ body_object['bucketName'], body_object['renderId']
368
+ )
340
369
 
341
370
  return None
342
371
 
@@ -352,11 +381,11 @@ class RemotionClient:
352
381
  Returns:
353
382
  RenderResponse: Response from the render operation.
354
383
  """
355
- params = self.construct_render_request(
356
- render_params, render_type='still')
384
+ params = self.construct_render_request(render_params, render_type='still')
357
385
 
358
386
  body_object = self._invoke_lambda(
359
- function_name=self.function_name, payload=params)
387
+ function_name=self.function_name, payload=params
388
+ )
360
389
 
361
390
  if body_object:
362
391
  return RenderStillResponse(
@@ -364,7 +393,7 @@ class RemotionClient:
364
393
  accrued_so_far=body_object['estimatedPrice']['accruedSoFar'],
365
394
  display_cost=body_object['estimatedPrice']['displayCost'],
366
395
  currency=body_object['estimatedPrice']['currency'],
367
- disclaimer=body_object['estimatedPrice']['disclaimer']
396
+ disclaimer=body_object['estimatedPrice']['disclaimer'],
368
397
  ),
369
398
  url=body_object['output'],
370
399
  size_in_bytes=body_object['sizeInBytes'],
@@ -375,12 +404,13 @@ class RemotionClient:
375
404
 
376
405
  return None
377
406
 
378
- def get_render_progress(self,
379
- render_id: str,
380
- bucket_name: str,
381
- log_level="info",
382
- s3_output_provider: Optional[CustomCredentials] = None
383
- ) -> Optional[RenderMediaProgress]:
407
+ def get_render_progress(
408
+ self,
409
+ render_id: str,
410
+ bucket_name: str,
411
+ log_level="info",
412
+ s3_output_provider: Optional[CustomCredentials] = None,
413
+ ) -> Optional[RenderMediaProgress]:
384
414
  """
385
415
  Get the progress of a render.
386
416
 
@@ -393,9 +423,14 @@ class RemotionClient:
393
423
  RenderProgress: Progress of the render.
394
424
  """
395
425
  params = self.construct_render_progress_request(
396
- render_id, bucket_name, log_level=log_level, s3_output_provider=s3_output_provider)
426
+ render_id,
427
+ bucket_name,
428
+ log_level=log_level,
429
+ s3_output_provider=s3_output_provider,
430
+ )
397
431
  progress_response = self._invoke_lambda(
398
- function_name=self.function_name, payload=params)
432
+ function_name=self.function_name, payload=params
433
+ )
399
434
  if progress_response:
400
435
  render_progress = RenderMediaProgress()
401
436
  render_progress.__dict__.update(progress_response)
@@ -1,2 +1,2 @@
1
1
  # pylint: disable=missing-module-docstring, missing-final-newline
2
- VERSION = "4.0.341"
2
+ VERSION = "4.0.345"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotion-lambda
3
- Version: 4.0.341
3
+ Version: 4.0.345
4
4
  Summary: Remotion Lambda client
5
5
  Home-page: https://github.com/remotion-dev/remotion/tree/main/packages/lambda-python
6
6
  Author: Jonny Burger
@@ -1,14 +0,0 @@
1
- # pylint: disable=missing-module-docstring
2
- from .models import (
3
- RenderMediaParams, RenderMediaProgress,
4
- RenderMediaResponse, RenderProgressParams,
5
- RenderStillParams, RenderStillResponse, CostsInfo,
6
- Privacy, ValidStillImageFormats, LogLevel, OpenGlRenderer,
7
- ChromiumOptions, CustomCredentialsWithoutSensitiveData, CustomCredentials,
8
- OutNameInputObject, PlayInBrowser, ShouldDownload, DeleteAfter,
9
- Webhook
10
-
11
-
12
- )
13
- from .remotionclient import RemotionClient
14
- from .version import VERSION