{"id":22464,"library":"tls-parser","title":"tls-parser","description":"tls-parser is a small library to parse TLS records. Current version 2.0.2 supports Python >=3.8. It provides classes like TlsRecord, TlsHandshake, and parsing of TLS 1.2 and 1.3. The library appears to be in maintenance mode with infrequent releases.","status":"active","version":"2.0.2","language":"python","source_language":"en","source_url":"https://github.com/nabla-c0d3/tls_parser","tags":["tls","parsing","network","security"],"install":[{"cmd":"pip install tls-parser","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"TlsRecord is not in the top-level __init__.py; must import from the specific module.","wrong":"from tls_parser import TlsRecord","symbol":"TlsRecord","correct":"from tls_parser.tls_record import TlsRecord"},{"note":"TlsHandshake is in the tls_handshake module, not directly under tls_parser.","wrong":"from tls_parser import TlsHandshake","symbol":"TlsHandshake","correct":"from tls_parser.tls_handshake import TlsHandshake"}],"quickstart":{"code":"from tls_parser.tls_record import TlsRecord\nfrom tls_parser.tls_version import TlsVersionEnum\n\n# Parse a TLS record from raw bytes (example: TLS 1.2 handshake)\nraw_bytes = bytes.fromhex('16030300a2' + '00' * 162)  # Minimal handshake\nrecord = TlsRecord.from_bytes(raw_bytes)\nprint('Record type:', record.record_type)\nprint('TLS version:', TlsVersionEnum(record.tls_version).name)","lang":"python","description":"Parses a raw TLS record from bytes and prints the record type and TLS version."},"warnings":[{"fix":"Use 'pip install tls-parser' and update imports to match current module structure (e.g., from tls_parser.tls_record import TlsRecord).","message":"In version 2.0.0, the package name changed from 'tls_parser' to 'tls-parser' on PyPI, and the top-level module name changed accordingly. Old imports from 'tls_parser' may still work if the package is installed, but code relying on the old module layout may break.","severity":"breaking","affected_versions":"2.0.0 and later"},{"fix":"Ensure the input bytes include the TLS record header (content type, version, length) and the correct number of payload bytes as specified in the length field.","message":"The library expects raw bytes of a full TLS record (including the 5-byte header). If you pass an incomplete record or omit the header, parsing will fail or produce incorrect results.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using alternatives like 'pycryptodome' or 'scapy' for TLS parsing if you need ongoing support.","message":"The package has not been updated since 2021 and may not support recent TLS extensions or newer Python versions beyond 3.8.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install the package with 'pip install tls-parser' and use 'import tls_parser' (the internal module uses underscores).","cause":"The package is installed as 'tls-parser' but the import expects the hyphenated name.","error":"ModuleNotFoundError: No module named 'tls_parser'"},{"fix":"Use 'from tls_parser.tls_record import TlsRecord' instead.","cause":"TlsRecord is not exposed at the top-level package. It's in a submodule.","error":"AttributeError: module 'tls_parser' has no attribute 'TlsRecord'"},{"fix":"Ensure the complete TLS record is provided, including all payload bytes as per the length field.","cause":"The input bytes are shorter than the record length specified in the header.","error":"tls_parser.exceptions.TlsParserException: Cannot parse record: incomplete data"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}