diff --git a/pywidevine/cdm.py b/pywidevine/cdm.py index ba6cdf4..839903a 100644 --- a/pywidevine/cdm.py +++ b/pywidevine/cdm.py @@ -152,7 +152,7 @@ class Cdm: self.service_certificate = drm_certificate return self.service_certificate.provider_id - def get_license_challenge(self, type_: LicenseType = LicenseType.STREAMING, privacy_mode: bool = True) -> bytes: + def get_license_challenge(self, type_: Union[int, str] = LicenseType.STREAMING, privacy_mode: bool = True) -> bytes: """ Get a License Challenge to send to a License Server. @@ -167,6 +167,9 @@ class Cdm: """ request_id = get_random_bytes(16) + if isinstance(type_, str): + type_ = LicenseType.Value(type_) + license_request = LicenseRequest() license_request.type = LicenseRequest.RequestType.Value("NEW") license_request.request_time = int(time.time())