laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/36507?usp=email )
Change subject: esim.es2p: Permit ApiParamInteger to be an actual integer ......................................................................
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 --- M pySim/esim/es2p.py 1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/07/36507/1
diff --git a/pySim/esim/es2p.py b/pySim/esim/es2p.py index 32d1ef8..af45b0b 100644 --- a/pySim/esim/es2p.py +++ b/pySim/esim/es2p.py @@ -86,6 +86,8 @@
@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