Nextplus Python SDK
Introduction
The Nextplus Python SDK is a powerful and user-friendly package that allows developers to interact with the Nextplus API. With this SDK, developers can easily perform CRUD operations on tables and records within the Nextplus system.
Features
- User authentication with Nextplus API
- Retrieve, create, update, and delete records in tables
- Customizable queries with filtering options
Requirements
- Python 3.x
- requests library
Installation
To install the Nextplus Python SDK, you can use the following command:
pip install nextplus
Usage
Setting Up the Client
First, you need to set up the NextplusClient with your Nextplus server URL, username or email, and password. These can either be passed directly or set as environment variables (NEXTPLUS_SERVER_URL, NEXTPLUS_EMAIL, NEXTPLUS_USERNAME, NEXTPLUS_PASSWORD).
from nextplus import NextplusClient
# Note that you can use email or username
client = NextplusClient(
server_url='https://your.nextplus.server.url',
email='your@email.com',
password='yourpassword'
)
# If you need to disable SSL verification (not recommended for production)
client = NextplusClient(
server_url='https://your.nextplus.server.url',
email='your@email.com',
password='yourpassword',
verify_ssl=False
)
Working with Tables
You can perform operations on tables such as finding a specific table or fetching a list of all tables.
Find Tables
tables = client.Tables.find({'where': {'name': 'YourTableName'}})
print(json.dumps(tables))
Response:
[
{
"id": "1958dbd0-b9bf-11ee-a4d7-950198b3451e",
"name": "Machine Status Log",
"columns": [
{
"id": "_id",
"name": "id",
"type": "string"
},
{
"id": "deletedAt",
"name": "deletedAt",
"type": "date"
},
{
"id": "createdAt",
"name": "createdAt",
"type": "date"
},
{
"id": "modified",
"name": "modified",
"type": "date"
},
{
"id": "workflowSessionItemId",
"name": "workflowSessionItemId",
"type": "string"
},
{
"id": "formId",
"name": "formId",
"type": "string"
},
{
"name": "Machine ID",
"type": "string",
"required": true,
"id": "COLUMN_machine-id"
},
{
"name": "Status",
"type": "string",
"id": "COLUMN_status"
},
{
"name": "Change Time",
"type": "date",
"id": "COLUMN_change-time",
"deletedAt": "2024-01-23T08:06:42.426Z"
}
],
"created": "2024-01-23T07:14:51.021Z",
"modified": "2024-01-23T08:06:44.500Z",
"serverModified": "2024-01-23T08:06:44.500Z",
"deletedAt": null,
"deletedBy": null
}
]
Note that you can only write to columns that prefixed with COLUMN_.
Other columns are auto-generated and read only.
Working with Records in a Table
You can create, update, find, and delete records in a specific table.
Insert a Record
table = client.Table('your_table_id')
record = {
"COLUMN_machine-id": "Machine1",
"COLUMN_status": "idle"
}
result = table.insert(record)
print(f"Record inserted with ID: {result['_id']}")
Response:
{
"COLUMN_machine-id": "Machine1",
"COLUMN_status": "idle",
"_id": "7b74899f-f863-473a-9a96-d37a75e1c7fe",
"createdAt": "2024-01-23T11:33:37.205Z",
"modified": "2024-01-23T11:33:37.205Z",
"serverModified": "2024-01-23T11:33:37.205Z",
"deletedAt": null
}
Update a Record
updated_record = {
"_id": "record_id",
"COLUMN_status": "busy"
}
update_result = table.update(updated_record)
print(update_result)
Response:
{
"_id": "7b74899f-f863-473a-9a96-d37a75e1c7fe",
"COLUMN_machine-id": "Machine1",
"COLUMN_status": "busy",
"createdAt": "2024-01-23T11:33:37.205Z",
"modified": "2024-01-23T11:34:52.185Z",
"serverModified": "2024-01-23T11:34:52.185Z",
"deletedAt": null
}
Find Records
rows = table.find({'where': {'COLUMN_machine-id': 'Machine1'}})
print(rows)
Response:
{
"_id": "7b74899f-f863-473a-9a96-d37a75e1c7fe",
"COLUMN_machine-id": "Machine1",
"COLUMN_status": "busy",
"createdAt": "2024-01-23T11:33:37.205Z",
"modified": "2024-01-23T11:34:52.185Z",
"serverModified": "2024-01-23T11:34:52.185Z",
"deletedAt": null,
"id": "7b74899f-f863-473a-9a96-d37a75e1c7fe"
}
Delete a Record
table.remove("record_id")
Response:
{
"_id": "7b74899f-f863-473a-9a96-d37a75e1c7fe",
"COLUMN_machine-id": "Machine1",
"COLUMN_status": "busy",
"createdAt": "2024-01-23T11:33:37.205Z",
"modified": "2024-01-23T11:36:23.226Z",
"serverModified": "2024-01-23T11:36:23.226Z",
"deletedAt": "2024-01-23T11:36:23.226Z"
}
Development
Building a new version
- Update version code in
nextplus/client.pyandsetup.py - Run build command
python setup.py sdist
Release new version
- Make sure twine is installed
pip install twine
- Then, upload your package
twine upload dist/*
When username & password prompt, enter__token__as username and token as password
Metadata
Release files for nextplus 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nextplus-0.1.3.tar.gz | 6.1 kB | Without provenance | Details for nextplus-0.1.3.tar.gz |
Release files / nextplus-0.1.3.tar.gz
| Download URL | nextplus-0.1.3.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9b63fad9b061eb5dee74a8bcb2f0242e59e4c18053cf3115ecb45c1d6a44e90
|
|
BLAKE2b-256 checksum How to use checksums |
8bb77fefac6d2815ec17ef30aaaaecae8797e374556477211e4a8af35eb66de1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for nextplus 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.