|
|
|
@ -99,7 +99,8 @@ class BaseExchange(object):
|
|
|
|
|
if hasattr(self.schema, to_camel):
|
|
|
|
|
schema = getattr(self.schema, to_camel)
|
|
|
|
|
else:
|
|
|
|
|
raise NoSchema
|
|
|
|
|
self.log.error(f"Method cannot be validated: {to_camel}")
|
|
|
|
|
raise NoSchema(f"Method cannot be validated: {to_camel}")
|
|
|
|
|
return schema
|
|
|
|
|
|
|
|
|
|
def call_method(self, method, *args, **kwargs):
|
|
|
|
@ -139,8 +140,7 @@ class BaseExchange(object):
|
|
|
|
|
# Return a dict of the validated response
|
|
|
|
|
response_valid = schema(**response).dict()
|
|
|
|
|
except NoSchema:
|
|
|
|
|
self.log.error(f"Method cannot be validated: {method}")
|
|
|
|
|
self.log.debug(f"Response: {response}")
|
|
|
|
|
self.log.debug(f"No schema: {response}")
|
|
|
|
|
if STRICT_VALIDATION:
|
|
|
|
|
raise
|
|
|
|
|
# Return the response as is
|
|
|
|
@ -156,9 +156,9 @@ class BaseExchange(object):
|
|
|
|
|
except NoSuchMethod:
|
|
|
|
|
self.log.error(f"Method not found: {method}")
|
|
|
|
|
raise
|
|
|
|
|
except Exception as e:
|
|
|
|
|
self.log.error(f"Error calling method: {e}")
|
|
|
|
|
raise GenericAPIError(e)
|
|
|
|
|
# except Exception as e:
|
|
|
|
|
# self.log.error(f"Error calling method: {e}")
|
|
|
|
|
# raise GenericAPIError(e)
|
|
|
|
|
|
|
|
|
|
def get_account(self):
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|