0

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 -
Lampard
  • 23
  • 1
  • 7
  • 1
    That's standard Flask logging. See [this](https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server) question for details on changing that. – noslenkwah Jun 08 '20 at 20:10
  • Thanks for your reply @noslenkwah ! The solution in the link works. – Lampard Jun 08 '20 at 20:18

0 Answers0