From 5f999b662eec19ac8f4548deba17de3402fcda4f Mon Sep 17 00:00:00 2001 From: Guillaume THOMAS Date: Wed, 9 May 2018 21:55:03 -0700 Subject: [PATCH] homework --- main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index bc096fbb..98b8c1a3 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ app = Flask(__name__) + def get_fact(): response = requests.get("http://unkno.com") @@ -17,12 +18,20 @@ def get_fact(): return facts[0].getText() +def post_fact(text): + fact = requests.post("http://talkobamato.me/", data={'input_text': text}) + return fact.url + + @app.route('/') def home(): - return "FILL ME!" + text = get_fact() + return post_fact(text) if __name__ == "__main__": port = int(os.environ.get("PORT", 6787)) app.run(host='0.0.0.0', port=port) + +