Unverified Commit b4cc184c authored by fishyds's avatar fishyds Committed by GitHub
Browse files

Add exception message in trial_keeper's rest util (#196)

* Print exception message for trial keeper rest utils
parent 93dae28f
...@@ -27,7 +27,8 @@ def rest_get(url, timeout): ...@@ -27,7 +27,8 @@ def rest_get(url, timeout):
try: try:
response = requests.get(url, timeout=timeout) response = requests.get(url, timeout=timeout)
return response return response
except Exception: except Exception as e:
print('Get exception {0} when sending http get to url {1}'.format(str(e), url))
return None return None
def rest_post(url, data, timeout): def rest_post(url, data, timeout):
...@@ -36,7 +37,8 @@ def rest_post(url, data, timeout): ...@@ -36,7 +37,8 @@ def rest_post(url, data, timeout):
response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\ response = requests.post(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout) data=data, timeout=timeout)
return response return response
except Exception: except Exception as e:
print('Get exception {0} when sending http post to url {1}'.format(str(e), url))
return None return None
def rest_put(url, data, timeout): def rest_put(url, data, timeout):
...@@ -45,7 +47,8 @@ def rest_put(url, data, timeout): ...@@ -45,7 +47,8 @@ def rest_put(url, data, timeout):
response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\ response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
data=data, timeout=timeout) data=data, timeout=timeout)
return response return response
except Exception: except Exception as e:
print('Get exception {0} when sending http put to url {1}'.format(str(e), url))
return None return None
def rest_delete(url, timeout): def rest_delete(url, timeout):
...@@ -53,5 +56,6 @@ def rest_delete(url, timeout): ...@@ -53,5 +56,6 @@ def rest_delete(url, timeout):
try: try:
response = requests.delete(url, timeout=timeout) response = requests.delete(url, timeout=timeout)
return response return response
except Exception: except Exception as e:
print('Get exception {0} when sending http delete to url {1}'.format(str(e), url))
return None return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment