aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Wingert <justus@abi007.info>2014-11-15 18:41:51 +0100
committerJustus Wingert <justus@abi007.info>2014-11-15 18:41:51 +0100
commitf3a78d4795a97f99194a46c764cfeb1fe6fd01f2 (patch)
treee426a35c3e4c1c01db1b7b27f5d438eb9fb2f0c5
parentfd48a70128581c508420901910c285f247c930c7 (diff)
downloadmitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.tar.gz
mitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.tar.bz2
mitmproxy-f3a78d4795a97f99194a46c764cfeb1fe6fd01f2.zip
Improved helper method, marginally.
-rw-r--r--examples/har_extractor.py8
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)