Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
b4cc184c
Unverified
Commit
b4cc184c
authored
Oct 11, 2018
by
fishyds
Committed by
GitHub
Oct 11, 2018
Browse files
Add exception message in trial_keeper's rest util (#196)
* Print exception message for trial keeper rest utils
parent
93dae28f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
tools/trial_tool/rest_utils.py
tools/trial_tool/rest_utils.py
+8
-4
No files found.
tools/trial_tool/rest_utils.py
View file @
b4cc184c
...
...
@@ -27,7 +27,8 @@ def rest_get(url, timeout):
try
:
response
=
requests
.
get
(
url
,
timeout
=
timeout
)
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
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'
},
\
data
=
data
,
timeout
=
timeout
)
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
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'
},
\
data
=
data
,
timeout
=
timeout
)
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
def
rest_delete
(
url
,
timeout
):
...
...
@@ -53,5 +56,6 @@ def rest_delete(url, timeout):
try
:
response
=
requests
.
delete
(
url
,
timeout
=
timeout
)
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment