# flask-proxy **Repository Path**: hEVA326/flask-proxy ## Basic Information - **Project Name**: flask-proxy - **Description**: Flask-Proxy makes it easier to create proxy pass router in Flask. - **Primary Language**: Unknown - **License**: BSD-2-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-12 - **Last Updated**: 2021-07-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Flask-Proxy Flask-Proxy makes it easier to create proxy pass router in Flask. ## Install - From PyPI: ```bash pip install Flask-Proxy ``` - Clone: ```bash git clone git@github.com:mecforlove/flask-proxy.git cd flask_proxy python setup.py install ``` ## Quick start There is a simple example to make a proxy pass for [httpbin.org](http://httpbin.org/). First, create a python file named `httpbin.py`: ```python from flask import Flask from flask_proxy import Proxy, Upstream class Httpbin(Upstream): prefix = '/httpbin' host = 'httpbin.org' routes = [{ 'url': '/get', 'methods': ['GET'], }, { 'url': '/post', 'methods': ['POST'], }] app = Flask(__name__) proxy = Proxy(app) proxy.add_upstream(Httpbin) app.run() ``` Then we just run the flask app above: ```bash $ python httpbin.py * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) ``` At last, we open another terminal and test it with curl: ```bash $ curl http://localhost:5000/httpbin/get { "args": {}, "headers": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Host": "httpbin.org", "User-Agent": "curl/7.54.0" }, "origin": "47.90.41.239", "url": "http://httpbin.org/get" } ``` Everything is done!