Registry / iot / ndeflib

ndeflib

JSON →
library0.3.3pypypi✓ verified 30d ago

NFC Data Exchange Format (NDEF) decoder and encoder for Python. Version 0.3.3, low release cadence. Supports creation, parsing, and serialization of NDEF messages used in NFC tags and peer-to-peer communication.

iotdevice-communication
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from ndef import Record
from ndef import TextRecord
from ndef import UriRecord

Create an NDEF message with a text record, encode to bytes, then decode back.

from ndef import Message, Record, make_text_record # Create a text record record = make_text_record('Hello, NFC!', encoding='utf-8') # Create a message with the record message = Message(record) # Encode to bytes encoded = message.to_bytes() print('Encoded:', encoded.hex()) # Decode from bytes decoded = Message.from_bytes(encoded) for record in decoded: print('Record type:', record.type) print('Record payload:', record.data)
Debug
Known footguns
gotchaThe package provides a high-level 'ndef' module, not 'ndeflib'. Importing 'ndeflib' directly gives you a different namespace with lower-level helpers.
deprecatedThe 'make_tnf_method' function in ndeflib is deprecated. Use create_record_with_type instead.
breakingIn version 0.3.0, the Message class changed from a list subclass to a custom sequence. Iterating over Message still works, but direct indexing may return different types.
gotchaRecord.data might be bytes or str depending on type. Text records decode payload to str only if encoding is known.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources