Get Video Clip
Description
The get_video_clip
function retrieves a video clip's metadata from the web service using its unique clip ID. The response includes information about the video clip such as duration, device details, and storage identifiers.
Function Signature:
def get_video_clip(ws_config: WebServiceConfig, video_clip_id: int) -> WebServiceResult:
Parameters
- ws_config (WebServiceConfig): Configuration object for the web service.
- video_clip_id (int): The unique ID of the video clip to retrieve.
Returns
- WebServiceResult: An object containing:
- http_response_code: The HTTP response code from the server.
- http_response_string: The raw response string from the server.
- json_data: The parsed JSON response, which includes the video clip details.
Example Usage
ws_config = WebServiceConfig(base_url="https://api.actionstreamer.com")
video_clip_id = 1234
result = get_video_clip(ws_config, video_clip_id)
print(result.http_response_code, result.json_data)
Behavior
- Constructs the API URL using the provided video clip ID.
- Sends a
GET
request tov1/videoclip/{video_clip_id}
. - Parses the response JSON and populates the
WebServiceResult
.
Error Handling
- If an exception occurs:
- Sets the result code to
-1
. - Logs the filename and line number of the error.
- Includes the exception message in the result’s description.
- Sets the result code to