Skip to main content

No project description provided

Project description

py-dtn7 (Work in Progress -- don't use yet)

Licence AGPL-3.0

A Python wrapper library for the DTN7 REST and WebSocket API of dtn7-rs. The library includes a fully spec compliant Bundle type (but without fragment and CRC support), which allows full bundle creation and (de-)serialization.

The bundle.py, dtn_rest_client.py, utils.py modules/files are Micropython compatible. But, this requires a bit of manual library management. Please refer to the Micropython installation guide below.

Getting Started

To use py-dtn7 in your project, simply install it from PyPI with Poetry:

$ poetry install --no-dev py_dtn7

Development

This is very much a work-in-progress and by far not complete. The Bundle implementation is very rudimentary and does not support any blocks other than Primary and Payload.

To generate the API documentation use pdoc:

$ pdoc ./py_dtn7 --output-directory ./docs

... or check out py-dtn7.readthedocs.org

Quickstart

>>> from py_dtn7 import DTNRESTClient
>>> client = DTNRESTClient(host="http://localhost", port=3000)
>>> d.peers
{'box1': {'eid': [1, '//box1/'], 'addr': {'Ip': '10.0.0.42'}, 'con_type': 'Dynamic', 'period': None, 'cla_list': [['MtcpConvergenceLayer', 16162]], 'services': {}, 'last_contact': 1653316457}}
>>> d.info
{'incoming': 0, 'dups': 0, 'outgoing': 0, 'delivered': 3, 'broken': 0}

When sending a bundle to a known peer, we can simply supply the peer name and endpoint, otherwise we use the complete URI:

>>> d.send(payload={"body": "This will be transferred as json"}, peer_name="box1", endpoint="info")
<Response [200]>
>>> r = d.send(payload="Is there anybody out there?", destination="dtn://greatunkown/incoming")
>>> r.content.decode("utf-8")
'Sent payload with 27 bytes'

Micropython Installation Guide

To be extended:

The dummy libraries __future__.py, abc.py, typing.py, the micropython-cbor library (specifically the cbor.py module/file) and urequests as well as datetime are needed:

$ mpremote mip install urequests
$ mpremote mip install datetime

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

py_dtn7-0.3.0b1.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

py_dtn7-0.3.0b1-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file py_dtn7-0.3.0b1.tar.gz.

File metadata

  • Download URL: py_dtn7-0.3.0b1.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.5.0

File hashes

Hashes for py_dtn7-0.3.0b1.tar.gz
Algorithm Hash digest
SHA256 40425ce6fd329ba91414764d6e6130a67941e912368fa1c8d9a2d043f3632c69
MD5 8324ffa9d062863291b73659ee176e71
BLAKE2b-256 a4e91f7842363d87ed5a4be93f3c246289cc2888a982304a95b996a6b037e4a0

See more details on using hashes here.

File details

Details for the file py_dtn7-0.3.0b1-py3-none-any.whl.

File metadata

  • Download URL: py_dtn7-0.3.0b1-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.5.0

File hashes

Hashes for py_dtn7-0.3.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 70bdcb39731c9e07be512e660314cdbc2f934a761b9d8593595e6c456bab8181
MD5 e7bb09b3bc91cd04f986d8230a383054
BLAKE2b-256 a3ff10f5066f6e48e4954361a643b4f9a3fa995234250692d580cd1e45957be1

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