Read and instantiated environment variables by using load_env() as below. Depending on what you are doing, you may or may not need some of the variables.
Created a Media Services client as below.
from dotenv import load_dotenv
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
from azure.mgmt.media.models import (StreamingEndpoint, StreamingEntityScaleUnit)
import os
# Create the Media Services client and authenticate using the DefaultAzureCredential
default_credential = DefaultAzureCredential()
client = AzureMediaServices(default_credential, subscription_id)
# Get the media services account.
media_account = client.mediaservices.get(resource_group_name, account_name)
# From SDK:
# list(resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable[azure.mgmt.media.models._models_py3.StreamingEndpointListResult]
def list_streaming_endpoint(resource_group_name, account_name):
results = client.streaming_endpoints.list(resource_group_name, account_name)
# Print the names of the streaming endpoints.
for endpoint in results:
print(endpoint.name)
list_streaming_endpoint(resource_group_name, account_name)