I want to use a perfecely simple flask (v=1.0.2) app to subscribe to a PubSub hub, where the hub would send a GET
request containing a challenge
string, and my flask app is suppose to return the string and do nothing more. However, it keeps outputting a messy line at the end, which I assume to be info on the GET
request itself, and I am having difficulty understanding how it comes about. Could anyone explain how I can get rid of it please? My codes and the output are below. Thanks a lot.
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=["GET", "POST"])
def index():
# get request used to subscribe to webhook
if request.method == 'GET':
print(datetime.datetime.now())
challenge = request.args['hub.challenge']
return challenge
if __name__ == '__main__':
app.run(host='0.0.0.0', port="80")
The output lines are below, and I would like to get rid of the 2nd line please:
2020-06-08 15:38:30.135647
198.12.103.36 - - [08/Jun/2020 15:38:30] "[37mGET /?hub.mode=subscribe&hub.topic=https%3A%2F%2Fblog.xxx.com%2Ffeed&hub.challenge=u9bs6yja251eeraa714i&hub.lease_seconds=1296000 HTTP/1.1[0m" 200 -