From 4625aeb30e634db03ffb9f485a7fc275d0288454 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sat, 9 Mar 2013 11:20:42 +0200 Subject: Raise GsxError on authentication failure --- gsxws.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gsxws.py b/gsxws.py index a7dad00..53c2813 100755 --- a/gsxws.py +++ b/gsxws.py @@ -717,10 +717,12 @@ def connect( account.userTimeZone = timezone account.serviceAccountNo = sold_to - result = CLIENT.service.Authenticate(account) - SESSION['userSessionId'] = result.userSessionId - - return SESSION + try: + result = CLIENT.service.Authenticate(account) + SESSION['userSessionId'] = result.userSessionId + return SESSION + except suds.WebFault, e: + raise GsxError(code=e.fault.faultcode, message=e.fault.faultstring) def logout(): CLIENT.service.Logout() -- cgit v1.2.3