Python client library for Cradlepoint NCM API
Project description
Cradlepoint NCM SDK
This is a Python client library for Cradlepoint NCM API (both v2 and v3)
INSTALL AND RUN INSTRUCTIONS
-
Install the ncm pip package, or copy the ncm.py file into your working directory:
pip3 install ncm
-
Set NCM API v2 Keys. API Keys must be passed as a dictionary:
api_keys = { 'X-CP-API-ID': 'aaaa', 'X-CP-API-KEY': 'bbbb', 'X-ECM-API-ID': 'cccc', 'X-ECM-API-KEY': 'dddd' }
For API v3 Key it can be included in the same dictionary as token (optional):
api_keys = { 'X-CP-API-ID': 'aaaa', 'X-CP-API-KEY': 'bbbb', 'X-ECM-API-ID': 'cccc', 'X-ECM-API-KEY': 'dddd', "token": 'eeee' }
Note: if only using v3, just include the token in the dictionary.
-
Import the module and create an instance of the NcmClient object:
If using pip:
from ncm import ncm n = ncm.NcmClient(api_keys=api_keys)
If not using pip:
import ncm n = ncm.NcmClient(api_keys=api_keys)
-
Call functions from the module as needed. For example:
print(n.get_accounts())
USAGE AND TIPS:
This python class includes a few optimizations to make it easier to work with the API. The default record limit is set at 500 instead of the Cradlepoint default of 20, which reduces the number of API calls required to return large sets of data.
This can be modified by specifying a "limit parameter":
n.get_accounts(limit=10)
You can also return the full list of records in a single array without the need for paging by passing limit='all':
n.get_accounts(limit='all')
It also has native support for handling any number of "__in" filters beyond Cradlepoint's limit of 100. The script automatically chunks the list into groups of 100 and combines the results into a single array.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ncm-0.0.38.tar.gz
.
File metadata
- Download URL: ncm-0.0.38.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36cfbf9171a043163132e1be1908be03a731aa8a59c2413f2dcc14b2702e9691 |
|
MD5 | b50b5a776cc826e3128aa9da211bb531 |
|
BLAKE2b-256 | a84900b98aafb9340f35b251f62dcc5b0719236d757a1b2c0572f06d190a42fe |
File details
Details for the file ncm-0.0.38-py3-none-any.whl
.
File metadata
- Download URL: ncm-0.0.38-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59075de75130ffc967b315e02fa7fdaad6963ae446f7b93c21968c45ad9832bb |
|
MD5 | 990005ee04a976f57acbdfef0aea39f7 |
|
BLAKE2b-256 | 53b2d0da497764ba83a04f2d8b7e2923080d1b9cb58ab138814c3d67b4b8abff |