aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-06-19 12:00:37 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-06-19 12:00:37 +0200
commit7bde38dc4a8041e60daeddfea4c581fb90f0e192 (patch)
tree4d72157970aa6e60e62472e55e1b18c7c079db5c /mitmproxy
parent5c0161886ae03dcd3b4cfc726c7a53408cdb5d71 (diff)
downloadmitmproxy-7bde38dc4a8041e60daeddfea4c581fb90f0e192.tar.gz
mitmproxy-7bde38dc4a8041e60daeddfea4c581fb90f0e192.tar.bz2
mitmproxy-7bde38dc4a8041e60daeddfea4c581fb90f0e192.zip
py3++
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/controller.py9
-rw-r--r--mitmproxy/platform/osx.py2
-rw-r--r--mitmproxy/tnetstring.py4
3 files changed, 8 insertions, 7 deletions
diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py
index 898be3bc..a170d868 100644
--- a/mitmproxy/controller.py
+++ b/mitmproxy/controller.py
@@ -6,7 +6,8 @@ import threading
from six.moves import queue
from netlib import basethread
-from mitmproxy import exceptions
+
+from . import exceptions
Events = frozenset([
@@ -76,9 +77,9 @@ class Master(object):
if mtype not in Events:
raise exceptions.ControlException("Unknown event %s" % repr(mtype))
handle_func = getattr(self, mtype)
- if not hasattr(handle_func, "func_dict"):
+ if not hasattr(handle_func, "__dict__"):
raise exceptions.ControlException("Handler %s not a function" % mtype)
- if not handle_func.func_dict.get("__handler"):
+ if not handle_func.__dict__.get("__handler"):
raise exceptions.ControlException(
"Handler function %s is not decorated with controller.handler" % (
handle_func
@@ -177,7 +178,7 @@ def handler(f):
message.reply.ack()
return ret
# Mark this function as a handler wrapper
- wrapper.func_dict["__handler"] = True
+ wrapper.__dict__["__handler"] = True
return wrapper
diff --git a/mitmproxy/platform/osx.py b/mitmproxy/platform/osx.py
index b16c1861..b5dce793 100644
--- a/mitmproxy/platform/osx.py
+++ b/mitmproxy/platform/osx.py
@@ -1,6 +1,6 @@
import subprocess
-import pf
+from . import pf
"""
Doing this the "right" way by using DIOCNATLOOK on the pf device turns out
diff --git a/mitmproxy/tnetstring.py b/mitmproxy/tnetstring.py
index 6b1c117a..f40e8ad8 100644
--- a/mitmproxy/tnetstring.py
+++ b/mitmproxy/tnetstring.py
@@ -130,7 +130,7 @@ def _rdumpq(q, size, value, encoding=None):
if value is False:
write("5:false!")
return size + 8
- if isinstance(value, (int, long)):
+ if isinstance(value, six.integer_types):
data = str(value)
ldata = len(data)
span = str(ldata)
@@ -208,7 +208,7 @@ def _gdumps(value, encoding):
yield "4:true!"
elif value is False:
yield "5:false!"
- elif isinstance(value, (int, long)):
+ elif isinstance(value, six.integer_types):
data = str(value)
yield str(len(data))
yield ":"