Start script


#1

Hello guys! I try to start a script and implement a new pictures to websites and rotate them, can you please have a look and see if its correct?
#! /usr/bin/Python3

modify_response.py

import sys
import os
from io import StringIO
from mitmproxy.net.http import encoding
from mitmproxy.net.http import headers
from mitmproxy.net import http
from PIL.Image import core as _imaging
from PIL.Image import Image
def response(flow):
if flow.response.headers.get(“content-type”, “”).startswith(“img”):
img = open(“140615222725.png”, “rb”).read()
img = Image.open(“140615222725.png”)
img.rotate(90).show()
flow.response.content = img
flow.response.headers[“content-type”] = “image/png”