Skip to content

Index

hypha.apply.projects.services.sageintacct

Sage Intacct init

name module-attribute

name = 'sageintacctsdk'

ExpiredTokenError

ExpiredTokenError(msg, response=None)

Bases: SageIntacctSDKError

Expired (old) access token, 498 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

InternalServerError

InternalServerError(msg, response=None)

Bases: SageIntacctSDKError

The rest SageIntacctSDK errors, 500 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

InvalidTokenError

InvalidTokenError(msg, response=None)

Bases: SageIntacctSDKError

Wrong/non-existing access token, 401 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

NoPrivilegeError

NoPrivilegeError(msg, response=None)

Bases: SageIntacctSDKError

The user has insufficient privilege, 403 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

NotFoundItemError

NotFoundItemError(msg, response=None)

Bases: SageIntacctSDKError

Not found the item from URL, 404 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

SageIntacctSDKError

SageIntacctSDKError(msg, response=None)

Bases: Exception

The base exception class for SageIntacctSDK.

Parameters:

  • msg (str) –

    Short description of the error.

  • response –

    Error response from the API call.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

message instance-attribute

message = msg

response instance-attribute

response = response

WrongParamsError

WrongParamsError(msg, response=None)

Bases: SageIntacctSDKError

Some of the parameters (HTTP params or request body) are wrong, 400 error.

Source code in hypha/apply/projects/services/sageintacct/exceptions.py
def __init__(self, msg, response=None):
    super(SageIntacctSDKError, self).__init__(msg)
    self.message = msg
    self.response = response

SageIntacctSDK

SageIntacctSDK(sender_id, sender_password, user_id, company_id, user_password, entity_id=None)

Sage Intacct SDK

Initialize connection to Sage Intacct :param sender_id: Sage Intacct sender id :param sender_password: Sage Intacct sener password :param user_id: Sage Intacct user id :param company_id: Sage Intacct company id :param user_password: Sage Intacct user password :param (optional) entity_id: Sage Intacct entity ID

Source code in hypha/apply/projects/services/sageintacct/sageintacctsdk.py
def __init__(
    self,
    sender_id: str,
    sender_password: str,
    user_id: str,
    company_id: str,
    user_password: str,
    entity_id: str = None,
):
    """
    Initialize connection to Sage Intacct
    :param sender_id: Sage Intacct sender id
    :param sender_password: Sage Intacct sener password
    :param user_id: Sage Intacct user id
    :param company_id: Sage Intacct company id
    :param user_password: Sage Intacct user password
    :param (optional) entity_id: Sage Intacct entity ID
    """
    # Initializing variables
    self.__sender_id = sender_id
    self.__sender_password = sender_password
    self.__user_id = user_id
    self.__company_id = company_id
    self.__user_password = user_password
    self.__entity_id = entity_id

    self.api_base = ApiBase()
    self.purchasing = Purchasing()
    self.project = Project()
    self.invoice = Invoice()
    self.update_sender_id()
    self.update_sender_password()
    self.update_session_id()

api_base instance-attribute

api_base = ApiBase()

purchasing instance-attribute

purchasing = Purchasing()

project instance-attribute

project = Project()

invoice instance-attribute

invoice = Invoice()

update_sender_id

update_sender_id()

Update the sender id in all API objects.

Source code in hypha/apply/projects/services/sageintacct/sageintacctsdk.py
def update_sender_id(self):
    """
    Update the sender id in all API objects.
    """
    self.api_base.set_sender_id(self.__sender_id)
    self.purchasing.set_sender_id(self.__sender_id)
    self.project.set_sender_id(self.__sender_id)
    self.invoice.set_sender_id(self.__sender_id)

update_sender_password

update_sender_password()

Update the sender password in all API objects.

Source code in hypha/apply/projects/services/sageintacct/sageintacctsdk.py
def update_sender_password(self):
    """
    Update the sender password in all API objects.
    """
    self.api_base.set_sender_password(self.__sender_password)
    self.purchasing.set_sender_password(self.__sender_password)
    self.project.set_sender_password(self.__sender_password)
    self.invoice.set_sender_password(self.__sender_password)

update_session_id

update_session_id()

Update the session id and change it in all API objects.

Source code in hypha/apply/projects/services/sageintacct/sageintacctsdk.py
def update_session_id(self):
    """
    Update the session id and change it in all API objects.
    """
    self.__session_id = self.api_base.get_session_id(
        self.__user_id, self.__company_id, self.__user_password, self.__entity_id
    )
    self.api_base.set_session_id(self.__session_id)
    self.purchasing.set_session_id(self.__session_id)
    self.project.set_session_id(self.__session_id)
    self.invoice.set_session_id(self.__session_id)