aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/app.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-30 09:46:49 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-30 09:46:49 +1200
commit24b0acbfab0e6fcc65c2fc3ff924a1df3d72fa92 (patch)
tree82ce39a2d0daa28d432523e9ac0ccd09faedf47a /libpathod/app.py
parent5d6bd3291edb690a80bcbc8183995343fbd910f4 (diff)
downloadmitmproxy-24b0acbfab0e6fcc65c2fc3ff924a1df3d72fa92.tar.gz
mitmproxy-24b0acbfab0e6fcc65c2fc3ff924a1df3d72fa92.tar.bz2
mitmproxy-24b0acbfab0e6fcc65c2fc3ff924a1df3d72fa92.zip
Log retrieval API.
Diffstat (limited to 'libpathod/app.py')
-rw-r--r--libpathod/app.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/libpathod/app.py b/libpathod/app.py
index fbb99dc4..7059f9ba 100644
--- a/libpathod/app.py
+++ b/libpathod/app.py
@@ -2,6 +2,16 @@ import urllib, pprint
import tornado.web, tornado.template, tornado.ioloop, tornado.httpserver
import rparse, utils
+
+class APILog(tornado.web.RequestHandler):
+ def get(self):
+ self.write(
+ dict(
+ d = self.application.get_log()
+ )
+ )
+
+
class _Page(tornado.web.RequestHandler):
def render(self, name, **kwargs):
tornado.web.RequestHandler.render(self, name + ".html", **kwargs)
@@ -118,6 +128,7 @@ class PathodApp(tornado.web.Application):
(r"/log/([0-9]+)", OneLog),
(r"/help", Help),
(r"/preview", Preview),
+ (r"/api/log", APILog),
(r"/p/.*", RequestPathod, settings),
],
static_path = utils.data.path("static"),
@@ -179,9 +190,12 @@ class PathodApp(tornado.web.Application):
if i["id"] == id:
return i
- def clear_logs(self):
+ def clear_log(self):
self.log = []
+ def get_log(self):
+ return self.log
+
# begin nocover
def run(application, port, ssl_options):