aiocoap – The Python CoAP library¶
It uses the Python 3’s asynchronous I/O to facilitate concurrent operations while maintaining a simple to use interface and not depending on anything outside the standard library.
aiocoap is originally based on txThings. If you want to use CoAP in your existing twisted application, or can not migrate to Python 3 yet, that is probably more useful to you than aiocoap.
All examples can be run directly from a source code copy. If you prefer to install it, the usual Python mechanisms apply (see Installing aiocoap).
Features / Standards¶
This library supports the following standards in full or partially:
- RFC7252 (CoAP): missing are a caching and cross proxy implementation, proper multicast (support is incomplete); DTLS support is client-side only so far, and lacking some security properties.
- RFC7641 (Observe): Reordering, re-registration, and active cancellation are missing.
- RFC7959 (Blockwise): Multicast exceptions missing.
- RFC7967 (No-Response): Basic support, but not automated in library
- RFC8132 (PATCH/FETCH): Types and codes known, FETCH observation supported
- draft-ietf-core-resource-directory: A standalone resource directory server is provided along with a library function to register at one. They lack support for groups, PATCHes to endpoint locations and security considerations, and are generally rather simplistic.
- draft-ietf-core-object-security-06 (OSCORE, formerly OSCOAP): Infrastructure for supporting it is in place (lacking observe and inner-blockwise support), but no simple way exists yet for launching protected servers or requests yet.
If something described by one of the standards but not implemented, it is considered a bug; please file at the github issue tracker. (If it’s not on the list or in the excluded items, file a wishlist item at the same location).
Basic aiocoap works out of the box on Python 3.5 or greater. Full functionality is currently available only on Linux and possibly some BSDs (see platform issues). For Windows, macOS and uvloop, limited transports for server and client operation are available and automatically enabled, but see their respective caveats.
Some components (eg. servers that should auto-generate
resources, OSCORE, DTLS) require additional packages to be present; they are
automatically installed when following the Installing aiocoap instructions. For
slimmer systems, see
setup.py for the definition of the “extras”.
Developers of projects building on aiocoap should specify the required extras
in their own dependency statements. For example, an application that provides a
server with a
.well-known/core file and OSCORE will want to depend on
aiocoap[linkheader,oscore] >= 0.4a1.
aiocoap tries to stay close to PEP8 recommendations and general best practice, and should thus be easy to contribute to.
Documentation is built using sphinx with
./setup.py build_sphinx; hacks
used there are described in
Bugs (ranging from “design goal” and “wishlist” to typos) are currently tracked in the github issue tracker.
Unit tests are implemented in the
./tests/ directory and easiest run using
./setup.py test; complete test coverage is aimed for, but not yet complete
(and might never be, as the error handling for pathological network partners is
hard to trigger with a library designed not to misbehave). The tests are
regularly run at the CI suite at gitlab, from where coverage reports are
This is where the latest source code can be found, and bugs can be reported. Generally, this serves as the project web site.
Online documentation built from the sources.
Further general information on CoAP, the standard documents involved, and other implementations and tools available.
aiocoap is published under the MIT License, see LICENSE for details.
When using aiocoap for a publication, please cite it according to the output of
./setup.py cite [--bibtex].
- Copyright (c) 2012-2014 Maciej Wasilak <http://sixpinetrees.blogspot.com/>,
- 2013-2014 Christian Amsüss <firstname.lastname@example.org>
- Installing aiocoap
- Guided Tour through aiocoap
- aiocoap module
- aiocoap.protocol module
- aiocoap.message module
- aiocoap.options module
- aiocoap.interfaces module
- aiocoap.defaults module
- aiocoap.transports module
- aiocoap.proxy module
- aiocoap.proxy.client module
- aiocoap.proxy.server module
- aiocoap.numbers module
- aiocoap.error module
- aiocoap.optiontypes module
- aiocoap.resource module
- aiocoap.dump module
- aiocoap.util module
- aiocoap.util.asyncio module
- aiocoap.util.cli module
- aiocoap.util.socknumbers module
- aiocoap.util.secrets module
- aiocoap.util.uri module
- aiocoap.cli module
- aiocoap.oscore module
- Usage Examples
- CoAP tools
- Change log