To retrieve data from NetSuite:
import devart.netsuite as netsuite
connect() module method and obtain a connection object:
my_connection = netsuite.connect(
Ver=1,
Authentication="Basic",
UserID="your_username",
Password="your_password",
AccountId="your_account_id",
RoleId="your_role_id",
ApplicationId="your_application_id"
)
my_connection = netsuite.connect(
Version="Ver2",
Authentication="TokenBased",
AccountId="your_account_id",
AccountTimeZone="your_account_timezone",
ConsumerKey="your_consumer_key",
ConsumerSecret="your_consumer_secret",
TokenId="your_token_id",
TokenSecret="your_token_secret"
)
response = netsuite.signin(
AccountId="your_account_id",
ClientId="your_client_id",
ClientSecret="your_client_secret")
my_connection = netsuite.connect(
Authentication="OAuth",
AccountID="your_account_id",
AccountTimeZone="your_account_timezone",
ClientID="your_client_id",
ClientSecret="your_client_secret",
RefreshToken=response["Refresh Token"]
)
cursor object using the cursor() connection method.
my_cursor = my_connection.cursor()
execute() cursor method.
my_cursor.execute("SELECT * FROM employees")
fetch*() cursor methods.
for row in my_cursor.fetchall():
print(row)