diff options
author | Justus Wingert <justus@abi007.info> | 2014-11-15 18:41:51 +0100 |
---|---|---|
committer | Justus Wingert <justus@abi007.info> | 2014-11-15 18:41:51 +0100 |
commit | f3a78d4795a97f99194a46c764cfeb1fe6fd01f2 (patch) | |
tree | e426a35c3e4c1c01db1b7b27f5d438eb9fb2f0c5 /examples | |
parent | fd48a70128581c508420901910c285f247c930c7 (diff) | |
download | mitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.tar.gz mitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.tar.bz2 mitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.zip |
Improved helper method, marginally.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/har_extractor.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/har_extractor.py b/examples/har_extractor.py index bc67d299..666dc03f 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -170,14 +170,14 @@ def done(context): print "=" * 100 -def print_attributes(obj, filter=None): +def print_attributes(obj, filter_string=None, hide_privates=False): """ Useful helper method to quickly get all attributes of an object and its values. """ for attr in dir(obj): - # if "__" in attr: - # continue - if filter is not None and filter not in attr: + if hide_privates and "__" in attr: + continue + if filter_string is not None and filter_string not in attr: continue value = getattr(obj, attr) print "%s.%s" % ('obj', attr), value, type(value) |