Skip to main content

Dojot flow node.

Project description

# dojot-flow-node-python

A Python library that allows you to integrate your own node on Dojot's [FlowBroker](https://github.com/dojot/flowbroker).

## How to build your own node

1) You need to create a class that extends the `DataHandlerBase` class, this
class is the responsable by implements your node behavior. The following methods
__must be__ implemented:
- get_node_representation_path
- get_metadata
- get_locale_data
- handle_message

2) Is necessary to create a `.html` file that describes your node. You can find how to create it using the [NodeRed documentation](https://nodered.org/docs/creating-nodes/). Dojot's FlowBroker uses the [NodeRed](https://nodered.org/) frontend.


3) You need to encapsulate your code into a docker container.

4) Publish your container in some public repository like [DockerHub](https://hub.docker.com/) or some private based on [DockerRegistry](https://docs.docker.com/registry).

5) Call the FlowBroker endpoint to add a new node. Please check the [FlowBroker documentation](https://dojot.github.io/flowbroker/apiary_latest.html) to check
how this endpoint works.

## Sample
A sample node is attached to this package to illustrate the steps described in
the previous section. It's a simple node that converts a Celcius temperature
measure into Kelvin.

### How to build

Build the docker image:
```sh
cd sample_node
docker build -t <your dockerHub username>/kelvin .
```

Publish it on your DockerHub:
```sh
docker push <your dockerHub username>/kelvin
```

Acquire a Dojot's token:
```sh
curl -X POST http://127.0.0.1:8000/auth \
-H 'Content-Type:application/json' \
-d '{"username": "admin", "passwd" : "admin"}'
```

This command will return a JWT token, you need to store it on an environment
variable:
```sh
export JWT=<the value returned>
```

Add the Kelvin node to Dojot.
```sh
curl -H "Authorization: Bearer ${JWT}" http://localhost:8000/flows/v1/node -H 'content-type: application/json' -d '{"image": "<your dockerHub username>/kelvin:latest", "id":"kelvin"}'
```

Now the Kelvin node will be available on `converters` category into the FlowBroker Dojot's interface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dojot-flow-node-0.0.10.tar.gz (3.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dojot_flow_node-0.0.10-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

dojot_flow_node-0.0.10-py2-none-any.whl (6.0 kB view details)

Uploaded Python 2

File details

Details for the file dojot-flow-node-0.0.10.tar.gz.

File metadata

  • Download URL: dojot-flow-node-0.0.10.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7

File hashes

Hashes for dojot-flow-node-0.0.10.tar.gz
Algorithm Hash digest
SHA256 ff00fc2b111ed5d66e90e9e85408dfc77b075551dfd6c6291c3e2059b1edf941
MD5 b3a0a3baf0e945228d637ce2d6852bba
BLAKE2b-256 29d3392fbcd89c358315459d6811e89433cec608e77635451dca0bae5e0033e9

See more details on using hashes here.

File details

Details for the file dojot_flow_node-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: dojot_flow_node-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7

File hashes

Hashes for dojot_flow_node-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f07bb82b5d606909d3ae7e48bae1224c2f3585490bb8ba5ed503fcd897af03d2
MD5 40d5de43dd057c7bd6eedc925b303e71
BLAKE2b-256 9ae9089556dbcfdaf08a4844181d3a4c293a482950e66826ee73ad9639dac6b6

See more details on using hashes here.

File details

Details for the file dojot_flow_node-0.0.10-py2-none-any.whl.

File metadata

  • Download URL: dojot_flow_node-0.0.10-py2-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7

File hashes

Hashes for dojot_flow_node-0.0.10-py2-none-any.whl
Algorithm Hash digest
SHA256 db0877cecc198d59400f5886edda6e9d38d32e2563a1e7d4da2f904a024217c0
MD5 9a999a9d6698a0445d3f993df18b13a9
BLAKE2b-256 6469ffcc3f9192166f7541d462ad54a5fbd9a46235cbd10592cf5df5c1d262f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page