Created
January 16, 2021 18:33
-
-
Save mthri/cfddd1440228e8af40e24629adc91af4 to your computer and use it in GitHub Desktop.
Proxy Some URL with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from flask import Flask | |
app = Flask(__name__) | |
TARGET_URL = '' | |
@app.route('/') | |
def index(): | |
request = requests.get(TARGET_URL) | |
return request.text | |
@app.route('/<path:path>', methods=['GET', 'POST']) | |
def catch_all(path): | |
request = requests.get(TARGET_URL + '/' + path) | |
return request.text | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment