Skip to main content

Telenor NB-IoT client

Project description

nbiot-python

NBIoT-Python provides a Python client for the REST API for Telenor NB-IoT.

Configuration

The configuration file is located at ${HOME}/.telenor-nbiot. The file is a simple list of key/value pairs. Additional values are ignored. Comments must start with a #:

#
# This is the URL of the Telenor NB-IoT REST API. The default value is
# https://api.nbiot.telenor.io and can usually be omitted.
address=https://api.nbiot.telenor.io

#
# This is the API token. Create new token by logging in to the Telenor NB-IoT
# front-end at https://nbiot.engineering and create a new token there.
token=<your api token goes here>

The configuration file settings can be overridden by setting the environment variables TELENOR_NBIOT_ADDRESS and TELENOR_NBIOT_TOKEN. If you only use environment variables the configuration file can be ignored. Finally, there is a Client constructor that accepts the address and token directly.

Sample code

from nbiot import nbiot

client = nbiot.Client()
stream = await client.collection_output_stream('<YOUR_COLLECTION_ID>')
while True:
	try:
		msg = await stream.recv()
	except nbiot.OutputStreamClosed:
		break
	print(msg.payload)

Development

Development is done using Pipenv. Run pipenv install --dev to install all dependencies.

Because Python has not properly solved dependency management yet, dependencies must be be repeated in setup.py under the install_requires entry.

Testing

Tests are written using pytest. Run pipenv run pytest to run all the tests.

Deployment

To build and upload a new version to PyPI, make sure that you are using Python 3 and run

python setup.py sdist
python setup.py bdist_wheel
twine upload dist/*          # `pip install twine` to get this tool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telenor-nbiot-0.2.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

telenor_nbiot-0.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file telenor-nbiot-0.2.tar.gz.

File metadata

  • Download URL: telenor-nbiot-0.2.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for telenor-nbiot-0.2.tar.gz
Algorithm Hash digest
SHA256 dc71b1540a89ef0894817968ec2a84d7d9e857016d5daa766cbaacfbcf2f85b8
MD5 119ad846dc2a8f2566cee02fac42af06
BLAKE2b-256 8a4ebbe6e4e3be7eef2e8d617dbf9bf775da9aaf3afc706cd057cc91129531ec

See more details on using hashes here.

File details

Details for the file telenor_nbiot-0.2-py3-none-any.whl.

File metadata

  • Download URL: telenor_nbiot-0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.2

File hashes

Hashes for telenor_nbiot-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b70340c8094a7f0965088f647cc10f9855188fb72d985ca0a76f564a9aee14d3
MD5 76699385fc7c94e7625d953fb022d74d
BLAKE2b-256 93ed922c367d79de80ba2ed9997a1266c40f2355abef95a8eef713f3f8ba3d60

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page