diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-15 00:34:23 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-02-15 00:54:14 +0100 |
commit | 8a6f8bd461af46d5006a6e3756277af416162262 (patch) | |
tree | f54400e7bbb01e52f8f85e3f1019690d6a6c6151 | |
parent | bb2fa6dc7d871d703c6759926521d8c16aae80f1 (diff) | |
download | mitmproxy-8a6f8bd461af46d5006a6e3756277af416162262.tar.gz mitmproxy-8a6f8bd461af46d5006a6e3756277af416162262.tar.bz2 mitmproxy-8a6f8bd461af46d5006a6e3756277af416162262.zip |
nuke Pillow
-rw-r--r-- | docs/install.rst | 4 | ||||
-rw-r--r-- | mitmproxy/contentviews/image/view.py | 24 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/__init__.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/image/test_view.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_http2.py | 2 |
6 files changed, 4 insertions, 30 deletions
diff --git a/docs/install.rst b/docs/install.rst index b9524897..c90eaf9f 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -85,7 +85,7 @@ libraries. This was tested on a fully patched installation of Ubuntu 16.04. .. code:: bash - sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev + sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev zlib1g-dev sudo pip3 install mitmproxy # or pip3 install --user mitmproxy On older Ubuntu versions, e.g., **12.04** and **14.04**, you may need to install @@ -104,7 +104,7 @@ libraries. This was tested on a fully patched installation of Fedora 24. .. code:: bash - sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel libtiff-devel libjpeg-devel zlib-devel libwebp-devel openjpeg2-devel + sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel zlib-devel sudo pip3 install mitmproxy # or pip3 install --user mitmproxy Make sure to have an up-to-date version of pip by running ``pip3 install -U pip``. diff --git a/mitmproxy/contentviews/image/view.py b/mitmproxy/contentviews/image/view.py index 8fdb26e9..d77e1ecb 100644 --- a/mitmproxy/contentviews/image/view.py +++ b/mitmproxy/contentviews/image/view.py @@ -1,13 +1,9 @@ -import io import imghdr -from PIL import Image - +from mitmproxy.contentviews import base from mitmproxy.types import multidict from . import image_parser -from mitmproxy.contentviews import base - class ViewImage(base.View): name = "Image" @@ -16,8 +12,6 @@ class ViewImage(base.View): "image/png", "image/jpeg", "image/gif", - "image/vnd.microsoft.icon", - "image/x-icon", ] def __call__(self, data, **metadata): @@ -37,19 +31,3 @@ class ViewImage(base.View): parts = image_parser.parse_jpeg(data) fmt = base.format_dict(multidict.MultiDict(parts)) return "%s image" % f, fmt - try: - img = Image.open(io.BytesIO(data)) - except IOError: - return None - parts = [ - ("Format", str(img.format_description)), - ("Size", "%s x %s px" % img.size), - ("Mode", str(img.mode)), - ] - for i in sorted(img.info.keys()): - if i != "exif": - parts.append( - (str(i), str(img.info[i])) - ) - fmt = base.format_dict(multidict.MultiDict(parts)) - return "%s image" % img.format, fmt @@ -71,7 +71,6 @@ setup( "hyperframe>=4.0.1, <5", "jsbeautifier>=1.6.3, <1.7", "kaitaistruct>=0.6, <0.7", - "Pillow>=3.2, <4.1", "passlib>=1.6.5, <1.8", "pyasn1>=0.1.9, <0.3", "pyOpenSSL>=16.0, <17.0", @@ -118,6 +117,7 @@ setup( 'examples': [ "beautifulsoup4>=4.4.1, <4.6", "pytz>=2015.07.0, <=2016.10", + "Pillow>=3.2, <4.1", ] } ) diff --git a/test/mitmproxy/__init__.py b/test/mitmproxy/__init__.py index 28dc133f..6f114e18 100644 --- a/test/mitmproxy/__init__.py +++ b/test/mitmproxy/__init__.py @@ -3,5 +3,4 @@ import logging logging.getLogger("hyper").setLevel(logging.WARNING) logging.getLogger("requests").setLevel(logging.WARNING) logging.getLogger("passlib").setLevel(logging.WARNING) -logging.getLogger("PIL").setLevel(logging.WARNING) logging.getLogger("tornado").setLevel(logging.WARNING) diff --git a/test/mitmproxy/contentviews/image/test_view.py b/test/mitmproxy/contentviews/image/test_view.py index ee2f9eaa..84bcea17 100644 --- a/test/mitmproxy/contentviews/image/test_view.py +++ b/test/mitmproxy/contentviews/image/test_view.py @@ -9,7 +9,6 @@ def test_view_image(): "mitmproxy/data/image.png", "mitmproxy/data/image.gif", "mitmproxy/data/all.jpeg", - "mitmproxy/data/image.ico" ]: with open(tutils.test_data.path(img), "rb") as f: assert v(f.read()) diff --git a/test/mitmproxy/proxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py index f5d9259d..cede0b80 100644 --- a/test/mitmproxy/proxy/protocol/test_http2.py +++ b/test/mitmproxy/proxy/protocol/test_http2.py @@ -23,8 +23,6 @@ logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING) logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.WARNING) logging.getLogger("passlib.utils.compat").setLevel(logging.WARNING) logging.getLogger("passlib.registry").setLevel(logging.WARNING) -logging.getLogger("PIL.Image").setLevel(logging.WARNING) -logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING) # inspect the log: |