Closed ddow closed 1 year ago
@ddow please try to handle the exception and check the API response, you might be able to know why the connection is failing. Added a sample snippet below.
from sageintacctsdk.exceptions import WrongParamsError
try:
...
except WrongParamsError as e:
print('WrongParamsError', e.__dict__, e.response)
Worse case, you can log the parsed_response
from api_base.py
file to check the error.
Thanks, this helped!
Hello,
When trying to get a session using this sdk, I get the following:
` from configparser import ConfigParser
from sageintacctsdk import SageIntacctSDK
INTACCT = CONFIG["intacct"]
SENDER_ID = INTACCT["SENDER_ID"] SENDER_PW = INTACCT["SENDER_PW"] COMPANY_ID = INTACCT["COMPANY_ID"] USER_ID = INTACCT["USER_ID"] USER_PW = INTACCT["USER_PW"]
connection = SageIntacctSDK( sender_id=SENDER_ID, sender_password=SENDER_PW, user_id=USER_ID, company_id=COMPANY_ID, user_password=USER_PW ) print()`
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/ddow/dev/simple_pix/intacct_client.py", line 29, in
connection = SageIntacctSDK(
File "/Users/ddow/venv_simple_pix/lib/python3.9/site-packages/sageintacctsdk/sageintacctsdk.py", line 71, in init
self.update_session_id()
File "/Users/ddow/venv_simple_pix/lib/python3.9/site-packages/sageintacctsdk/sageintacctsdk.py", line 155, in update_session_id
self.__session_id = self.api_base.get_session_id(
File "/Users/ddow/venv_simple_pix/lib/python3.9/site-packages/sageintacctsdk/apis/api_base.py", line 85, in get_session_id
response = self.post_request(dict_body, self.api_url)
File "/Users/ddow/venv_simple_pix/lib/python3.9/site-packages/sageintacctsdk/apis/api_base.py", line 237, in __post_request
raise WrongParamsError('Some of the parameters are wrong', parsed_response)
sageintacctsdk.exceptions.WrongParamsError: 'Some of the parameters are wrong'
However, when using a different SDK I get a valid session:
`from pyintacct import IntacctAPI
INTACCT = CONFIG["intacct"]
SENDER_ID = INTACCT["SENDER_ID"] SENDER_PW = INTACCT["SENDER_PW"] COMPANY_ID = INTACCT["COMPANY_ID"] USER_ID = INTACCT["USER_ID"] USER_PW = INTACCT["USER_PW"]
KEYS = {'SENDER_ID': INTACCT["SENDER_ID"], 'SENDER_PW': INTACCT["SENDER_PW"], 'COMPANY_ID': INTACCT["COMPANY_ID"], 'USER_ID': INTACCT["USER_ID"], 'USER_PW': INTACCT["USER_PW"] }
INT = IntacctAPI(KEYS) print()
`
Is there something I'm maybe missing?
Thanks!