Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timgabets/pytlv
https://github.com/timgabets/pytlv
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/timgabets/pytlv
- Owner: timgabets
- Created: 2017-04-21T14:56:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T18:25:25.000Z (about 2 years ago)
- Last Synced: 2024-11-13T00:57:09.782Z (2 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 12
- Watchers: 4
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TLV parser
To import the pytlv module in your code:
```python
from pytlv.TLV import *```
To parse data from a TLV string:
```python
tlv = TLV(['84', 'A5']) # provide the possible tag values
tlv.parse('840E315041592E5359532E4444463031A5088801025F2D02656E')
>>> {'84': '315041592E5359532E4444463031', 'A5': '8801025F2D02656E'}```
To build a TLV string:
```python
tlv = TLV(['9F02', '9F04'])
tlv.build({'9f02': '000000001337'})
>>> '9F0206000000001337'```