diff options
Diffstat (limited to 'libmproxy/utils.py')
-rw-r--r-- | libmproxy/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libmproxy/utils.py b/libmproxy/utils.py index b5dc6d92..8ac1f547 100644 --- a/libmproxy/utils.py +++ b/libmproxy/utils.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import re, os, subprocess, datetime, textwrap, errno, sys, time, functools +import json CERT_SLEEP_TIME = 1 @@ -111,6 +112,14 @@ def pretty_xmlish(s): return data +def pretty_json(s): + try: + p = json.loads(s) + except ValueError: + return None + return json.dumps(p, sort_keys=True, indent=4).split("\n") + + def hexdump(s): """ Returns a set of typles: |