epitron/mitm-adblock

ImportError: cannot import name HTTPResponse

jacekjaros opened this issue · 6 comments

OS Debian 9.0
mitmproxy 0.18.2-6
Python 2.7.13

# ./go --help
* Starting proxy server on port 8118...
Loading script: adblock.py
Script error: Traceback (most recent call last):
  File "adblock.py", line 10, in <module>
    from mitmproxy.protocol.http import HTTPResponse
ImportError: cannot import name HTTPResponse

Hmm... it looks like mitmproxy reorganized their library. Try changing that line to:

from mitmproxy.http import HTTPResponse

@epitron

Why not freeze python requirement?
Using pip freeze > requirements.txt, and upload requirements.txt to GitHub. If someone wants to install mitm-adblock, he just run pip install -r requirements.txt.

That's a good idea, @zqhong; I'll add one of those.

Script error: Traceback (most recent call last):
File "adblock.py", line 10, in
from mitmproxy.http import HTTPResponse
ImportError: No module named http

im geting the same error but the line

from mitmproxy.http import HTTPResponse

is ok

any hints ?

please see #4 where requirements.txt is added and whole tool is fixed to work with most recent version of mitmproxy (5.1.1)

obviously you can test it on my fork

Nice! Thanks, @szborows!