Skip to main content

Gitlab Pipeline Python Version PyPI version License Downloads

gnista-library

A client library for accessing gnista.io

Tutorial

Create new Poetry Project

Navigate to a folder where you want to create your project and type

poetry new my-gnista-client
cd my-gnista-client

Add reference to your Project

Navigate to the newly created project and add the PyPI package

poetry add gnista-library

Your first DataPoint

Create a new file you want to use to receive data this demo.py

from gnista_library import KeyringGnistaConnection, GnistaDataPoint, GnistaDataPoints

connection = KeyringGnistaConnection()

data_point_id = "56c5c6ff-3f7d-4532-8fbf-a3795f7b48b8"
data_point = GnistaDataPoint(connection=connection, data_point_id=data_point_id)

data_point_data = data_point.get_data_point_data()

print(data_point_data)

You need to replace the DataPointId with an ID from your gnista.io workspace.

For example the DataPointId of this DataPoint https://aws.gnista.io/secured/dashboard/datapoint/4684d681-8728-4f59-aeb0-ac3f3c573303 is 4684d681-8728-4f59-aeb0-ac3f3c573303

Run and Login

Run your file in poetry's virtual environment

$ poetry run python demo.py
2021-09-02 14:51.58 [info     ] Authentication has been started. Please follow the link to authenticate with your user: [gnista_library.gnista_connetion] url=https://aws.gnista.io/authentication/connect/authorize?client_id=python&redirect_uri=http%3A%2F%2Flocalhost%3A4200%2Fhome&response_type=code&scope=data-api%20openid%20profile%20offline_access&state=myState

In order to login copy the url into your Browser and Login to gnista.io or, if allowed a browser window will open by itself.

Keystore

Once you loggedin, the library will try to store your access token in your private keystore. Next time you run your programm, it might request a password to access your keystore again to gain access to gnista.io Please take a look at Keyring for details.

Advanced Example

Show received Data in a plot

poetry new my-gnista-client
cd my-gnista-client
poetry add gnista-library
poetry add structlib
poetry add matplotlib
import matplotlib.pyplot as plt
from structlog import get_logger

from gnista_library import KeyringGnistaConnection, GnistaDataPoint, GnistaDataPoints

log = get_logger()

connection = KeyringGnistaConnection()

data_point_id = "56c5c6ff-3f7d-4532-8fbf-a3795f7b48b8"
data_point = GnistaDataPoint(connection=connection, data_point_id=data_point_id)

data_point_data = data_point.get_data_point_data()
log.info("Data has been received. Plotting")
data_point_data.plot()
plt.show()

Filter by DataPoint Names

poetry new my-gnista-client
cd my-gnista-client
poetry add gnista-library
poetry add structlib
poetry add matplotlib
import matplotlib.pyplot as plt
from structlog import get_logger

from gnista_library import KeyringGnistaConnection, GnistaDataPoint, GnistaDataPoints

log = get_logger()

connection = KeyringGnistaConnection()

dataPoints = GnistaDataPoints(connection=connection)
data_point_list = list(dataPoints.get_data_point_list())

for data_point in data_point_list:
    log.info(data_point)

# Find Specific Data Points
filtered_data_points = filter(
    lambda data_point: data_point.name.startswith("371880214002"), data_point_list
)
for data_point in filtered_data_points:
    # get the data
    data_point_data = data_point.get_data_point_data()
    log.info(data_point_data)
    data_point_data.plot()
    plt.show()

Links

Website gnista.io

PyPi PyPi

GIT Repository Gitlab

Metadata

Release files for gnista-library 2.0.2

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

Source distribution (sdist)

Source distribution for gnista-library 2.0.2
File Size Uploaded
gnista-library-2.0.2.tar.gz 38.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gnista-library 2.0.2
File Interpreter ABI Platform
gnista_library-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 147.7 kB

Release files / gnista-library-2.0.2.tar.gz

Download URL gnista-library-2.0.2.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
67cd536850c25aa9c35311c0cb8dd118a2fbdce3a64c7bd9ca71a7def922a3ad
BLAKE2b-256 checksum
How to use checksums
3b084d51fd69aae5aa3461c1406049540a5a3e3fea13e4bc611e9c91f364ace8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.7 Linux/5.4.109+

Release files / gnista_library-2.0.2-py3-none-any.whl

Download URL gnista_library-2.0.2-py3-none-any.whl
Size 109.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19beb40c6208e6be0291fedcd5c7e86a1c86e25af661a40ffeda500cd2e6bafe
BLAKE2b-256 checksum
How to use checksums
9223245cc285477cc9418331e2fb1208c11d01348ad3f8beff180d52a3045079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.7 Linux/5.4.109+

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.5.0

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.0

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.1

2 release files

1.0.0

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