aboutsummaryrefslogtreecommitdiffstats
path: root/examples/upsidedownternet.py
blob: aaf8ff749384e1b3b90019b3b971630e7eec8127 (plain)
1
2
3
4
5
6
7
8
import Image, cStringIO
def response(context, flow):
    if flow.response.headers["content-type"] == ["image/png"]:
        s = cStringIO.StringIO(flow.response.content)
        img = Image.open(s).rotate(180)
        s2 = cStringIO.StringIO()
        img.save(s2, "png")
        flow.response.content = s2.getvalue()