Reading Mifare Card Information with PyNFC

  • Share this:

Code introduction


This function uses the PyNFC library to read the information of a Mifare card with a specified serial number.


Technology Stack : PyNFC, NfcReaderWriter, Tag, MifareCard

Code Type : NFC card reading

Code Difficulty : Intermediate


                
                    
def read_mifare_card(serial_number):
    from nfc import NfcReaderWriter
    from nfc.tag import Tag
    from nfc.tag.mifare import MifareCard

    reader = NfcReaderWriter()
    tag = reader.connect(serial_number)
    mifare_card = MifareCard(tag)
    return mifare_card