Created
July 7, 2024 00:11
-
-
Save saintplay/43214141c9d5942468ada9eb8d8767dd to your computer and use it in GitHub Desktop.
Proxy a request to a different hostname with same args/params
This file contains 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
@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