NEO SDK for Python
The NEO SDK for Python is a powerful tool that allows developers to seamlessly interact with the NEO platform. With this SDK, you can easily perform various operations, including:
- Authentication: Securely authenticate with the NEO platform using API keys or username/password combinations.
- Data Management: Effortlessly retrieve, create, update, and delete data within your NEO instance.
- Method Execution: Execute custom methods defined in your NEO applications.
- Password Strength Verification: Ensure the robustness of user passwords with built-in password strength checks.
Installation
You can install the NEO SDK for Python using pip:
pip install neo-sdk
or
pip install -e git+https://github.com/mobilex-neo/neo-sdk.git#egg=neo-sdk
Getting Started
To start using the NEO SDK, you'll need to import the necessary classes and initialize the NEO client:
import os
from dotenv import load_dotenv
from neo.client.neo_client import NEO
from neo.models import ApiKeyCredential, PwdCredential
# Load environment variables from .env file
load_dotenv()
# Replace with your actual NEO instance URI
uri = os.getenv('NEO_URI')
# Authentication using API key
api_key = os.getenv('NEO_KEY')
api_secret = os.getenv('NEO_SECRET')
api_credential = ApiKeyCredential(api_key, api_secret)
neo_api = NEO(uri, api_credential)
# Authentication using username and password
username = os.getenv('NEO_TEST_USER')
password = os.getenv('NEO_TEST_PASSWORD')
pwd_credential = PwdCredential(username, password)
neo_api = NEO(uri, pwd_credential)
Usage
Getting a Single Document
doctype = 'ToDo'
docname = 'test_todo'
data = neo_api.get_one(doctype, docname)
print(data)
Getting All Documents of a Doctype
doctype = 'ToDo'
data = neo_api.get_all(doctype)
print(data)
Creating a New Document
doctype = 'ToDo'
data = {'key': 'value'}
new_doc = neo_api.create(doctype, data)
print(new_doc)
Updating an Existing Document
doctype = 'ToDo'
docname = 'test_todo'
data = {'key': 'new_value'}
updated_doc = neo_api.update(doctype, docname, data)
print(updated_doc)
Deleting a Document
doctype = 'ToDo'
docname = 'test_todo'
deleted_doc = neo_api.delete(doctype, docname)
print(deleted_doc)
Calling a Custom Method
method_name = 'test_method'
http_method = 'GET' # or 'POST'
data = {'key': 'value'} # Optional data for POST requests
response = neo_api.call_method(method_name, http_method, data)
print(response)
Verifying Password Strength
password = 'Teste@123'
is_strong = neo_api.verify_password_strength(password)
print(is_strong)
Contributing
Contributions to the NEO SDK for Python are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Release files for neo-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neo_sdk-0.1.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neo_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:8.5 kB
Release files / neo_sdk-0.1.0.tar.gz
| Download URL | neo_sdk-0.1.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a5f501a89e1213d642a4070c4d0ac10e2ef436f2d4ef946b20158fb9312fcac
|
|
BLAKE2b-256 checksum How to use checksums |
4f42d2f82780903809189771ddd39550b4c06065473a8264522a8d0f43f6bf17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.6
|
Release files / neo_sdk-0.1.0-py3-none-any.whl
| Download URL | neo_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd9cbf67e4d1829724ffa03d57d7d23be72f805cabc03b6de9890b26dc1c988b
|
|
BLAKE2b-256 checksum How to use checksums |
971a2353b170b8d42b123996fa11cd25270b2b9425e8c35742010677dba50df4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.6
|