Skip to main content

Getting started with the emnify Python SDK

Installation

The emnify Python SDK is open source and the source code is available on GitHub.

Prerequisites

Install from source code

git clone https://github.com/emnify/emnify-sdk-python.git
cd emnify-sdk-python
python setup.py install

Install with pip

The emnify Python SDK is also available on PyPI as emnify-sdk:

pip install emnify-sdk

Configuration

Create an application token

To use the Python SDK, you need to create an application token. You can do this on the Integrations page of the emnify Portal under Application Tokens or the emnify REST API.

Once created, you'll apply it to initiate the SDK.

Use the SDK

import os
# Import the package
from emnify import EMnify

# Initiate the SDK instance using your application token
emnify = EMnify(os.environ["EMNIFY_TOKEN"])

# Execute a command against the desired API
devices = emnify.devices.get_devices_list()

# Show all the devices
print([device for device in devices])

Before executing the code, define an environment variable containing your application token:

export EMNIFY_TOKEN=ey........

Explore more

Now that you have the SDK configured, it's time to learn what you can do with it.

If you're new to IoT connectivity and emnify, start by learning the common terminology and concepts.

Once you're comfortable with these concepts, you can explore some use cases that show what the SDK is capable of based on a few Examples.

Also, see the emnify System Documentation and our OpenAPI specification.