From 2445297ae876a9bb342f4bce0cff22f263ca6244 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 6 Aug 2022 08:49:56 +0100 Subject: [PATCH] serve: Match endpoints with Cdm class methods --- pywidevine/remotecdm.py | 4 ++-- pywidevine/serve.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pywidevine/remotecdm.py b/pywidevine/remotecdm.py index 6ba08c5..ef2ed1e 100644 --- a/pywidevine/remotecdm.py +++ b/pywidevine/remotecdm.py @@ -178,7 +178,7 @@ class RemoteCdm(Cdm): raise InvalidLicenseType(f"License Type {type_!r} is invalid") r = self.__session.post( - url=f"{self.host}/{self.device_name}/challenge/{type_}", + url=f"{self.host}/{self.device_name}/get_license_challenge/{type_}", json={ "session_id": session_id.hex(), "init_data": pssh.dumps() @@ -231,7 +231,7 @@ class RemoteCdm(Cdm): licence.ParseFromString(license_message.msg) r = self.__session.post( - url=f"{self.host}/{self.device_name}/keys/ALL", + url=f"{self.host}/{self.device_name}/parse_license/ALL", json={ "session_id": session_id.hex(), "license_message": base64.b64encode(license_message.SerializeToString()).decode() diff --git a/pywidevine/serve.py b/pywidevine/serve.py index 148011b..a59d936 100644 --- a/pywidevine/serve.py +++ b/pywidevine/serve.py @@ -170,8 +170,8 @@ async def set_service_certificate(request: web.Request) -> web.Response: }) -@routes.post("/{device}/challenge/{license_type}") -async def challenge(request: web.Request) -> web.Response: +@routes.post("/{device}/get_license_challenge/{license_type}") +async def get_license_challenge(request: web.Request) -> web.Response: secret_key = request.headers["X-Secret-Key"] device_name = request.match_info["device"] @@ -232,8 +232,8 @@ async def challenge(request: web.Request) -> web.Response: }, status=200) -@routes.post("/{device}/keys/{key_type}") -async def keys(request: web.Request) -> web.Response: +@routes.post("/{device}/parse_license/{key_type}") +async def parse_license(request: web.Request) -> web.Response: secret_key = request.headers["X-Secret-Key"] device_name = request.match_info["device"]