Skip to main content

Overview

The Mocra Python SDK wraps the Mocra REST API and handles authentication, serialization, and error handling for you. Package: mocra — requires Python 3.10+

Installation

Quick start

VideoObservabilityApi

The main client class. Instantiate it once with your API key and reuse it across requests.

Constructor parameters

score_video()

Analyzes a video against Mocra’s built-in criteria and any custom criteria you provide.

Parameters

Returns: ObserveResponse

ExtraCriterion

Defines a custom quality criterion to include in the analysis.

DefaultCriterion

An enum of the built-in criteria that Mocra evaluates by default. Pass one or more values to ignore_criteria to exclude them from the analysis.

Error handling

The SDK raises MocraError when the API returns a non-200 response, and httpx.HTTPError for network-level failures.

MocraError

Context manager

Use VideoObservabilityApi as a context manager to ensure the underlying HTTP connection is closed when you’re done:
You can also call api.close() manually if you are not using the context manager.