Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 435 Bytes

library-usage.rst

File metadata and controls

16 lines (11 loc) · 435 Bytes

Library usage

Use the :py:class:`~pcapng.scanner.FileScanner` class to iterate over blocks in a pcap-ng archive file, like this:

from pcapng import FileScanner

with open('/tmp/mycapture.pcap') as fp:
    scanner = FileScanner(fp)
    for block in scanner:
        pass  # do something with the block...

Block types can be checked against blocks in :py:mod:`pcapng.blocks`.