Skip to content

Instantly share code, notes, and snippets.

@kig-odoo
Last active April 4, 2018 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kig-odoo/194c02ea544d5401f81a86aa3f3cc535 to your computer and use it in GitHub Desktop.
Save kig-odoo/194c02ea544d5401f81a86aa3f3cc535 to your computer and use it in GitHub Desktop.
@http.route('/web_editor/get_cross_origin_img', type='http', auth='user')
def get_cross_origin_img(self, url):
content = requests.get(url, stream=True)
# validate here for image size and type from content.headers
return request.make_response(content.raw, headers=[('Content-Type', content.headers.get('Content-Type', 'image/png'))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment