From 1f219a1f94aedcef1cd859d3c630c0df488399f0 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 2 Apr 2020 10:45:16 -0300 Subject: [PATCH 01/17] pip install libs Flask and lxml --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index d10eb5f85f..120aeaf5e2 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,8 @@ Execute o server.py e conecte no endereço (ex.: http://127.0.0.1:5000/) com seu # Requirements Flask lxml + +# Comand install + + `pip install Flask` + `pip install lxml` From 389380bad4f9dd011babe5437729cdd9ac710f2b Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 2 Apr 2020 10:45:49 -0300 Subject: [PATCH 02/17] pip install --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 120aeaf5e2..cf4035c37a 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,5 @@ Execute o server.py e conecte no endereço (ex.: http://127.0.0.1:5000/) com seu # Comand install `pip install Flask` + `pip install lxml` From 2b764b056a5a80ece18998ce39bb185d3572528f Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 2 Apr 2020 12:44:50 -0300 Subject: [PATCH 03/17] install libs --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index cf4035c37a..a4b88ff80a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ principais indicadores fundamentalistas em formato JSON. A API utiliza o microframework Flask. Também é possível utilizar via linha de comando. +# Instalar as bibliotecas + `pip3 install -r required.txt` + # Linha de comando $ python3 fundamentus.py From 0cb1ad5ff45dc138e7d8993b84200a9700a4b00c Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 2 Apr 2020 12:45:33 -0300 Subject: [PATCH 04/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4b88ff80a..7ca6578b76 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A API utiliza o microframework Flask. Também é possível utilizar via linha de comando. # Instalar as bibliotecas - `pip3 install -r required.txt` + pip3 install -r required.txt # Linha de comando $ python3 fundamentus.py From 965d7141325e3b4798c0e0c562f2b9f9351d4929 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 2 Apr 2020 12:45:57 -0300 Subject: [PATCH 05/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ca6578b76..1dda787cb7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A API utiliza o microframework Flask. Também é possível utilizar via linha de comando. # Instalar as bibliotecas - pip3 install -r required.txt + $ pip3 install -r required.txt # Linha de comando $ python3 fundamentus.py From cbd017976864cb3f1c947dfe8f197ab36aafe238 Mon Sep 17 00:00:00 2001 From: Guiller Date: Wed, 8 Apr 2020 17:25:55 -0300 Subject: [PATCH 06/17] Create productionmode.md --- productionmode.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 productionmode.md diff --git a/productionmode.md b/productionmode.md new file mode 100644 index 0000000000..b794a30649 --- /dev/null +++ b/productionmode.md @@ -0,0 +1 @@ +### Install de APP server api in production mode From ad4650ea7174d00125f763eaca5b37fd3fc8838e Mon Sep 17 00:00:00 2001 From: Guiller Date: Wed, 8 Apr 2020 17:30:51 -0300 Subject: [PATCH 07/17] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1dda787cb7..e753e4581c 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,14 @@ Também é possível utilizar via linha de comando. # Linha de comando $ python3 fundamentus.py - + +# Acionar a aplicação + $ python3 server.py + # API -Execute o server.py e conecte no endereço (ex.: http://127.0.0.1:5000/) com seu browser +Então acesse o endereço (ex.: http://127.0.0.1:5000/) com seu browser -# Requirements +# Requirements Libs Flask lxml From 21cc980a626db1ca4839b1b2447f796d07fc64c1 Mon Sep 17 00:00:00 2001 From: Guiller Date: Wed, 8 Apr 2020 17:32:34 -0300 Subject: [PATCH 08/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e753e4581c..e082dcb611 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Então acesse o endereço (ex.: http://127.0.0.1:5000/) com seu browser Flask lxml -# Comand install +# Comands install libs `pip install Flask` From 4d0a36070fb0dfddcb80ef13bc6b6cfec6d75918 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 13:39:10 -0300 Subject: [PATCH 09/17] Update productionmode.md --- productionmode.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/productionmode.md b/productionmode.md index b794a30649..a83b08b85a 100644 --- a/productionmode.md +++ b/productionmode.md @@ -1 +1,4 @@ ### Install de APP server api in production mode + +# Tutorial de implementação no Heroku +https://www.youtube.com/watch?v=B8IrK2H9WkM From 0a68b654b1766d36896e3473a86d75ec0d3644fe Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 13:39:56 -0300 Subject: [PATCH 10/17] Update productionmode.md --- productionmode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/productionmode.md b/productionmode.md index a83b08b85a..c396e2f62a 100644 --- a/productionmode.md +++ b/productionmode.md @@ -1,4 +1,4 @@ -### Install de APP server api in production mode +# Instalar a aplicação em modo de produção em um servidor na nuvem! -# Tutorial de implementação no Heroku +### Tutorial de implementação no Heroku https://www.youtube.com/watch?v=B8IrK2H9WkM From 97b67ded5a48968d3811266fb71dc3bcd3095f08 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 14:07:55 -0300 Subject: [PATCH 11/17] Update productionmode.md --- productionmode.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/productionmode.md b/productionmode.md index c396e2f62a..6db9d29fd6 100644 --- a/productionmode.md +++ b/productionmode.md @@ -2,3 +2,6 @@ ### Tutorial de implementação no Heroku https://www.youtube.com/watch?v=B8IrK2H9WkM + +### Repositório configurado para deploy no Heroku +https://github.com/phoemur/fundamentus From 1dd2fd786401090f5729b8b262042c4e6a68a427 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 14:38:36 -0300 Subject: [PATCH 12/17] Update productionmode.md --- productionmode.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/productionmode.md b/productionmode.md index 6db9d29fd6..5e6743b583 100644 --- a/productionmode.md +++ b/productionmode.md @@ -4,4 +4,4 @@ https://www.youtube.com/watch?v=B8IrK2H9WkM ### Repositório configurado para deploy no Heroku -https://github.com/phoemur/fundamentus +https://github.com/carromeu/fundamentus From 49e0860abc46c198aba3e8a30119bcac0358fd65 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 14:57:25 -0300 Subject: [PATCH 13/17] Update server.py --- server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.py b/server.py index d4b7c8a155..4e54704f9d 100755 --- a/server.py +++ b/server.py @@ -3,8 +3,11 @@ from flask import Flask, jsonify from fundamentus import get_data from datetime import datetime +from flask_cors import CORS, cross_origin app = Flask(__name__) +CORS(app) + # First update lista, dia = dict(get_data()), datetime.strftime(datetime.today(), '%d') From e14d18d9e07c3be1a8462eb549093d6658441b79 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 15:00:17 -0300 Subject: [PATCH 14/17] Update required.txt --- required.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/required.txt b/required.txt index 6fefa8a73f..98acd12728 100644 --- a/required.txt +++ b/required.txt @@ -5,3 +5,4 @@ Jinja2>=2.10.1 lxml>=4.0.0 MarkupSafe>=1.0.0 Werkzeug>=1.0.0 +flask_cors==3.0.3 From 35155a906fbd9c6d34ac447ae70efe8f062e4cbb Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 15:01:44 -0300 Subject: [PATCH 15/17] Update server.py --- server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 4e54704f9d..c0fcb01432 100755 --- a/server.py +++ b/server.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os from flask import Flask, jsonify from fundamentus import get_data from datetime import datetime @@ -25,4 +26,6 @@ def json_api(): lista = {outer_k: {inner_k: float(inner_v) for inner_k, inner_v in outer_v.items()} for outer_k, outer_v in lista.items()} return jsonify(lista) -app.run(debug=True) +port = int(os.environ.get('PORT', 5000)) + +app.run(debug=True, host='0.0.0.0', port=port) From 44fde32bdbeed66cc788d9a07a0220494252d1b8 Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 15:11:43 -0300 Subject: [PATCH 16/17] Delete productionmode.md --- productionmode.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 productionmode.md diff --git a/productionmode.md b/productionmode.md deleted file mode 100644 index 5e6743b583..0000000000 --- a/productionmode.md +++ /dev/null @@ -1,7 +0,0 @@ -# Instalar a aplicação em modo de produção em um servidor na nuvem! - -### Tutorial de implementação no Heroku -https://www.youtube.com/watch?v=B8IrK2H9WkM - -### Repositório configurado para deploy no Heroku -https://github.com/carromeu/fundamentus From f3b7886917791ad5f03596ef83587f4989d03b2f Mon Sep 17 00:00:00 2001 From: Guiller Date: Thu, 9 Apr 2020 15:12:41 -0300 Subject: [PATCH 17/17] Update README.md --- README.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e082dcb611..5cfcfd7847 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,15 @@ principais indicadores fundamentalistas em formato JSON. A API utiliza o microframework Flask. Também é possível utilizar via linha de comando. -# Instalar as bibliotecas - $ pip3 install -r required.txt - # Linha de comando $ python3 fundamentus.py - -# Acionar a aplicação - $ python3 server.py - + # API -Então acesse o endereço (ex.: http://127.0.0.1:5000/) com seu browser +Execute o server.py e conecte no endereço (ex.: http://127.0.0.1:5000/) com seu browser -# Requirements Libs +# Requirements Flask lxml -# Comands install libs - - `pip install Flask` - - `pip install lxml` +Install with: + pip3 install -r required.txt