ActionStreamer 1.4.7__tar.gz → 2.0.0__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 (162) hide show
  1. actionstreamer-2.0.0/PKG-INFO +51 -0
  2. actionstreamer-2.0.0/README.md +31 -0
  3. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/CommonFunctions/common_functions.py +19 -67
  4. actionstreamer-2.0.0/actionstreamer/CommonFunctions/hmac_signature.py +44 -0
  5. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Config/config.py +40 -24
  6. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/DeviceHealthFunctions/device_health_functions.py +1494 -1433
  7. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/__init__.py +9 -9
  8. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/create_video_clip.py +7 -1
  9. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/device.py +3 -0
  10. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/device_health_row.py +21 -10
  11. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_type.py +8 -2
  12. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/file.py +7 -1
  13. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/item_type.py +0 -1
  14. actionstreamer-2.0.0/actionstreamer/Model/moq_conference_event_parameters.py +34 -0
  15. actionstreamer-2.0.0/actionstreamer/Model/moq_publish_event_parameters.py +21 -0
  16. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/recording_args.py +7 -1
  17. actionstreamer-2.0.0/actionstreamer/Model/srt_args.py +88 -0
  18. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/srt_publish_credential.py +22 -6
  19. actionstreamer-2.0.0/actionstreamer/Model/user_status.py +7 -0
  20. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/video_clip.py +7 -1
  21. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/__init__.py +2 -5
  22. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Agent/agent.py +5 -1
  23. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/AudioClip/audio_clip.py +15 -4
  24. actionstreamer-2.0.0/actionstreamer/WebService/Auth/__init__.py +4 -0
  25. actionstreamer-2.0.0/actionstreamer/WebService/Auth/auth.py +80 -0
  26. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Caption/caption.py +6 -2
  27. actionstreamer-2.0.0/actionstreamer/WebService/Device/__init__.py +4 -0
  28. actionstreamer-2.0.0/actionstreamer/WebService/Device/device.py +367 -0
  29. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/DeviceGroup/device_group.py +16 -17
  30. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/DeviceHealth/device_health.py +19 -4
  31. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Event/event.py +20 -5
  32. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/File/file.py +18 -4
  33. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Image/image.py +9 -2
  34. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/LogMessage/log_message.py +5 -1
  35. actionstreamer-2.0.0/actionstreamer/WebService/Moq/__init__.py +4 -0
  36. actionstreamer-2.0.0/actionstreamer/WebService/Moq/managed.py +13 -0
  37. actionstreamer-2.0.0/actionstreamer/WebService/Moq/moq.py +306 -0
  38. actionstreamer-2.0.0/actionstreamer/WebService/Moq/subscribe.py +45 -0
  39. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Tag/tag.py +5 -1
  40. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/VideoClip/video_clip.py +16 -5
  41. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/__init__.py +1 -2
  42. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/pyproject.toml +1 -1
  43. actionstreamer-1.4.7/PKG-INFO +0 -23
  44. actionstreamer-1.4.7/README.md +0 -3
  45. actionstreamer-1.4.7/actionstreamer/Model/create_stream.py +0 -66
  46. actionstreamer-1.4.7/actionstreamer/Model/srt_args.py +0 -59
  47. actionstreamer-1.4.7/actionstreamer/Model/stream.py +0 -93
  48. actionstreamer-1.4.7/actionstreamer/Model/stream_type.py +0 -12
  49. actionstreamer-1.4.7/actionstreamer/Result/stream_result.py +0 -16
  50. actionstreamer-1.4.7/actionstreamer/WebService/Auth/__init__.py +0 -4
  51. actionstreamer-1.4.7/actionstreamer/WebService/Auth/auth.py +0 -48
  52. actionstreamer-1.4.7/actionstreamer/WebService/Device/__init__.py +0 -4
  53. actionstreamer-1.4.7/actionstreamer/WebService/Device/device.py +0 -213
  54. actionstreamer-1.4.7/actionstreamer/WebService/Stream/__init__.py +0 -4
  55. actionstreamer-1.4.7/actionstreamer/WebService/Stream/stream.py +0 -81
  56. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/CommonFunctions/Wifi/__init__.py +0 -0
  57. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/CommonFunctions/Wifi/wifi.py +0 -0
  58. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/CommonFunctions/__init__.py +0 -0
  59. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Config/__init__.py +0 -0
  60. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/DeviceFunctions/__init__.py +0 -0
  61. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/DeviceFunctions/device_functions.py +0 -0
  62. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/DeviceHealthFunctions/__init__.py +0 -0
  63. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/agent_type.py +0 -0
  64. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/audio_clip.py +0 -0
  65. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/camera_multiplex_args.py +0 -0
  66. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/capture_frames_args.py +0 -0
  67. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/capture_photo_args.py +0 -0
  68. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/clear_flag_queue_args.py +0 -0
  69. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/collection_base.py +0 -0
  70. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/concatenate_clips_args.py +0 -0
  71. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/conference_args.py +0 -0
  72. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/create_audio_clip.py +0 -0
  73. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/create_event_preset.py +0 -0
  74. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/create_image.py +0 -0
  75. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/date_time_encoder.py +0 -0
  76. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/device_group.py +0 -0
  77. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/device_health.py +0 -0
  78. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/epoch_range.py +0 -0
  79. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event.py +0 -0
  80. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_args.py +0 -0
  81. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_details.py +0 -0
  82. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_preset.py +0 -0
  83. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_preset_workflow_args.py +0 -0
  84. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_status.py +0 -0
  85. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/event_with_names.py +0 -0
  86. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/file_status.py +0 -0
  87. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/image.py +0 -0
  88. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/log_message.py +0 -0
  89. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/microphone_multiplex_args.py +0 -0
  90. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/multiplex_conference_args.py +0 -0
  91. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/multiplex_leave_conference_args.py +0 -0
  92. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/multiplex_recording_args.py +0 -0
  93. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/multiplex_stop_recording_args.py +0 -0
  94. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/name_value_pair.py +0 -0
  95. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/notification.py +0 -0
  96. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/package.py +0 -0
  97. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/patch_operation.py +0 -0
  98. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/receive_actionync_args.py +0 -0
  99. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/receive_udp_audio_args.py +0 -0
  100. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/receive_udp_video_args.py +0 -0
  101. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/record_audio_args.py +0 -0
  102. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/rtmp_args.py +0 -0
  103. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/send_actionsync_args.py +0 -0
  104. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/send_udp_audio_args.py +0 -0
  105. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/send_udp_video_args.py +0 -0
  106. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/stop_receive_actionsync_args.py +0 -0
  107. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/stop_receive_udp_audio_args.py +0 -0
  108. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/stop_receive_udp_video_args.py +0 -0
  109. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/tag.py +0 -0
  110. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/tag_list_for_device_list.py +0 -0
  111. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/token.py +0 -0
  112. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/transcoding_args.py +0 -0
  113. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/transfer_args.py +0 -0
  114. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/video_clip_status.py +0 -0
  115. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/video_clip_type.py +0 -0
  116. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/web_service_result.py +0 -0
  117. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/wifi_connection.py +0 -0
  118. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Model/workflow_preset.py +0 -0
  119. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/audio_clip_result.py +0 -0
  120. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/device_group_result.py +0 -0
  121. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/device_health_result.py +0 -0
  122. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/device_health_row_result.py +0 -0
  123. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/device_result.py +0 -0
  124. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/event_preset_result.py +0 -0
  125. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/event_result.py +0 -0
  126. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/event_with_names_result.py +0 -0
  127. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/file_result.py +0 -0
  128. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/image_result.py +0 -0
  129. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/integer_result.py +0 -0
  130. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/log_message_result.py +0 -0
  131. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/notification_result.py +0 -0
  132. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/package_result.py +0 -0
  133. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/srt_publish_credential_result.py +0 -0
  134. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/standard_result.py +0 -0
  135. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/token_result.py +0 -0
  136. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/Result/video_clip_result.py +0 -0
  137. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Agent/__init__.py +0 -0
  138. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/AudioClip/__init__.py +0 -0
  139. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Caption/__init__.py +0 -0
  140. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/DeviceGroup/__init__.py +0 -0
  141. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/DeviceHealth/__init__.py +0 -0
  142. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Event/__init__.py +0 -0
  143. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/EventPreset/__init__.py +0 -0
  144. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/EventPreset/event_preset.py +0 -0
  145. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/File/__init__.py +0 -0
  146. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Image/__init__.py +0 -0
  147. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/LogMessage/__init__.py +0 -0
  148. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Notification/__init__.py +0 -0
  149. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Notification/notification.py +0 -0
  150. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Package/__init__.py +0 -0
  151. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Package/package.py +0 -0
  152. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Patch/__init__.py +0 -0
  153. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Patch/patch.py +0 -0
  154. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Session/__init__.py +0 -0
  155. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Session/session.py +0 -0
  156. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Setting/__init__.py +0 -0
  157. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Setting/setting.py +0 -0
  158. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Tag/__init__.py +0 -0
  159. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Token/__init__.py +0 -0
  160. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/Token/token.py +0 -0
  161. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/WebService/VideoClip/__init__.py +0 -0
  162. {actionstreamer-1.4.7 → actionstreamer-2.0.0}/actionstreamer/__init__.py +0 -0
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.1
2
+ Name: actionstreamer
3
+ Version: 2.0.0
4
+ Summary: A library for the ActionStreamer API.
5
+ Author: ActionStreamer
6
+ Author-email: joe@actionstreamer.com
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: keyring (>=25.7.0)
13
+ Requires-Dist: psutil (>=6.0.0)
14
+ Requires-Dist: pycryptodome (>=3.23.0)
15
+ Requires-Dist: pytz (>=2024.1,<2025.0)
16
+ Requires-Dist: requests (>=2.33.0,<3.0.0)
17
+ Requires-Dist: wmi (>=1.5.1,<2.0.0) ; sys_platform == "win32"
18
+ Description-Content-Type: text/markdown
19
+
20
+ # ActionStreamer
21
+
22
+ A Python library for the ActionStreamer API.
23
+
24
+ ## Version 2 compatibility
25
+
26
+ Version 2 removes the obsolete Stream API, Stream models and Stream result
27
+ types. Source and StreamSession APIs are not replacements for those legacy
28
+ calls. Applications that still require Stream should pin the published
29
+ `actionstreamer==1.4.8` release until migrated.
30
+
31
+ The checked-in version is a development base, not a release. Build local
32
+ development artifacts with `python build_dev.py`; their version includes a
33
+ source fingerprint. Do not publish those artifacts as a release.
34
+
35
+ ## Device identity
36
+
37
+ Resolve an existing Device by its logical UUID once after authentication, then use its DeviceID for operations:
38
+
39
+ ```python
40
+ from actionstreamer.WebService import Device, VideoClip
41
+
42
+ device_result = Device.get_device_by_unique_identifier(ws_config, device_uuid)
43
+ if device_result.code != 200 or device_result.device.key <= 0:
44
+ raise RuntimeError('Device identity lookup failed')
45
+
46
+ device_id = device_result.device.key
47
+ result = VideoClip.create_video_clip_list(ws_config, '', clips, device_id=device_id)
48
+ ```
49
+
50
+ The UUID lookup and DeviceID operations require access to the Device. Existing serial-based SDK calls remain supported. Legacy agents can use `Device.resolve_legacy_device_id` to discover and persist an existing Device UUID on their first upgraded startup.
51
+
@@ -0,0 +1,31 @@
1
+ # ActionStreamer
2
+
3
+ A Python library for the ActionStreamer API.
4
+
5
+ ## Version 2 compatibility
6
+
7
+ Version 2 removes the obsolete Stream API, Stream models and Stream result
8
+ types. Source and StreamSession APIs are not replacements for those legacy
9
+ calls. Applications that still require Stream should pin the published
10
+ `actionstreamer==1.4.8` release until migrated.
11
+
12
+ The checked-in version is a development base, not a release. Build local
13
+ development artifacts with `python build_dev.py`; their version includes a
14
+ source fingerprint. Do not publish those artifacts as a release.
15
+
16
+ ## Device identity
17
+
18
+ Resolve an existing Device by its logical UUID once after authentication, then use its DeviceID for operations:
19
+
20
+ ```python
21
+ from actionstreamer.WebService import Device, VideoClip
22
+
23
+ device_result = Device.get_device_by_unique_identifier(ws_config, device_uuid)
24
+ if device_result.code != 200 or device_result.device.key <= 0:
25
+ raise RuntimeError('Device identity lookup failed')
26
+
27
+ device_id = device_result.device.key
28
+ result = VideoClip.create_video_clip_list(ws_config, '', clips, device_id=device_id)
29
+ ```
30
+
31
+ The UUID lookup and DeviceID operations require access to the Device. Existing serial-based SDK calls remain supported. Legacy agents can use `Device.resolve_legacy_device_id` to discover and persist an existing Device UUID on their first upgraded startup.
@@ -3,7 +3,6 @@
3
3
  import json
4
4
  import sys
5
5
  import hashlib
6
- import hmac
7
6
  import uuid
8
7
  import subprocess
9
8
  import time
@@ -23,6 +22,7 @@ from Crypto.Cipher import AES
23
22
  from Crypto.Util.Padding import pad, unpad
24
23
  from actionstreamer.Config import WebServiceConfig
25
24
  from actionstreamer import Result
25
+ from .hmac_signature import dictionary_to_string, get_hmac_signature
26
26
 
27
27
  SwitchValueType = TypeVar("SwitchValueType")
28
28
 
@@ -169,15 +169,15 @@ def send_signed_request(ws_config: WebServiceConfig, method: str, url: str, path
169
169
  verify = not ws_config.ignore_ssl
170
170
 
171
171
  if method.upper() == 'POST':
172
- response = requests.post(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
172
+ response = ws_config.requests_session.post(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
173
173
  elif method.upper() == 'GET':
174
- response = requests.get(url, headers=headers, params=parameters, verify=verify, timeout=ws_config.timeout)
174
+ response = ws_config.requests_session.get(url, headers=headers, params=parameters, verify=verify, timeout=ws_config.timeout)
175
175
  elif method.upper() == 'PUT':
176
- response = requests.put(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
176
+ response = ws_config.requests_session.put(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
177
177
  elif method.upper() == 'PATCH':
178
- response = requests.patch(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
178
+ response = ws_config.requests_session.patch(url, headers=headers, data=body, params=parameters, verify=verify, timeout=ws_config.timeout)
179
179
  elif method.upper() == 'DELETE':
180
- response = requests.delete(url, headers=headers, params=parameters, verify=verify, timeout=ws_config.timeout)
180
+ response = ws_config.requests_session.delete(url, headers=headers, params=parameters, verify=verify, timeout=ws_config.timeout)
181
181
  else:
182
182
  raise ValueError(f"Unsupported HTTP method: {method}")
183
183
 
@@ -294,55 +294,6 @@ def send_signed_request_long_poll(ws_config: WebServiceConfig, method: str, url:
294
294
  return result
295
295
 
296
296
 
297
- def get_hmac_signature(secret_key: str, method: str, path: str, headers: Dict[str, str] = {}, parameters: Dict[str, str] = {}, body: str = '')-> tuple[str, str]:
298
-
299
- try:
300
- if 'Content-Type' in headers:
301
- del headers['Content-Type']
302
-
303
- header_string = dictionary_to_string(headers)
304
- parameter_string = dictionary_to_string(parameters)
305
-
306
- # Path should be in the format /v1/event
307
- if not path.startswith('/'):
308
- path = '/' + path
309
-
310
- if path.endswith('/') and len(path) > 1:
311
- path = path[:-1]
312
-
313
- string_to_sign = '\n'.join([method, path, header_string, parameter_string, body if body else ''])
314
-
315
- string_to_sign = string_to_sign.strip()
316
- #log_to_console("stringToSign: " + string_to_sign)
317
-
318
- # Generate the HMAC SHA256 signature
319
- hmac_signature = hmac.new(secret_key.encode('utf-8'), string_to_sign.encode('utf-8'), hashlib.sha256)
320
-
321
- # Convert the HMAC signature to hexadecimal
322
- return hmac_signature.hexdigest(), string_to_sign
323
-
324
- except Exception as ex:
325
- filename, line_number = get_exception_info()
326
- if filename is not None and line_number is not None:
327
- print(f"Exception occurred at line {line_number} in {filename}")
328
- print(ex)
329
-
330
- return 'error', 'error'
331
-
332
-
333
- def dictionary_to_string(dictionary: dict[Any, Any]) -> str:
334
- result = ''
335
-
336
- try:
337
- sorted_keys = sorted(dictionary.keys())
338
- for key in sorted_keys:
339
- result += f"{key}: {dictionary[key]}\n"
340
- except Exception:
341
- pass
342
-
343
- return result
344
-
345
-
346
297
  def _do_upload(file_path: str, signed_url: str, timeout: Optional[int]) -> requests.Response:
347
298
  with open(file_path, 'rb') as file:
348
299
  # Set reasonable connection/read timeouts to avoid hanging forever
@@ -749,24 +700,19 @@ def trim_mp4_beginning(file_path: str, seconds_to_trim: int, new_file_path: str)
749
700
  return -1
750
701
 
751
702
 
752
- def trim_mp4_end(file_path: str, clip_length_in_s: int, seconds_to_trim: int, new_file_path: str):
753
- # Calculate the duration of the video in milliseconds
754
- duration = int(clip_length_in_s * 1000)
755
-
756
- # Calculate the end time for the trimmed video
757
- end = duration - (int(seconds_to_trim * 1000))
703
+ def trim_mp4_end(file_path: str, clip_length_in_s: float, seconds_to_trim: float, new_file_path: str):
704
+
705
+ end_time_in_s = clip_length_in_s - seconds_to_trim
758
706
 
759
- # Define the ffmpeg command
760
- command = f"ffmpeg -i '{file_path}' -t {end} -c copy '{new_file_path}'"
707
+ command = f"ffmpeg -i '{file_path}' -t {end_time_in_s} -c copy '{new_file_path}'"
761
708
 
762
709
  try:
763
- # Execute the ffmpeg command
764
710
  subprocess.run(command, shell=True)
765
711
 
766
712
  print(f"Trimmed {seconds_to_trim} seconds from the end of {file_path} and saved as {new_file_path}")
767
713
  return 0
768
- except Exception as e:
769
- print(f"Error: {e}")
714
+ except Exception as ex:
715
+ print(f"Error: {ex}")
770
716
  return -1
771
717
 
772
718
 
@@ -903,6 +849,8 @@ def decrypt_file_gpg_aes256(encrypted_file_path: str, password: str) -> str:
903
849
 
904
850
  def normalize_key_to_32_bytes(key: str) -> bytes:
905
851
  original_key_bytes = key.encode("utf-8")
852
+ if not original_key_bytes:
853
+ raise ValueError("Encryption key must not be empty")
906
854
  normalized_key_bytes = bytearray(32)
907
855
 
908
856
  normalized_key_index = 0
@@ -970,7 +918,7 @@ def unzip_file(zip_file_path: str, output_folder_path: str):
970
918
  zip_ref.extractall(output_folder_path)
971
919
 
972
920
 
973
- def unzip_and_execute(zip_file_path: str, unzip_to_folder_path: str):
921
+ def unzip_and_execute(zip_file_path: str, unzip_to_folder_path: str, *, raise_on_error: bool = False):
974
922
  # This function assumes there is a file called install.json inside the outer zip file, along with a deploy script and the inner zip file.
975
923
  # Outer zip file package_1.2.3.zip:
976
924
  # install.json
@@ -1010,12 +958,16 @@ def unzip_and_execute(zip_file_path: str, unzip_to_folder_path: str):
1010
958
  pass
1011
959
 
1012
960
  except Exception as ex:
961
+ if raise_on_error:
962
+ raise
1013
963
  filename, line_number = get_exception_info()
1014
964
  if filename is not None and line_number is not None:
1015
965
  print(f"Exception occurred at line {line_number} in {filename}")
1016
966
  print(ex)
1017
967
 
1018
968
  except (FileNotFoundError, json.JSONDecodeError) as e:
969
+ if raise_on_error:
970
+ raise
1019
971
  print(f"Error reading JSON file: {e}")
1020
972
  return None, None
1021
973
 
@@ -0,0 +1,44 @@
1
+ import hashlib
2
+ import hmac
3
+ import sys
4
+ from typing import Any
5
+
6
+
7
+ def dictionary_to_string(dictionary: dict[Any, Any]) -> str:
8
+ result = ""
9
+
10
+ try:
11
+ sorted_keys = sorted(dictionary.keys())
12
+ for key in sorted_keys:
13
+ result += f"{key}: {dictionary[key]}\n"
14
+ except Exception:
15
+ pass
16
+
17
+ return result
18
+
19
+
20
+ def get_hmac_signature(secret_key: str, method: str, path: str, headers: dict[str, str] = {}, parameters: dict[str, str] = {}, body: str = "") -> tuple[str, str]:
21
+ try:
22
+ if "Content-Type" in headers:
23
+ del headers["Content-Type"]
24
+
25
+ header_string = dictionary_to_string(headers)
26
+ parameter_string = dictionary_to_string(parameters)
27
+
28
+ if not path.startswith("/"):
29
+ path = "/" + path
30
+
31
+ if path.endswith("/") and len(path) > 1:
32
+ path = path[:-1]
33
+
34
+ string_to_sign = "\n".join([method, path, header_string, parameter_string, body if body else ""])
35
+ string_to_sign = string_to_sign.strip()
36
+ hmac_signature = hmac.new(secret_key.encode("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha256)
37
+ return hmac_signature.hexdigest(), string_to_sign
38
+
39
+ except Exception as exception:
40
+ _, _, exception_traceback = sys.exc_info()
41
+ if exception_traceback is not None:
42
+ print(f"Exception occurred at line {exception_traceback.tb_lineno} in {exception_traceback.tb_frame.f_code.co_filename}")
43
+ print(exception)
44
+ return "error", "error"
@@ -5,10 +5,20 @@ import shutil
5
5
  import keyring
6
6
  import keyring.errors
7
7
  from typing import Any, Dict, Optional, Mapping, cast
8
+ import requests
8
9
  from actionstreamer import Model
9
10
 
11
+
12
+ def normalize_base_url(base_url: str) -> str:
13
+ """Return an API base URL in the form expected by the web-service wrappers."""
14
+ value = (base_url or '').strip()
15
+ if value and not value.endswith('/'):
16
+ value += '/'
17
+ return value
18
+
19
+
10
20
  class WebServiceConfig:
11
-
21
+
12
22
  """
13
23
  Configuration for connecting to the web service.
14
24
 
@@ -19,51 +29,56 @@ class WebServiceConfig:
19
29
  base_url (str): The base URL of the web service.
20
30
  timeout (int): The timeout for requests in seconds.
21
31
  ignore_ssl (bool): Whether to ignore SSL verification.
22
- """
32
+ requests_session (requests.Session): Reusable HTTP session.
33
+ """
34
+
23
35
  def __init__(self, access_key: str, secret_key: str, session_token: str | None = None, base_url: str = '', timeout: int = 30, ignore_ssl: bool = False):
24
- """
25
- Initialize the WebServiceConfig.
26
- The user is explicitly entrusted to called the from_config_folder if not providing any parameters
27
-
28
- :param access_key: The access key for authentication.
29
- :param secret_key: The secret key for authentication.
30
- :param session_token: A token for authentication when not using HMAC-SHA256.
31
- :param base_url: The base URL of the web service.
32
- :param timeout: The timeout for requests in seconds (default is 30).
33
- :param ignore_ssl: Whether to ignore SSL verification (default is False).
34
- """
36
+
35
37
  self.access_key = access_key
36
38
  self.secret_key = secret_key
37
39
  self.session_token = session_token
38
- self.base_url = base_url
40
+ self.base_url = normalize_base_url(base_url)
39
41
  self.timeout = timeout
40
42
  self.ignore_ssl = ignore_ssl
41
43
 
44
+ self.requests_session = requests.Session()
45
+
46
+
47
+ def clone_with_new_requests_session(self) -> "WebServiceConfig":
48
+
49
+ return WebServiceConfig(
50
+ access_key=self.access_key,
51
+ secret_key=self.secret_key,
52
+ session_token=self.session_token,
53
+ base_url=self.base_url,
54
+ timeout=self.timeout,
55
+ ignore_ssl=self.ignore_ssl
56
+ )
57
+
58
+
42
59
  @classmethod
43
60
  def from_config_folder(cls, config_folder_path: str, timeout: int = 30):
44
- # Get environment, default to Prod
61
+
45
62
  try:
46
63
  environment = get_config_value(config_folder_path, "Environment") or "Prod"
47
64
  except (FileNotFoundError, KeyError):
48
65
  environment = "Prod"
49
66
 
50
- # Set ignore_ssl based on environment
51
67
  ignore_ssl = environment.lower() != "prod"
52
68
 
53
- # Create instance
54
69
  return cls(
55
- access_key = get_config_value(config_folder_path, "AccessKey"),
56
- secret_key = get_config_value(config_folder_path, "SecretKey"),
57
- session_token = None,
58
- base_url = get_config_value(config_folder_path, f"WebServiceBaseUrl_{environment}"),
59
- timeout = timeout,
60
- ignore_ssl = ignore_ssl
70
+ access_key=get_config_value(config_folder_path, "AccessKey"),
71
+ secret_key=get_config_value(config_folder_path, "SecretKey"),
72
+ session_token=None,
73
+ base_url=get_config_value(config_folder_path, f"WebServiceBaseUrl_{environment}"),
74
+ timeout=timeout,
75
+ ignore_ssl=ignore_ssl
61
76
  )
62
77
 
63
78
 
64
79
  class LogConfig:
65
80
 
66
- def __init__(self, ws_config: WebServiceConfig, device_serial: str, agent_type: str, agent_version: str, agent_index: int, process_id: int, device_name: str = ''):
81
+ def __init__(self, ws_config: WebServiceConfig, device_serial: str, agent_type: str, agent_version: str, agent_index: int, process_id: int, device_name: str = '', device_id: int | None = None):
67
82
  self.ws_config = ws_config
68
83
  self.device_name = device_name
69
84
  self.device_serial = device_serial
@@ -71,6 +86,7 @@ class LogConfig:
71
86
  self.agent_version = agent_version
72
87
  self.agent_index = agent_index
73
88
  self.process_id = process_id
89
+ self.device_id = device_id
74
90
 
75
91
 
76
92
  class AppConfig: