pyndef


Namepyndef JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryPure Python library for creating and parsing NDEF messages.
upload_time2024-02-26 08:51:57
maintainerXFY9326
docs_urlNone
authorXFY9326
requires_python>=3.6
license
keywords ndef ndef-library nfc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyNdef

![!python-versions](https://img.shields.io/badge/Python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue)
[![Pypi](https://img.shields.io/pypi/v/pyndef?color=orange)](https://pypi.org/project/pyndef/)

[![codecov](https://codecov.io/gh/XFY9326/PyNdef/graph/badge.svg?token=QVJNICD0GA)](https://codecov.io/gh/XFY9326/PyNdef)
[![Test](https://github.com/XFY9326/PyNdef/actions/workflows/test.yml/badge.svg)](https://github.com/XFY9326/PyNdef/actions/workflows/test.yml)
[![Release](https://github.com/XFY9326/PyNdef/actions/workflows/release.yml/badge.svg)](https://github.com/XFY9326/PyNdef/actions/workflows/release.yml)

Pure Python library for creating and parsing NDEF messages.  
All codes in this repository are referred to AOSP NDEF implementation.

## Features

- Pure Python implementation (>=3.6)
- No 3rd party dependency
- With tests
- Similar to AOSP NDEF implementation
- Full type hint

## Usage

```shell
pip install pyndef
```

```python
from pyndef import NdefMessage, NdefRecord, NdefTNF, NdefRTD

r1 = NdefRecord(NdefTNF.EMPTY, None, None, None)
print(r1)

r2 = NdefRecord(NdefTNF.EXTERNAL_TYPE, b"type", b"\x01", b"\x01\x02\x03")
print(r2)

r3 = NdefRecord.create_uri("https://www.github.com")
print(r3)

r4 = NdefRecord(NdefTNF.WELL_KNOWN, NdefRTD.SMART_POSTER, None, r3.to_bytes())
print(r4)

msg = NdefMessage(r2, r3)
print(msg)

msg = NdefMessage.parse(b"\xd8\x00\x00\x00")
print(msg)
```

## Reference

```
/platform/frameworks/base/nfc/java/android/nfc/NdefRecord.java
/platform/frameworks/base/nfc/java/android/nfc/NdefMessage.java
/cts/tests/tests/ndef/src/android/ndef/cts/NdefTest.java
```

## License

```
   Copyright 2024 XFY9326

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyndef",
    "maintainer": "XFY9326",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "ndef,ndef-library,nfc",
    "author": "XFY9326",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/77/dd/0491b87f9c061ffb866549574812d785b8b6c5d36da305e60dd9fa776c93/pyndef-1.0.2.tar.gz",
    "platform": null,
    "description": "# PyNdef\n\n![!python-versions](https://img.shields.io/badge/Python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue)\n[![Pypi](https://img.shields.io/pypi/v/pyndef?color=orange)](https://pypi.org/project/pyndef/)\n\n[![codecov](https://codecov.io/gh/XFY9326/PyNdef/graph/badge.svg?token=QVJNICD0GA)](https://codecov.io/gh/XFY9326/PyNdef)\n[![Test](https://github.com/XFY9326/PyNdef/actions/workflows/test.yml/badge.svg)](https://github.com/XFY9326/PyNdef/actions/workflows/test.yml)\n[![Release](https://github.com/XFY9326/PyNdef/actions/workflows/release.yml/badge.svg)](https://github.com/XFY9326/PyNdef/actions/workflows/release.yml)\n\nPure Python library for creating and parsing NDEF messages.  \nAll codes in this repository are referred to AOSP NDEF implementation.\n\n## Features\n\n- Pure Python implementation (>=3.6)\n- No 3rd party dependency\n- With tests\n- Similar to AOSP NDEF implementation\n- Full type hint\n\n## Usage\n\n```shell\npip install pyndef\n```\n\n```python\nfrom pyndef import NdefMessage, NdefRecord, NdefTNF, NdefRTD\n\nr1 = NdefRecord(NdefTNF.EMPTY, None, None, None)\nprint(r1)\n\nr2 = NdefRecord(NdefTNF.EXTERNAL_TYPE, b\"type\", b\"\\x01\", b\"\\x01\\x02\\x03\")\nprint(r2)\n\nr3 = NdefRecord.create_uri(\"https://www.github.com\")\nprint(r3)\n\nr4 = NdefRecord(NdefTNF.WELL_KNOWN, NdefRTD.SMART_POSTER, None, r3.to_bytes())\nprint(r4)\n\nmsg = NdefMessage(r2, r3)\nprint(msg)\n\nmsg = NdefMessage.parse(b\"\\xd8\\x00\\x00\\x00\")\nprint(msg)\n```\n\n## Reference\n\n```\n/platform/frameworks/base/nfc/java/android/nfc/NdefRecord.java\n/platform/frameworks/base/nfc/java/android/nfc/NdefMessage.java\n/cts/tests/tests/ndef/src/android/ndef/cts/NdefTest.java\n```\n\n## License\n\n```\n   Copyright 2024 XFY9326\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Pure Python library for creating and parsing NDEF messages.",
    "version": "1.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/XFY9326/PyNdef/issues",
        "Homepage": "https://github.com/XFY9326/PyNdef",
        "Repository": "https://github.com/XFY9326/PyNdef.git"
    },
    "split_keywords": [
        "ndef",
        "ndef-library",
        "nfc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f87cfe441c10ea5bb52da0dbd9a32319ffa62459dcc88df8b95d6a93742c378",
                "md5": "230b27ff5e7a418177b1677b7a93922b",
                "sha256": "b1df47989552d5a44c6039207cc7b48a26cbfa8382ac68f1f0b72b3f49c44fec"
            },
            "downloads": -1,
            "filename": "pyndef-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "230b27ff5e7a418177b1677b7a93922b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10010,
            "upload_time": "2024-02-26T08:51:55",
            "upload_time_iso_8601": "2024-02-26T08:51:55.358000Z",
            "url": "https://files.pythonhosted.org/packages/9f/87/cfe441c10ea5bb52da0dbd9a32319ffa62459dcc88df8b95d6a93742c378/pyndef-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77dd0491b87f9c061ffb866549574812d785b8b6c5d36da305e60dd9fa776c93",
                "md5": "8e3cd50955644b779d0cf8c8ab43a3de",
                "sha256": "27cafcfac032b9b8d4eac792773538d22dd8465de3495aca067de3c7ccb499e5"
            },
            "downloads": -1,
            "filename": "pyndef-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8e3cd50955644b779d0cf8c8ab43a3de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11800,
            "upload_time": "2024-02-26T08:51:57",
            "upload_time_iso_8601": "2024-02-26T08:51:57.074801Z",
            "url": "https://files.pythonhosted.org/packages/77/dd/0491b87f9c061ffb866549574812d785b8b6c5d36da305e60dd9fa776c93/pyndef-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-26 08:51:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "XFY9326",
    "github_project": "PyNdef",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyndef"
}
        
Elapsed time: 0.25328s