Skip to main content

Mender SDK for python

Project description

Mender

Usage

async with Mender(base_url = 'https://docker.mender.io/api/management/v1') as mender:
    # List devices on page 1
    devices = await mender.get_devices_paged(page=1)
    print(devices)

    # List all devices
    async for device in mender.get_devices():
        print(device)

    # Filter all devices by attributes
    async for device in mender.get_devices(attributes={"hostname": 'xxx-ffffffffffff'}):
        print(device)

or close your session by yourself:

mender = Mender(base_url = 'https://docker.mender.io/api/management/v1')
# ...
# Remember to close during finishing
await mender.session.close()

Installation

Using pip:

pip install mender

Using pipenv:

pipenv install mender

Deployment

pipenv run python3 setup.py sdist bdist_wheel
pipenv run twine upload dist/*

Device inventory

/inventory

API Endpoints

All URIs are relative to https://docker.mender.io/api/management/v1/inventory

Class Method HTTP request Description
Mender devices_get GET /devices List devices
Mender devices_id_delete DELETE /devices/{id} Remove selected device
Mender devices_id_get GET /devices/{id} Get a selected device
Mender devices_id_group_get GET /devices/{id}/group Get a selected device's group
Mender devices_id_group_name_delete DELETE /devices/{id}/group/{name} Remove a device from a group
Mender devices_id_group_put PUT /devices/{id}/group Add a device to a group
Mender groups_get GET /groups List groups
Mender groups_name_devices_get GET /groups/{name}/devices List the devices belonging to a given group

User administration and authentication

/useradm

API Endpoints

All URIs are relative to https://docker.mender.io/api/management/v1/useradm

Class Method HTTP request Description
Mender auth_login_post POST /auth/login Log in to Mender
Mender settings_get GET /settings Get user settings
Mender settings_post POST /settings Set user settings
Mender users_get GET /users List users
Mender users_id_delete DELETE /users/{id} Remove user from the system
Mender users_id_get GET /users/{id} Get user information
Mender users_id_put PUT /users/{id} Update user information
Mender users_post POST /users Create user

References

Stack

  • PEP 525 - Async Generator (require 3.6)
  • PEP 557 - Dataclass (require 3.7, but there is a backport library for 3.6)
  • PEP 498 - Formatted String Literals (require 3.6, but ther is a backport library for <3.6)

Project details


Download files

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

Files for mender, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size mender-0.0.5-py3-none-any.whl (7.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mender-0.0.5.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page