Mercurial > code > home > repos > light9
view light9/greplin_cyclone.py @ 1070:b281ee32c785
use Pillow. make vidref start up
Ignore-this: 52ba5ec2409bbf446c7592d3646220ad
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 02 Jun 2014 07:46:55 +0000 |
parents | 9937e2e3d17b |
children | 7772cc48e016 |
line wrap: on
line source
import cyclone.web, cyclone.websocket, cyclone.httpclient import greplin.scales.twistedweb, greplin.scales.formats from greplin import scales # Like scales.twistedweb.StatsResource, but modified for cyclone. May # be missing features. class StatsForCyclone(cyclone.web.RequestHandler): def get(self): parts = [] statDict = greplin.scales.twistedweb.util.lookup(scales.getStats(), parts) if statDict is None: self.set_status(404) self.write("Path not found.") return query = self.get_argument('query', default=None) if self.get_argument('format', default=None) == 'json': self.set_header('content-type', 'text/javascript; charset=UTF-8') greplin.scales.formats.jsonFormat(self, statDict, query) elif self.get_argument('format', default=None) == 'prettyjson': self.set_header('content-type', 'text/javascript; charset=UTF-8') greplin.scales.formats.jsonFormat(self, statDict, query, pretty=True) else: greplin.scales.formats.htmlHeader(self, '/' + '/'.join(parts), 'svr', query) greplin.scales.formats.htmlFormat(self, tuple(parts), statDict, query)