Eik-Lab / nrf_client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NRF Client for Python

Getting started

To get started, install the library by running:

pip install git+https://github.com/Eik-Lab/nrf_client

Usage

Currently, the library only supports fetching devices. To do this, run the following code:

from nrf_client import NrfAPI
TOKEN = "INSERT_TOKEN_HERE"
client = NrfAPI(TOKEN)
devices = client.get_devices()

If no token is provided, it'll look for the variable NRF_API_TOKEN in your enviroment variables. If it isn't there it will raise an exception.

This will give you the JSON object from the NRF API. Too for example get JSON from the request into a dict, run the following:

json_body = devices.json()
data = json.loads(json_body)

To get the info of the devices, run the following code:

data["items"]

Contribution

Contributions to add support for more endpoints are welcome.

About


Languages

Language:Python 100.0%