aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/web
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-05-30 12:03:28 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-05-30 12:03:28 +1200
commita05a70d8168a07c92b2a3ecbbb1958d85532efe3 (patch)
treebc2cc0b89d05e8213280a460cbf25978583c8337 /libmproxy/web
parent1a106f4080d89a236a193f2cb007a00aa195a1ad (diff)
downloadmitmproxy-a05a70d8168a07c92b2a3ecbbb1958d85532efe3.tar.gz
mitmproxy-a05a70d8168a07c92b2a3ecbbb1958d85532efe3.tar.bz2
mitmproxy-a05a70d8168a07c92b2a3ecbbb1958d85532efe3.zip
Add coding style check, reformat.
Diffstat (limited to 'libmproxy/web')
-rw-r--r--libmproxy/web/__init__.py9
-rw-r--r--libmproxy/web/app.py9
2 files changed, 11 insertions, 7 deletions
diff --git a/libmproxy/web/__init__.py b/libmproxy/web/__init__.py
index 7016eeb8..a0af7315 100644
--- a/libmproxy/web/__init__.py
+++ b/libmproxy/web/__init__.py
@@ -79,6 +79,7 @@ class WebState(flow.State):
data=[]
)
+
class Options(object):
attributes = [
"app",
@@ -128,15 +129,14 @@ class WebMaster(flow.FlowMaster):
if options.rfile:
try:
self.load_flows_file(options.rfile)
- except flow.FlowReadError, v:
+ except flow.FlowReadError as v:
self.add_event(
- "Could not read flow file: %s"%v,
+ "Could not read flow file: %s" % v,
"error"
)
if self.options.app:
self.start_app(self.options.app_host, self.options.app_port)
-
def tick(self):
flow.FlowMaster.tick(self, self.masterq, timeout=0)
@@ -157,7 +157,8 @@ class WebMaster(flow.FlowMaster):
self.shutdown()
def _process_flow(self, f):
- if self.state.intercept and self.state.intercept(f) and not f.request.is_replay:
+ if self.state.intercept and self.state.intercept(
+ f) and not f.request.is_replay:
f.intercept(self)
else:
f.reply()
diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py
index 9582d97b..69341e76 100644
--- a/libmproxy/web/app.py
+++ b/libmproxy/web/app.py
@@ -27,7 +27,8 @@ class RequestHandler(tornado.web.RequestHandler):
@property
def json(self):
- if not self.request.headers.get("Content-Type").startswith("application/json"):
+ if not self.request.headers.get(
+ "Content-Type").startswith("application/json"):
return None
return json.loads(self.request.body)
@@ -67,8 +68,10 @@ class FiltHelp(RequestHandler):
commands=filt.help
))
+
class WebSocketEventBroadcaster(tornado.websocket.WebSocketHandler):
- connections = None # raise an error if inherited class doesn't specify its own instance.
+ # raise an error if inherited class doesn't specify its own instance.
+ connections = None
def open(self):
self.connections.add(self)
@@ -264,4 +267,4 @@ class Application(tornado.web.Application):
cookie_secret=os.urandom(256),
debug=debug,
)
- super(Application, self).__init__(handlers, **settings) \ No newline at end of file
+ super(Application, self).__init__(handlers, **settings)