NFC Data Exchange Format decoder and encoder.
Project description
The ndeflib is an ISC-licensed Python package for parsing and generating NFC Data Exchange Format (NDEF) messages:
>>> import ndef
>>> hexstr = '9101085402656e48656c6c6f5101085402656e576f726c64'
>>> octets = bytearray.fromhex(hexstr)
>>> for record in ndef.message_decoder(octets): print(record)
NDEF Text Record ID '' Text 'Hello' Language 'en' Encoding 'UTF-8'
NDEF Text Record ID '' Text 'World' Language 'en' Encoding 'UTF-8'
>>> message = [ndef.TextRecord("Hello"), ndef.TextRecord("World")]
>>> b''.join(ndef.message_encoder(message)) == octets
True
The ndeflib documentation can be found on Read the Docs, the code on GitHub. It is continously tested for Python 2.7 and 3.5 with pretty complete test coverage.
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
ndeflib-0.1.0.tar.gz
(77.5 kB
view hashes)
Built Distribution
Close
Hashes for ndeflib-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aea8b38c2103100a6b51b15e2ef3ffd2c5eef1e16c368e27d4b4189f8e032e2 |
|
MD5 | 56c0d39049513c415ee4f43188b02cad |
|
BLAKE2b-256 | e74a6616bf7d981a129e511a9cac0c4d265533ad80483b3146ae2fda675cd49c |