Python module to communicate over the CoAP protocol
Project description
libcoapy
libcoapy project enables communication over the CoAP protocol (RFC 7252). The
llapi
module provides ctypes-based wrappers for the libcoap
C library. The libcoapy
module uses llapi
to provide a high-level class interface
to the libcoap functions.
Dependencies:
- libcoap
Status
This project is still in early development. Several functions of the libcoap library are not yet available and existing high-level libcoapy APIs might change in the future.
Example
from libcoapy import *
if len(sys.argv) < 2:
uri_str = "coaps://localhost/.well-known/core"
else:
uri_str = sys.argv[1]
ctx = CoapContext()
session = ctx.newSession(uri_str, hint="user", key="password")
def rx_cb(session, tx_msg, rx_msg, mid):
print(rx_msg.bytes)
if not tx_msg.observe:
session.ctx.stop_loop()
session.sendMessage(payload="example data", observe=False, response_callback=rx_cb)
ctx.loop()
For an example with the low-level API, see examples/ll-client.py
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libcoapy-2024.6.17.tar.gz
(12.4 kB
view hashes)
Built Distribution
Close
Hashes for libcoapy-2024.6.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 284e4af7d38267f1bc40c400bcdbd38ce72599574a7adba2319a8ab068b94b85 |
|
MD5 | e758f2d12715b38c587e3a8c70c9be5f |
|
BLAKE2b-256 | 5d19dd75eee9934cd3b477b0c8f9dd1c362d44132c2bb4ff92ac30bdb2fe880c |