キャンバス汚染の解決編

Flaskプロキシサーバを書いた python

import requests
from flask import Flask
from flask import Response

app = Flask(__name__)


@app.route('/gyazo.com/<hash>')
def gyazo(hash):
    url = f"https://gyazo.com/{hash}/thumb/400"
    r = requests.get(url, allow_redirects=True)
    r = Response(r.content, mimetype="image/png")
    r.headers['Access-Control-Allow-Origin'] = '*'
    r.headers['Cache-Control'] = 'max-age = 31536000'
    return r