(metrics)
Operations related to metrics api
- get_realtime_viewership - Query realtime viewership
- get_viewership - Query viewership metrics
- get_creator_viewership - Query creator viewership metrics
- get_public_viewership - Query public total views metrics
- get_usage - Query usage metrics
Requires a private (non-CORS) API key to be used.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.get_realtime_viewership()
if res.data is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
playback_id |
Optional[str] | ➖ | The playback ID to filter the query results. This can be a canonical playback ID from Livepeer assets or streams, or dStorage identifiers for assets |
creator_id |
Optional[str] | ➖ | The creator ID to filter the query results |
breakdown_by |
List[operations.BreakdownBy] | ➖ | The list of fields to break down the query results. Specify this query-string multiple times to break down by multiple fields. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetRealtimeViewershipNowResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Requires a private (non-CORS) API key to be used.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.get_viewership(request={})
if res.data is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetViewershipMetricsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetViewershipMetricsResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Requires a proof of ownership to be sent in the request, which for now is just the assetId or streamId parameters (1 of those must be in the query-string).
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.get_creator_viewership(request={})
if res.data is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetCreatorViewershipMetricsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetCreatorViewershipMetricsResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Allows querying for the public metrics for viewership about a video. This can be called from the frontend with a CORS key, or even unauthenticated.
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.get_public_viewership(playback_id="<value>")
if res.data is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
playback_id |
str | ✔️ | The playback ID to filter the query results. This can be a canonical playback ID from Livepeer assets or streams, or dStorage identifiers for assets |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetPublicViewershipMetricsResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Query usage metrics
from livepeer import Livepeer
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.get_usage(request={})
if res.usage_metric is not None:
# handle response
pass
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetUsageMetricsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetUsageMetricsResponse
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |