Skip to content

Instantly share code, notes, and snippets.

View cedricbonhomme's full-sized avatar

Cédric Bonhomme cedricbonhomme

View GitHub Profile
@cedricbonhomme
cedricbonhomme / proxy_views.py
Created August 23, 2022 06:15 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers
import sys, marshal, functools, subprocess
child_script = """
import marshal, sys, types;
fn, args, kwargs = marshal.load(sys.stdin)
marshal.dump(
types.FunctionType(fn, globals())(*args, **kwargs),
sys.stdout)
"""