Skip to content

Instantly share code, notes, and snippets.

@mthri
Created January 16, 2021 18:33
Show Gist options
  • Save mthri/cfddd1440228e8af40e24629adc91af4 to your computer and use it in GitHub Desktop.
Save mthri/cfddd1440228e8af40e24629adc91af4 to your computer and use it in GitHub Desktop.
Proxy Some URL with Python
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