Skip to main content

IronFlock Python SDK for connecting to the IronFlock Platform

Project description

ironflock

About

With this library you can publish data from your apps on your IoT edge hardware to the fleet data storage of the IronFlock devops platform. When this library is used on a certain device the library automatically uses the private messaging realm (Unified Name Space) of the device's fleet and the data is collected in the respective fleet database.

So if you use the library in your app, the data collection will always be private to the app user's fleet.

For more information on the IronFlock IoT Devops Platform for engineers and developers visit our IronFlock home page.

Requirements

  • Python 3.11 or higher

Installation

Install from PyPI:

pip install ironflock

Usage

import asyncio
from ironflock import IronFlock

# create an IronFlock instance to connect to the IronFlock platform data infrastructure.
# The IronFlock instance handles authentication when run on a device registered in IronFlock.
ironflock = IronFlock()

async def main():
    while True:
        # publish an event (if connection is not established the publish is skipped)
        publication = await ironflock.publish("test.publish.com", {"temperature": 20})
        print(publication)
        await asyncio.sleep(3)


if __name__ == "__main__":
    ironflock = IronFlock(mainFunc=main)
    ironflock.run()

Options

The IronFlock __init__ function can be configured with the following options:

{
    serial_number: string;
}

serial_number: Used to set the serial_number of the device if the DEVICE_SERIAL_NUMBER environment variable does not exist. It can also be used if the user wishes to authenticate as another device.

Advanced Usage

If you need more control, e.g. acting on lifecycle events (onJoin, onLeave) take a look at the examples folder.

Development

Install the necessary build tools if you don't have them already:

pip install --upgrade build twine

Make sure your pypi API tokens are stored in your ~/.pypirc. Build and publish a new pypi package:

just publish

Alternatively, you can build manually:

# Clean previous builds
rm -rf build dist *.egg-info

# Build the package
python -m build

# Upload to PyPI
twine upload dist/*

Check the package at https://pypi.org/project/ironflock/.

Test Deployment

To test the package before deploying to pypi you can use test.pypi.

just clean build publish-test

Once the package is published you can use it in other code by putting these lines at the top of the requirements.txt

--index-url https://test.pypi.org/simple/
--extra-index-url https://pypi.org/simple/

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

ironflock-1.3.8.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

ironflock-1.3.8-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file ironflock-1.3.8.tar.gz.

File metadata

  • Download URL: ironflock-1.3.8.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.3

File hashes

Hashes for ironflock-1.3.8.tar.gz
Algorithm Hash digest
SHA256 1c23909ec8b3556ef52085706374f0d4de5b1d4ea95660525e80cc67c1a3955b
MD5 32455d44c9b2cd6d7d7617828314843d
BLAKE2b-256 9f88e95941341a3f4c83ea866591adcb6f813c17e9f36465f5ad0e65464ff998

See more details on using hashes here.

File details

Details for the file ironflock-1.3.8-py3-none-any.whl.

File metadata

  • Download URL: ironflock-1.3.8-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.3

File hashes

Hashes for ironflock-1.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d2950a2409c21dc4545f9c16cd908c07625b5d3e4208983b0e94cf3647c60caf
MD5 f89b7b3fb4817302f5c827c240c049b5
BLAKE2b-256 976e41c182fa5ef1c1303beab69356256c96201ed0d1fdeda19b2d849bd05e44

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