Neo SDK for Python with some additional libraries to support the development of Neo Sentinels (NSX).
Project description
Neo Python SDK
Installation
pip install neo_python_sdk
Usage
To use it you have to import it in Python with following import:
import neo_python_sdk as Neo
Example
# processing tasks requires a queue name
# the request object will be passed to the provided processor (a function)
# the "processor" should use async / await
async def start_neo_tasks(loop):
neo = Neo.NeoNatsClient()
await neo.connect(loop=loop)
async def process_request(payload):
res = f'Hi there, {payload['user']}'
return res
await neo.process("nsx.dev.example.sayHello", process_request)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(start_neo_tasks(loop))
loop.run_forever()
# the task / message can contain anything
# for best compatibility it should be a particle
neo = Neo.NeoNatsClient()
await neo.connect(loop=loop)
neo.create('nsx.dev.example.sayHello', {
user: 'John',
})
Development
Some Notes about the development process of the sdk.
Lint code
To lint the code we recommend to use black (https://github.com/psf/black).
If installed you can simply run the following command from the project directory to lint your code before pushing it:
python3 -m black .
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
neo_python_sdk-0.3.12.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file neo_python_sdk-0.3.12.tar.gz
.
File metadata
- Download URL: neo_python_sdk-0.3.12.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25c236814483e8f9218e4de1ff1de49a8a5af2dc2e909c0d7ea229b2da3a2769 |
|
MD5 | 8de778a754f371f4dfad4b40a3523aca |
|
BLAKE2b-256 | 6547da66ed9ffcfe85ea3f2617ab3a697d15fc7ffe08ff42b62df4b9989056b5 |
File details
Details for the file neo_python_sdk-0.3.12-py3-none-any.whl
.
File metadata
- Download URL: neo_python_sdk-0.3.12-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ac5c89712fbdcd1b0eeeb6a55eef351a8e67f740a30d30cd102ec11b0fa706 |
|
MD5 | 43baad740cc8343b27683e712199aced |
|
BLAKE2b-256 | 9d620a876b54b76552d9ba2188eb3eea7a9272def6b46696b8803a60bee66d56 |