aboutsummaryrefslogtreecommitdiffstats
path: root/python_moonutilities/python_moonutilities/request_wrapper.py
diff options
context:
space:
mode:
authorsgdt6900 <rhanafy.ext@orange.com>2017-12-25 16:13:21 +0200
committersgdt6900 <rhanafy.ext@orange.com>2018-01-03 14:40:39 +0200
commit6350d625b4e4627fc6886c3d7f052c67abf0989f (patch)
treea9b3ed096a1c6b05590c5b2eedfa3a0ae4dd339e /python_moonutilities/python_moonutilities/request_wrapper.py
parent52d037e757ac2189978e1129f469929fe73a9b7f (diff)
adding comments for the cases should be handled for configuration module
refactoring url of component port to match same pattern integrating request wrapper adding validation for the key in the object before accessing it update some conditions uncomment required test cases after validation done Change-Id: I5f0e22ca4fd803992c051ec238f91ed0703cd1a2 Signed-off-by: sgdt6900 <rhanafy.ext@orange.com>
Diffstat (limited to 'python_moonutilities/python_moonutilities/request_wrapper.py')
-rw-r--r--python_moonutilities/python_moonutilities/request_wrapper.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/python_moonutilities/python_moonutilities/request_wrapper.py b/python_moonutilities/python_moonutilities/request_wrapper.py
index 8cf5b997..f1603b9d 100644
--- a/python_moonutilities/python_moonutilities/request_wrapper.py
+++ b/python_moonutilities/python_moonutilities/request_wrapper.py
@@ -9,4 +9,14 @@ def get(url):
raise exceptions.ConsulError("request failure ",e)
except:
raise exceptions.ConsulError("Unexpected error ", sys.exc_info()[0])
+ return response
+
+
+def put(url, json=""):
+ try:
+ response = requests.put(url,json=json)
+ except requests.exceptions.RequestException as e:
+ raise exceptions.ConsulError("request failure ",e)
+ except:
+ raise exceptions.ConsulError("Unexpected error ", sys.exc_info()[0])
return response \ No newline at end of file