aboutsummaryrefslogtreecommitdiffstats
path: root/pySim
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2024-04-02 22:00:27 +0000
committerHarald Welte <laforge@osmocom.org>2024-04-03 00:49:33 +0200
commit1d1ba8e4cc0cb8c1f862dad04b26e5d4786b924d (patch)
treea627b29df1861ebb3f4324a385cbe6126979ca5d /pySim
parentb2b29cfed1d0b23d004b3ec122c7c9d1c51f4d49 (diff)
esim.esp2: Allow HTTP methods other than POSTHEADmaster
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
Diffstat (limited to 'pySim')
-rw-r--r--pySim/esim/es2p.py4
1 files changed, 3 insertions, 1 deletions
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 @@ class Es2PlusApiFunction(abc.ABC):
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 @@ class Es2PlusApiFunction(abc.ABC):
}
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))