def bottlestats(server_name, path=''):
    """Renders a GET request, by showing this nodes stats and children."""
    path = path.lstrip('/')
    parts = path.split('/')
    if not parts[0]:
        parts = parts[1:]
    stat_dict = util.lookup(scales.getStats(), parts)

    if stat_dict is None:
        abort(404, "Not Found")
        return

    output = StringIO()
    output_format = request.query.get('format', 'html')
    query = request.query.get('query', None)
    if output_format == 'json':
        response.content_type = "application/json"
        formats.jsonFormat(output, stat_dict, query)
    elif output_format == 'prettyjson':
        formats.jsonFormat(output, stat_dict, query, pretty=True)
        response.content_type = "application/json"
    else:
        formats.htmlHeader(output, '/' + path, server_name, query)
        formats.htmlFormat(output, tuple(parts), stat_dict, query)
        response.content_type = "text/html"

    return output.getvalue()
def bottlestats ( server_name , path = '' ) : path = path . lstrip ( '/' ) parts = path . split ( '/' ) if not parts [ 0 ] : parts = parts [ 1 : ] stat_dict = util . lookup ( scales . getStats ( ) , parts ) if stat_dict is None : abort ( 404 , "Not Found" ) return output = StringIO ( ) output_format = request . query . get ( 'format' , 'html' ) query = request . query . get ( 'query' , None ) if output_format == 'json' : response . content_type = "application/json" formats . jsonFormat ( output , stat_dict , query ) elif output_format == 'prettyjson' : formats . jsonFormat ( output , stat_dict , query , pretty = True ) response . content_type = "application/json" else : formats . htmlHeader ( output , '/' + path , server_name , query ) formats . htmlFormat ( output , tuple ( parts ) , stat_dict , query ) response . content_type = "text/html" return output . getvalue ( )
Renders a GET request, by showing this nodes stats and children.