Metadata-Version: 2.1
Name: py-dtn7
Version: 0.2.1a4
Summary: 
Home-page: https://github.com/teschmitt/py-dtn7
License: AGPL-3.0-or-later
Author: Thomas Schmitt
Author-email: t.e.schmitt@posteo.de
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: cbor2 (>=5.4.3,<6.0.0)
Requires-Dist: requests (>=2.27.1,<3.0.0)
Requires-Dist: websocket-client (>=1.3.2,<2.0.0)
Project-URL: Repository, https://github.com/teschmitt/py-dtn7
Description-Content-Type: text/markdown

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

[![Licence AGPL-3.0](https://img.shields.io/github/license/teschmitt/py-dtn7)](LICENSE)

A Python library for the DTN7 REST and WebSocket API of [dtn7-rs](https://github.com/dtn7/dtn7-rs)
including a BP7 style `Bundle` type (sort of).


### Be warned:

This is very much a work-in-progress.
Apart from not being very useful yet, anything might change at any time
since the package is still under development and the requirements are not all
completely clear yet.

### PR Politics

I'm sorry to say that right now I can't accept any Pull Requests, since this repo is part
of my Bachelor Thesis and logically any external contribution is forbidden. If you want to
contribute, please check back around November 2022. Until then feel free to
fork this repo and do some of your own experiments.

## Quickstart

```pycon
>>> 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:

```pycon
>>> 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'
```

## Documentation

Use `pdoc` to generate the API docs or check out [py-dtn7.readthedocs.org](https://py-dtn7.readthedocs.org)

