aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-03-14 18:17:33 +0200
committerFilipp Lepalaan <f@230.to>2013-03-14 18:17:33 +0200
commitdc707538110ba368c05d2eb560bd1f20fdc3574b (patch)
tree13bd27aba2924e172efa025e5dc9fb2fb1b64a3b
parent8b9f1ab6b20474a8fb277e5aea2f6ea402e6786f (diff)
downloadpy-gsxws-dc707538110ba368c05d2eb560bd1f20fdc3574b.tar.gz
py-gsxws-dc707538110ba368c05d2eb560bd1f20fdc3574b.tar.bz2
py-gsxws-dc707538110ba368c05d2eb560bd1f20fdc3574b.zip
Through GsxError on Repair.mark_complete()
-rw-r--r--README.md2
-rwxr-xr-xgsxws.py17
2 files changed, 13 insertions, 6 deletions
diff --git a/README.md b/README.md
index e6ae8bc..3db385b 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Currently it supports most of them.
Installation:
- pip install -e git+git://github.com/filipp/py-gsxws.git#egg=gsxws
+ pip install -U -e git+git://github.com/filipp/py-gsxws.git#egg=gsxws
It goes a little something like this:
diff --git a/gsxws.py b/gsxws.py
index 1eb404d..0685c62 100755
--- a/gsxws.py
+++ b/gsxws.py
@@ -326,10 +326,14 @@ class GsxResponse(dict):
return nodedict
class GsxError(Exception):
- def __init__(self, message, code=None):
- self.code = code
- self.message = message
- self.data = (self.code, self.message)
+ def __init__(self, message=None, code=None, fault=None):
+ if isinstance(fault, suds.WebFault):
+ self.code = fault.fault.faultcode
+ self.message=fault.fault.faultstring
+ else:
+ self.code = code
+ self.message = message
+ self.data = (self.code, self.message)
def __getitem__(self, idx):
return self.data[idx]
@@ -602,7 +606,10 @@ class Repair(GsxObject):
dt.repairConfirmationNumbers = [self.data['dispatchId']]
result = CLIENT.service.MarkRepairComplete(dt)
- return result.repairConfirmationNumbers
+ try:
+ return result.repairConfirmationNumbers
+ except suds.WebFault, e:
+ raise GsxError(fault=e)
def delete(self):
"""