Skip to content

Instantly share code, notes, and snippets.

Created Jul 23, 2016
What would you like to do?
A test code to extract ID from SUICA/PASMO through nfcpy
#!/usr/bin/env python
# coding:utf-8
from __future__ import print_function
from binascii import hexlify
import sys
import nfc
def connected(tag):
if isinstance(tag, nfc.tag.tt3.Type3Tag):
print("Your IDm is {}".format(hexlify(tag.idm).upper()))
except Exception as e:
print("error: {}".format(e))
print("error: tag isn't Type3Tag")
if __name__ == "__main__":
print("Please put your card on the nfc reader. Waiting...")
clf = nfc.ContactlessFrontend('usb')
clf.connect(rdwr={'on-connect': connected})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment