Skip to content

Commit b015e51

Browse files
authored
feat: add support to request via session id directly (#133)
1 parent fa266f0 commit b015e51

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

sageintacctsdk/sageintacctsdk.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class SageIntacctSDK:
1515
"""
1616

1717
def __init__(self, sender_id: str, sender_password: str, user_id: str,
18-
company_id: str, user_password: str, entity_id: str=None, show_private: bool=False):
18+
company_id: str, user_password: str, entity_id: str=None, show_private: bool=False,
19+
session_id: str = None):
1920
"""
2021
Initialize connection to Sage Intacct
2122
:param sender_id: Sage Intacct sender id
@@ -34,6 +35,7 @@ def __init__(self, sender_id: str, sender_password: str, user_id: str,
3435
self.__user_password = user_password
3536
self.__entity_id = entity_id
3637
self.__show_private = show_private
38+
self.__session_id = session_id
3739

3840
self.api_base = ApiBase()
3941
self.contacts = Contacts()
@@ -180,8 +182,13 @@ def update_session_id(self):
180182
"""
181183
Update the session id and change it in all API objects.
182184
"""
183-
self.__session_id = self.api_base.get_session_id(
184-
self.__user_id, self.__company_id, self.__user_password, self.__entity_id)
185+
if not self.__session_id:
186+
self.__session_id = self.api_base.get_session_id(
187+
self.__user_id,
188+
self.__company_id,
189+
self.__user_password,
190+
self.__entity_id
191+
)
185192
self.api_base.set_session_id(self.__session_id)
186193
self.contacts.set_session_id(self.__session_id)
187194
self.contracts.set_session_id(self.__session_id)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name='sageintacctsdk',
11-
version='1.27.3',
11+
version='1.27.4',
1212
author='Ashwin T',
1313
author_email='ashwin.t@fyle.in',
1414
description='Python SDK for accessing Sage Intacct APIs',

0 commit comments

Comments
 (0)