A Python client library for interacting with NetSuite's REST and SuiteQL APIs.
- OAuth 1.0 authentication with NetSuite
- Support for REST API calls
- SuiteQL query execution
- Custom scriptlet execution
pip install netsuite-clientfrom netsuite_client import NetSuiteClient
# Initialize the client
client = NetSuiteClient(
realm="YOUR_REALM",
account="YOUR_ACCOUNT",
consumer_key="YOUR_CONSUMER_KEY",
consumer_secret="YOUR_CONSUMER_SECRET",
token_id="YOUR_TOKEN_ID",
token_secret="YOUR_TOKEN_SECRET"
)
# Execute a SuiteQL query
results = client.get_suiteql_query("SELECT * FROM transaction WHERE tranDate = '2024-01-01'")
# Execute a custom scriptlet
results = client.get_scriptlet({"script": "123", "deploy": "1"})This library uses OAuth 1.0 for authentication. You'll need to set up an integration record in your NetSuite account to get the required credentials:
- Go to Setup > Integration > Manage Integrations > New
- Enable Token-Based Authentication
- Copy the Consumer Key and Consumer Secret
- Create an Access Token and copy the Token ID and Token Secret
The following parameters are required to initialize the client:
realm: Your NetSuite realm IDaccount: Your NetSuite account ID (the xxxxx part of xxxxx.app.netsuite.com)consumer_key: OAuth consumer key from your integration recordconsumer_secret: OAuth consumer secret from your integration recordtoken_id: OAuth token ID from your access tokentoken_secret: OAuth token secret from your access token
Optional parameters:
timeout: Request timeout in seconds (default: 60)logger: Custom logger instance (default: standard logging)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Created and maintained by Continuous AI, Inc.