### Install pyplayready Source: https://github.com/ready-dl/pyplayready/blob/main/README.md Use pip to install the pyplayready library. After installation, run `pyplayready --help` to see available CLI functions. ```shell pip install pyplayready ``` -------------------------------- ### Get Playready License Source: https://github.com/ready-dl/pyplayready/blob/main/README.md This Python snippet demonstrates how to load a device, open a CDM session, request a license challenge, send it to a license server, parse the response, and retrieve decryption keys. Ensure you have the necessary certificate and key files. ```python from pyplayready.cdm import Cdm from pyplayready.device import Device from pyplayready.system.pssh import PSSH from pyplayready.misc.revocation_list import RevocationList import requests device = Device.load("C:/Path/To/A/Device.prd") cdm = Cdm.from_device(device) session_id = cdm.open() pssh = PSSH( "AAADfHBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAA1xcAwAAAQABAFIDPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AH ``` -------------------------------- ### Create Playready Device Source: https://github.com/ready-dl/pyplayready/blob/main/README.md Create a Playready Device (.prd) file using your bgroupcert.dat and zgpriv.dat files. ```shell pyplayready create-device -c bgroupcert.dat -k zgpriv.dat ``` -------------------------------- ### Export Playready Device Source: https://github.com/ready-dl/pyplayready/blob/main/README.md Export a provisioned Playready device (.prd) back into its raw .dat files. ```shell pyplayready export-device DEVICE.prd ``` -------------------------------- ### Test Playready Device Source: https://github.com/ready-dl/pyplayready/blob/main/README.md Test a Playready device file (.prd) to verify its integrity and functionality. ```shell pyplayready test DEVICE.prd ``` -------------------------------- ### Send License Challenge and Parse Response Source: https://github.com/ready-dl/pyplayready/blob/main/README.md This Python snippet continues the license retrieval process by sending the generated license challenge to a specified URL and then parsing the received license response. It requires the `requests` library. ```python response = requests.post( url="https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:2000)", headers={ 'Content-Type': 'text/xml; charset=UTF-8', }, data=request, ) cdm.parse_license(session_id, response.text) for key in cdm.get_keys(session_id): print(f"{key.key_id.hex}:{key.key.hex()}") cdm.close(session_id) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.