Skip to main content

Python SDK

Python SDK, a python driver for Mainflux HTTP API.

Does both system administration (provisioning) and messaging.

Installation Import "github.com/mainflux/sdk-py" in your Python package.

Then call SDK Pythong functions to interact with the system.

API Reference

FUNCTIONS

class SDK:
    def __init__(
        self,
        users_url=default_url,
        things_url=default_url,
        messages_url=default_url,
        groups_url=default_url
    ):
        self.users = users.Users(users_url)
        self.things = things.Things(things_url)
        self.messages = messages.Messages(messages_url)
        self.channels = channels.Channels(things_url)
        self.groups = groups.Groups(groups_url)
        self.version_url = things_url

    def version(self):
        Version - server health check
        
class Users:
    def __init__(self, url):
        self.url = url

    def create(self, user):
        CreateUser - create user

    def login(self, user):
        CreateToken - create user token
    
    def get(self, user_id, token):
        User - gets user

    def get_all(self, token):
        Users - gets all users
    
    def update(self, user, token):
        UpdateUser - update user

    def update_password(self, old_password, password, token):
        UpdatePassword - update user password

class Things:
    def __init__(self, url):
        self.url = url

    def create(self, thing, token):
        CreateThing - creates new thing and generates thing UUID

    def construct_query(self, params):
        ConstructQuery - allows you to set query params: offset, limit, order, direction

    def create_bulk(self, things, token):
        CreateThings - creates bulk of things and generates things UUID

    def get(self, thing_id, token):
        Thing - gets thing
    
    def get_all(self, token, query_params=None):
        Things - gets all things

    def get_by_channel(self, channel_id, params, token):
        GetByChannel - Gets all things to which a specific thing is connected to

    def update(self, thing_id, token, thing):
        UpdateThing - updates thing by ID

    def delete(self, thing_id, token):
        DeleteThing - removes thing

    def connect(self, channel_ids, thing_ids, token):
        Connect - connect things to channels

    def disconnect(self, channel_ids, thing_ids, token):
        DisconnectThing - disconnect thing and channel

class Channels:
    def __init__(self, url):
        self.url = url

    def create(self, channel, token):
        CreateChannel - creates new channel and generates UUID
    
    def construct_query(self, params):
        ConstructQuery - allows you to set query params: offset, limit, order, direction

    def create_bulk(self, channels, token):
        CreateChannels - creates bulk of channels and generates channels UUID

    def get(self, channel_id, token):
        Channel - gets channel by ID

    def get_all(self, token, query_params=None):
        Channels - gets all channels

    def get_by_thing(self, thing_id, params, token):
        GetByThing - Gets all channels to which a specific channel is connected to

    def update(self, channel_id, token, channel):
        UpdateChannel - update a channel

    def delete(self, chanID, token):
        DeleteChannel - removes channel

class Messages:
    def __init__(self, url):
        self.url = url

    def send(self, channel_id, msg, token):
        Send - Sends message via HTTP protocol

    def read(self, channel_id, token):
        Read - Reads messages from database for a given channel

Metadata

Release files for Mainflux 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Mainflux 0.0.1
File Size Uploaded
Mainflux-0.0.1.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Mainflux 0.0.1
File Interpreter ABI Platform
Mainflux-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / Mainflux-0.0.1.tar.gz

Download URL Mainflux-0.0.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
34e88ecadec18def8b9299108f0e20a978dd94498439d8e678fdd4150ca9c3c8
BLAKE2b-256 checksum
How to use checksums
ea2f1795504ab93e05f5213f242360e06b87a397b2e41a03f9ad4d5faf387c3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

Release files / Mainflux-0.0.1-py3-none-any.whl

Download URL Mainflux-0.0.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f08bf121cd9561a8e76a7b857894b6d260f69c21f0e9bfa4704d66209ec8ee6
BLAKE2b-256 checksum
How to use checksums
374772376637a7c029291de629ea4f271f94f0275b40234eb1ebb5f71befd71a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page