From f2ed83205b93d478b118d0cb020136bd5fe9a0f8 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 6 Aug 2022 09:19:58 +0100 Subject: [PATCH] serve: Provide license type to get_license_challenge as-is There's no need for serve code to handle parsing of it when the Cdm code will do so better. --- pywidevine/serve.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pywidevine/serve.py b/pywidevine/serve.py index 634f060..ea7a2f4 100644 --- a/pywidevine/serve.py +++ b/pywidevine/serve.py @@ -21,7 +21,7 @@ from pywidevine import __version__ from pywidevine.cdm import Cdm from pywidevine.device import Device from pywidevine.exceptions import TooManySessions, InvalidSession, SignatureMismatch -from pywidevine.license_protocol_pb2 import LicenseType, License +from pywidevine.license_protocol_pb2 import License routes = web.RouteTableDef() @@ -181,6 +181,7 @@ async def set_service_certificate(request: web.Request) -> web.Response: async def get_license_challenge(request: web.Request) -> web.Response: secret_key = request.headers["X-Secret-Key"] device_name = request.match_info["device"] + license_type = request.match_info["license_type"] body = await request.json() for required_field in ("session_id", "init_data"): @@ -216,7 +217,7 @@ async def get_license_challenge(request: web.Request) -> web.Response: license_request = cdm.get_license_challenge( session_id=session_id, pssh=init_data, - type_=LicenseType.Value(request.match_info["license_type"]), + type_=license_type, privacy_mode=True ) except InvalidSession: