From a88ddf8ecd0eaaf6998dc10e336d4246886a32bb Mon Sep 17 00:00:00 2001 From: GerardoP Date: Mon, 2 Nov 2020 20:50:16 -0800 Subject: [PATCH 1/3] Update requirements.txt --- requirements.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0ade18d..5b137ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,18 @@ -beautifulsoup4==4.6.0 -certifi==2018.4.16 -chardet==3.0.4 -click==6.7 -Flask==1.0.1 -idna==2.6 -itsdangerous==0.24 -Jinja2==2.10 -MarkupSafe==1.0 -requests==2.18.4 -urllib3==1.22 -Werkzeug==0.14.1 +Package Version +-------------- --------- +beautifulsoup4 4.9.3 +certifi 2020.6.20 +chardet 3.0.4 +click 7.1.2 +Flask 1.1.2 +idna 2.10 +itsdangerous 1.1.0 +Jinja2 2.11.2 +MarkupSafe 1.1.1 +pip 20.1.1 +requests 2.24.0 +setuptools 50.2.0 +soupsieve 2.0.1 +urllib3 1.25.11 +Werkzeug 1.0.1 +wheel 0.35.1 From fe36662b59492b2dd7daaf18817b99f7b14ea8c5 Mon Sep 17 00:00:00 2001 From: GerardoP Date: Tue, 3 Nov 2020 10:29:02 -0800 Subject: [PATCH 2/3] Add get_link function. --- main.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index bc096fb..396f6d3 100644 --- a/main.py +++ b/main.py @@ -8,21 +8,26 @@ def get_fact(): - response = requests.get("http://unkno.com") - soup = BeautifulSoup(response.content, "html.parser") facts = soup.find_all("div", id="content") - return facts[0].getText() +def get_link(fact): + response = requests.post('https://hidden-journey-62459.herokuapp.com/piglatinize/', + data={'input_text': fact}, allow_redirects=False) + return response.headers['Location'] + + @app.route('/') def home(): - return "FILL ME!" + fact = get_fact().strip() + link = get_link(fact) + body = f'{link}' + return Response(response=body, mimetype='text/html') if __name__ == "__main__": port = int(os.environ.get("PORT", 6787)) app.run(host='0.0.0.0', port=port) - From 8a8cc02292b5d3892229fc058a7298b0104a3bcd Mon Sep 17 00:00:00 2001 From: GerardoP Date: Tue, 3 Nov 2020 10:33:01 -0800 Subject: [PATCH 3/3] Update requirements.txt --- requirements.txt | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5b137ac..1cc2e11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,18 +1,23 @@ -Package Version --------------- --------- -beautifulsoup4 4.9.3 -certifi 2020.6.20 -chardet 3.0.4 -click 7.1.2 -Flask 1.1.2 -idna 2.10 -itsdangerous 1.1.0 -Jinja2 2.11.2 -MarkupSafe 1.1.1 -pip 20.1.1 -requests 2.24.0 -setuptools 50.2.0 -soupsieve 2.0.1 -urllib3 1.25.11 -Werkzeug 1.0.1 -wheel 0.35.1 +astroid==2.4.2 +autopep8==1.5.4 +beautifulsoup4==4.9.3 +certifi==2020.6.20 +chardet==3.0.4 +click==7.1.2 +Flask==1.1.2 +idna==2.10 +isort==5.6.4 +itsdangerous==1.1.0 +Jinja2==2.11.2 +lazy-object-proxy==1.4.3 +MarkupSafe==1.1.1 +mccabe==0.6.1 +pycodestyle==2.6.0 +pylint==2.6.0 +requests==2.24.0 +six==1.15.0 +soupsieve==2.0.1 +toml==0.10.2 +urllib3==1.25.11 +Werkzeug==1.0.1 +wrapt==1.12.1