Skip to content

Commit f49b22c

Browse files
committed
catch non-Success responses and raise RuntimeError
ping #39
1 parent 9d70a33 commit f49b22c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vipaccess/provision.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ def get_token_from_response(response_xml):
119119

120120
tree = etree.fromstring(response_xml)
121121
result = tree.find('v:Status/v:StatusMessage', ns).text
122+
reasoncode = tree.find('v:Status/v:ReasonCode', ns).text
122123

123-
if result == 'Success':
124+
if result != 'Success':
125+
raise RuntimeError(result, reasoncode)
126+
else:
124127
token = {}
125128
token['timeskew'] = time.time() - int(tree.find('v:UTCTimestamp', ns).text)
126129
container = tree.find('v:SecretContainer', ns)

0 commit comments

Comments
 (0)