mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-14 08:05:50 +00:00
* Retrieve and process summary or full ledgers. * Search using arbitrary criteria (any Python function). * Search using arbitrary formats (any Python function). * Caches ledgers as .gz files to avoid repeated server requests. * Handles ledger numbers, ranges, and special names like validated or closed.
22 lines
566 B
Python
22 lines
566 B
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
from ripple.ledger.Args import ARGS
|
|
|
|
from functools import wraps
|
|
import json
|
|
|
|
def pretty_print(item):
|
|
return json.dumps(item,
|
|
sort_keys=True,
|
|
indent=ARGS.indent,
|
|
separators=(',', ': '))
|
|
|
|
def pretty(f):
|
|
""""A decorator on a function that makes its results pretty """
|
|
@wraps(f)
|
|
def wrapper(*args, **kwds):
|
|
result = list(f(*args, **kwds))
|
|
return pretty_print(result)
|
|
|
|
return wrapper
|