Skip to content

Instantly share code, notes, and snippets.

@saintplay
Created July 7, 2024 00:11
Show Gist options
  • Save saintplay/43214141c9d5942468ada9eb8d8767dd to your computer and use it in GitHub Desktop.
Save saintplay/43214141c9d5942468ada9eb8d8767dd to your computer and use it in GitHub Desktop.
Proxy a request to a different hostname with same args/params
@api_blueprint.route("/api/endpoint")
def get_endpoint():
# TODO: There is no need to write the path again
response = requests.get("https://new.hostname.com/api/endpoint", params=request.args)
response = jsonify(response.json())
return response
@api_blueprint.route("/api/endpoint", methods=["POST"])
def post_endpoint()
# TODO: Implement proxied request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment