Last active
November 28, 2022 10:56
-
-
Save ceylanb/5ef29f61e70d7c056f22a508ef3a9054 to your computer and use it in GitHub Desktop.
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
from flask import Flask, request, send_from_directory | |
import urllib.parse | |
import logging | |
log = logging.getLogger('werkzeug') | |
log.setLevel(logging.ERROR) | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_world(): | |
data = request.args.get('callback', '') | |
error = request.args.get('error', '') | |
if data != "": | |
decoded = urllib.parse.unquote(data) | |
print("Success! data: "+decoded) | |
if error != "": | |
decoded = urllib.parse.unquote(error) | |
print("Fail! data: "+decoded) | |
return "OK!" | |
@app.route('/<path:path>') | |
def send_payload(path): | |
return send_from_directory("./", path) | |
if __name__ == '__main__': | |
app.run(host="0.0.0.0", port=80, debug=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment