Registry / crm-productivity / netsuite

netsuite

JSON →
library0.12.0pypypi✓ verified 84d ago

The `netsuite` Python library provides an asynchronous client for interacting with NetSuite's SuiteTalk SOAP/REST Web Services and Restlets. It simplifies making requests, handling authentication (including Token-Based Authentication), and parsing responses. Currently at version 0.12.0, the library has a moderately active release cadence, with several minor releases and occasional breaking changes.

pip install netsuite
INSTALL
IMPORT
SIG · NETSUITE
N
netsuite
crm-productivitypythonv0.12.0
Install
5.1s avg
Import
1324ms
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.371s · 53.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.1s · import 1.277s · 53MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NetSuite
from netsuite import NetSuite

This quickstart initializes the `NetSuite` client, which automatically picks up credentials from environment variables, and then demonstrates fetching a customer record using the REST API and executing a simple SuiteQL query. Replace placeholder IDs with your actual NetSuite data. Remember to set your NetSuite credentials as environment variables.

import asyncio import os from netsuite import NetSuite async def main(): # Ensure these environment variables are set: # NETSUITE_ACCOUNT, NETSUITE_CONSUMER_KEY, NETSUITE_CONSUMER_SECRET, # NETSUITE_TOKEN_ID, NETSUITE_TOKEN_SECRET # The NetSuite client automatically picks up credentials from environment variables. # For explicit config, see documentation. ns = NetSuite() print(f"NetSuite client initialized for account: {os.environ.get('NETSUITE_ACCOUNT', '[Not Set]')}") try: # Example: Fetch a specific record using the REST API # Replace 'customer' and '1234' with actual record type and ID in your NetSuite instance customer_id = '1234' customer_record = await ns.rest_api.get( f"record/v1/customer/{customer_id}" ) print(f"Successfully fetched customer {customer_id}:\n{customer_record}") # Example: Run a SuiteQL query # This query selects the ID and company name of the first 5 customers suiteql_result = await ns.suiteql.get( "SELECT id, companyname FROM customer ORDER BY id LIMIT 5" ) print(f"\nSuccessfully executed SuiteQL query (first 5 customers):\n{suiteql_result}") except Exception as e: print(f"An error occurred: {e}") if __name__ == "__main__": # Set dummy environment variables for demonstration if not set os.environ.setdefault('NETSUITE_ACCOUNT', 'TEST_ACCOUNT_ID') os.environ.setdefault('NETSUITE_CONSUMER_KEY', 'TEST_CONSUMER_KEY') os.environ.setdefault('NETSUITE_CONSUMER_SECRET', 'TEST_CONSUMER_SECRET') os.environ.setdefault('NETSUITE_TOKEN_ID', 'TEST_TOKEN_ID') os.environ.setdefault('NETSUITE_TOKEN_SECRET', 'TEST_TOKEN_SECRET') asyncio.run(main())
Debug
Known issues
breakingVersion 0.10.0 introduced 'large breaking changes' due to significant updates of underlying libraries (e.g., aiohttp, zeep, lxml). This may affect existing code relying on specific dependency versions or low-level interactions.
fix
Review `CHANGELOG.md` for 0.10.0 and ensure your code is updated to align with the new library versions and any API changes. Test thoroughly after upgrading.
affects: 0.10.0 and newer
breakingVersion 0.7.0 was a 'beta' release that introduced 'a lot of things' that break previous functionality. The documentation explicitly advised reviewing the `CHANGELOG.md` carefully for migration.
fix
If upgrading from pre-0.7.0 versions, consult the `CHANGELOG.md` for version 0.7.0 to understand the necessary code adjustments.
affects: 0.7.0 - 0.9.x
gotchaThe `netsuite` library is built entirely on `asyncio`. All API calls and client methods that interact with NetSuite must be `await`ed within an `async` function or an `asyncio` event loop.
fix
Ensure all calls like `ns.rest_api.get()` or `ns.suiteql.get()` are prefixed with `await`. Run your main application logic using `asyncio.run(main_async_function())`.
affects: All versions
gotchaAuthentication primarily relies on Token-Based Authentication (TBA) credentials provided via environment variables (NETSUITE_ACCOUNT, NETSUITE_CONSUMER_KEY, NETSUITE_CONSUMER_SECRET, NETSUITE_TOKEN_ID, NETSUITE_TOKEN_SECRET). Missing or incorrect variables will lead to authentication failures.
fix
Verify all five required environment variables are correctly set and accessible by your application. Double-check for typos or incorrect values.
affects: All versions
Errors
Common errors & fixes
TypeError: object asyncio.coroutines.CoroWrapper can't be used in 'await' expression
Attempting to call an asynchronous method (e.g., `ns.rest_api.get()`) without `await` in an `async` context or outside an `asyncio` loop.
fix
Prepend `await` to the async call (e.g., `await ns.rest_api.get(...)`) and ensure your code is running within an `async` function or `asyncio.run()`.
netsuite.exceptions.NetSuiteAPIError: Authentication Failure
Incorrect or missing NetSuite Token-Based Authentication (TBA) credentials (account ID, consumer key/secret, token ID/secret).
fix
Check that `NETSUITE_ACCOUNT`, `NETSUITE_CONSUMER_KEY`, `NETSUITE_CONSUMER_SECRET`, `NETSUITE_TOKEN_ID`, and `NETSUITE_TOKEN_SECRET` environment variables are correctly set and correspond to a valid NetSuite TBA setup.
AttributeError: 'NetSuite' object has no attribute 'some_old_method'
Attempting to use a method or attribute that has been removed or renamed in a newer version of the `netsuite` library, especially after a major upgrade like 0.10.0.
fix
Refer to the latest documentation and `CHANGELOG.md` for your installed version. Update your code to use the current API methods and object structures.
Upgrade
Version history
0.12.0latest on PyPI · released Mar 4, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
netsuite — pip install netsuite · libregistry