Skip to main content

nfctagger

NFC Tag Reading and Writing Library

Introduction

This library provides a simple way to read and write NFC tags. At first it will focus on using the ACR122U reader, with NTAG21x tags. It will be extended to support other readers and tags in the future as I gain access to relevant readers and tags.

Motivations

  • At this point nfcpy which is a great library, is not being maintained(?) and it's support for ACR122U is not working.
  • pyscard, the other library that supports ACR122U is very low level and does not handle much directly i.e. working with NDEF messages, handling specific operations. In the end, it requires a lot of knowledge of the NFC protocol to use it. Removing that barrier is the goal of this library.

Prerequisites

This library uses pyscard to talk to the card reader. So it requires a properly working pyscard installation including a pcscd daemon running.

Installation

Once this library is published, it will be available on PyPI and can be installed with pip:

pip install nfctagger

Usage

Right now after installation you can either use it as a library or as a command line tool to overwrite an NTAG215 with a hello world message

python -mnfctagger

To use the library in your code, you can use the following example:

from nfctagger import PCSCWaiter

waiter = PCSCWaiter()

ncards = 0
while True:
    # wait for a card to be detected for 1 second
    connection = waiter.get_next_connection(timeout=1)
    if connection is None:
        continue
    handle(connection)
return 0

Development

This library uses the uv program to manage the virtual environment and dependencies. Imports should follow the order reorder-python-imports.

Metadata

Release files for nfctagger 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nfctagger 0.0.2
File Size Uploaded
nfctagger-0.0.2.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nfctagger 0.0.2
File Interpreter ABI Platform
nfctagger-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 41.4 kB

Release files / nfctagger-0.0.2.tar.gz

Download URL nfctagger-0.0.2.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1bbcce2908eb8e01d24c47573b53ba3ecafdd6fcb790200e1d4312fb16f5be87
BLAKE2b-256 checksum
How to use checksums
4ccc988ebaf603fd65a2e659f6fed186bf1f6ea7442b58256b69ee3a8931c3c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.3

Release files / nfctagger-0.0.2-py3-none-any.whl

Download URL nfctagger-0.0.2-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
097002f43c5bc2e4486ac86ac593a4b3332d097b9e83cc88d3e19bf3660a962f
BLAKE2b-256 checksum
How to use checksums
7b1c4c14072dffe2af878fc6b3bba1cf35b9ce8a27312436a270d652bc6a9709
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page