mitmproxy - har_extractor.py can't import HAR from harparser

463 views Asked by At

I m using mitmproxy, and I want to convert my flows into .har format using this script har_extractor.py (https://raw.githubusercontent.com/mitmproxy/mitmproxy/master/examples/har_extractor.py)

I can't import the HAR name from this dependency https://github.com/JustusW/harparser, and I don't want to install it globally because I m running on Mac OS on Python 2.7.

This line never works: from harparser import HAR I get a traceback error: ImportError: cannot import name HAR

I can however - import harparser

1

There are 1 answers

0
rvaneijk On

Harparser was updated on June 23 [1]. Did that resolve the issue?

It does contain the HAR function:

class _HAR(MutableMapping, object):
    """
    HAR implementation as per specification version 1.2 ()
    This class maps the specification contained in __map__ to dynamic subclasses stored in __classes__.
    It then exposes all of this by implementing MutableMapping, the generated subclasses being its keys.
    """ 

[1] https://pypi.python.org/pypi/harparser/