SDK de conexão com o NEO Framework
Project description
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neo_sdk-0.1.0.tar.gz.
File metadata
- Download URL: neo_sdk-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a5f501a89e1213d642a4070c4d0ac10e2ef436f2d4ef946b20158fb9312fcac
|
|
| MD5 |
cc5cb68afa9c8e4bd5246bb872793246
|
|
| BLAKE2b-256 |
4f42d2f82780903809189771ddd39550b4c06065473a8264522a8d0f43f6bf17
|
File details
Details for the file neo_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: neo_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd9cbf67e4d1829724ffa03d57d7d23be72f805cabc03b6de9890b26dc1c988b
|
|
| MD5 |
6eb5a378cb7df864c48ab621862ba895
|
|
| BLAKE2b-256 |
971a2353b170b8d42b123996fa11cd25270b2b9425e8c35742010677dba50df4
|