Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

A python wrapper for Global Sensor Networks API

Project description

Python wrapper for the Global Sensor Networks API

.. contents:: **Table of Contents**


> pip install gsn


The wrapper uses the `sanction`_ Oauth2 library to authenticate against GSN services.
Before starting you must create a "client" on GSN services and get the client_id, client_secret and redirect_uri.
As we will be using client_credentials, the client must be linked to the user from which it will inherit the access rights.
The value of redirect uri is not used, but must nevertheless match.

Then in your python code, you can use it this way::

> import gsn
> a = gsn.API(service_url="http://localhost:9000/ws", client_id="client", client_secret="secret", redirect_uri="http://localhost")
> s = a.get_latest_values("push")
> s.values = [[1469959498000, 18]]
> r = a.push_values(s)

.. _sanction:

Sensor object

This object abstract the json representation used by GSN for the stream elements. It has the following fields:

* fields: list of triples representing the name, type and units
* name: name of the sensor
* values: list of lists. The inner lists must have the same size as the fields list and represent the data of a stream element.
* location: (optional) a triple representing the location of the sensor as latitude, longitude, altitude.


* adding refresh token support
* automatically tracking the expiration of access token and refreshing if necessary


* initial release
* supports querying the latest values and pushing data
* compatible with GSN v2.0.0

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 gsn, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size gsn-0.2.0-py2.py3-none-any.whl (5.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size gsn-0.2.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page