Skip to main content

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:

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.payload)
	if not tx_msg.observe:
		session.ctx.stop_loop()

session.sendMessage(payload="example data", observe=False, response_callback=rx_cb)

ctx.loop()

More examples can be found in the examples directory.

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

libcoapy-2024.7.4.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

libcoapy-2024.7.4-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file libcoapy-2024.7.4.tar.gz.

File metadata

  • Download URL: libcoapy-2024.7.4.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for libcoapy-2024.7.4.tar.gz
Algorithm Hash digest
SHA256 a2d5f71083f544df15c2fb7a676c391a08be8a31d932f45f38906e90b8d9282d
MD5 eee9734b1859657db3a154378af4fcfa
BLAKE2b-256 f55642200dd36dbb3c36c4191a9404c22c65794fc1bf8ca3c1299e3f03638b4b

See more details on using hashes here.

File details

Details for the file libcoapy-2024.7.4-py3-none-any.whl.

File metadata

  • Download URL: libcoapy-2024.7.4-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for libcoapy-2024.7.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e31a4607f2864a699bdcb99b8043824484130acc0ba1f3dc9d1b9abc1df8ac57
MD5 9caf444daa4f1f8d4b2dfe2e658a95fb
BLAKE2b-256 4bbc252d8d47648984385f8fbe2d644f431bef6a7ff782c7ba9c630a72c42830

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