Skip to main content

An easy to use SensorThings API Client written in Python

Project description


Latest Release Build Status Language grade: Python Codecov

This is an easy to use SensorThings API Client written in Python

The SensorThings API (STA) is an OGC standard for IoT device sensing data.
A server implementation of the STA can be found here FROST


stapy is compatible with Python 3.6+ and the recommended way to install is via pip

pip install stapy


stapy can be used both form the command line (in two different ways) and as a Python library.


At first it is necessary to set the URL of the STA. Within the CLI this can be achieved as follows:

stapy -u {URL}

stapy can of course be also run as a Python module(python -m stapy)

The URL can also be set from within a Python script:

>>> import stapy

>>> stapy.set_api_url({URL})

CLI - Interactive

The interactive mode is the easiest one to use but can not be used programmatically. Therefore it is probably a good starting point to get familiar with the STA. The interactive mode can be invoked in the following way.

stapy -i

Currently it does support POST, PATCH and DELETE requests.

CLI - Normal

The normal command line mode is a bit more difficult to use but can be automated.

stapy --help

Should give sufficient information on how two use it properly. As the interactive mode it does support POST, PATCH and DELETE requests.


This is the Python interface to the SensorThings API (stapy is meant to be used as Python library). Therefore it supports all requests (POST, PATCH, DELETE and GET).

The relevant classes can be found within the files,,, and in the sta sub-module.

The following syntax can be used to create new entities:

>>> from stapy import Post

>>> Post.observed_property("TestProp", "TestProp-Desc", "TestProp-Def")

To understand which arguments are available and mandatory it is advisable to have a look at the STA-Docs and/or use the interactive mode of stapy.

Following is one example of a GET request:

>>> from stapy import Query, Entity

>>> results, times = Query(Entity.Observation).select("result", "phenomenonTime").order("result").get_data_sets()

results afterwards contains all results of the present Observations in ascending order.
times contains the respective times for the results.

stapy does support all GET query options that are available for the STA. Some examples are select, filter, orderby and skip. These can be chained together as seen in the example above.

Further use-cases and applications can be found in the examples.


To build this project, run python build. To execute the unit tests, run python test

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 stapy, version 0.2.4
Filename, size File type Python version Upload date Hashes
Filename, size stapy-0.2.4-py3-none-any.whl (30.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size stapy-0.2.4.tar.gz (21.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page