From b2b29cfed1d0b23d004b3ec122c7c9d1c51f4d49 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 2 Apr 2024 21:59:03 +0000 Subject: [PATCH] esim.es2p: Permit ApiParamInteger to be an actual integer Usually, the specifications say that the integer type is actually transmitted as a JSON string type. However, it seems some implementations do return a native JSON integer type. Let's be tolerant in that regard. Change-Id: I5b47f8bba01225d53eff2ca086e53a2133abed7f --- pySim/esim/es2p.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pySim/esim/es2p.py b/pySim/esim/es2p.py index 32d1ef89..af45b0bb 100644 --- a/pySim/esim/es2p.py +++ b/pySim/esim/es2p.py @@ -86,6 +86,8 @@ class ApiParamInteger(ApiParam): @classmethod def verify_encoded(cls, data): + if isinstance(data, int): + return if not data.isdecimal(): raise ValueError('integer (%s) contains non-decimal characters' % data) assert str(int(data)) == data