laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/36508?usp=email )
Change subject: esim.esp2: Allow HTTP methods other than POST ......................................................................
esim.esp2: Allow HTTP methods other than POST
While all official/standardized ES2+ API functions use POST, there are some vendor-specific extensions using different HTTP methods. Be flexible enough to allow derived classes to easily specify other methods.
Change-Id: I4b1a0dc7e6662485397c7708933bf16e5ed56e10 --- M pySim/esim/es2p.py 1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/08/36508/1
diff --git a/pySim/esim/es2p.py b/pySim/esim/es2p.py index af45b0b..fa21d2c 100644 --- a/pySim/esim/es2p.py +++ b/pySim/esim/es2p.py @@ -261,6 +261,8 @@ output_mandatory = [] # expected HTTP status code of the response expected_http_status = 200 + # the HTTP method used (GET, OPTIONS, HEAD, POST, PUT, PATCH or DELETE) + http_method = 'POST'
def __init__(self, url_prefix: str, func_req_id: str, session): self.url_prefix = url_prefix @@ -326,7 +328,7 @@ }
logger.debug("HTTP REQ %s - '%s'" % (url, encoded)) - response = self.session.post(url, data=encoded, headers=headers, timeout=timeout) + response = self.session.request(self.http_method, url, data=encoded, headers=headers, timeout=timeout) logger.debug("HTTP RSP-STS: [%u] hdr: %s" % (response.status_code, response.headers)) logger.debug("HTTP RSP: %s" % (response.content))