@@ -200,7 +200,7 @@ def call_api(self, request_data, service, action, idempotency=False,
200200 from . import username , password , merchant_account , platform
201201 #
202202 if self .http_init == False :
203- self .http_client = HTTPClient (self .app_name ,self .LIB_VERSION ,self .USER_AGENT_SUFFIX , self .http_force )
203+ self .http_client = HTTPClient (self .app_name ,self .USER_AGENT_SUFFIX ,self .LIB_VERSION , self .http_force )
204204 self .http_init = True
205205
206206 #username at self object has highest priority. fallback to root module
@@ -302,7 +302,7 @@ def call_hpp(self, message, action, hmac_key="", **kwargs):
302302 from . import hmac , platform
303303 #
304304 if self .http_init == False :
305- self .http_client = HTTPClient (self .app_name ,self .LIB_VERSION ,self .USER_AGENT_SUFFIX , self .http_force )
305+ self .http_client = HTTPClient (self .app_name ,self .USER_AGENT_SUFFIX ,self .LIB_VERSION , self .http_force )
306306 self .http_init = True
307307
308308 #hmac provided in function has highest priority. fallback to self then
@@ -355,7 +355,7 @@ def hpp_payment(self,request_data, action, hmac_key="", **kwargs):
355355 from . import hmac , platform
356356 #
357357 if self .http_init == False :
358- self .http_client = HTTPClient (self .app_name ,self .LIB_VERSION ,self .USER_AGENT_SUFFIX , self .http_force )
358+ self .http_client = HTTPClient (self .app_name ,self .USER_AGENT_SUFFIX ,self .LIB_VERSION , self .http_force )
359359 self .http_init = True
360360
361361 if self .platform :
@@ -409,24 +409,18 @@ def _handle_response(self, url, raw_response, raw_request, status_code, headers,
409409 response = {}
410410 # If the result can't be parsed into json, most likely is raw html.
411411 # Some response are neither json or raw html, handle them here:
412- try :
413- response = json_lib .loads (raw_result )
414-
415- self ._handle_http_error (url , response , status_code ,
416- headers .get ('pspReference' ), raw_request , raw_response , headers )
417- except :
418412
419- response = json_lib .loads (raw_response )
413+ response = json_lib .loads (raw_response )
420414
421- # Pass raised error to error handler.
422- self ._handle_http_error (url ,response ,status_code ,headers .get ('pspReference' ),raw_request ,raw_response ,headers ,request_dict )
415+ # Pass raised error to error handler.
416+ self ._handle_http_error (url ,response ,status_code ,headers .get ('pspReference' ),raw_request ,raw_response ,headers ,request_dict )
423417
424- try :
425- if response ['errorCode' ]:
426- return raw_response
427- except KeyError :
428- errstr = 'KeyError: errorCode'
429- pass
418+ try :
419+ if response ['errorCode' ]:
420+ return raw_response
421+ except KeyError :
422+ errstr = 'KeyError: errorCode'
423+ pass
430424 else :
431425 try :
432426 response = json_lib .loads (raw_response )
0 commit comments