mirror of https://github.com/interlegis/sapl.git
ulyssesBML
5 years ago
committed by
Edward Ribeiro
14 changed files with 86 additions and 23 deletions
@ -0,0 +1,49 @@ |
|||||
|
from flask import Flask |
||||
|
import requests |
||||
|
import psycopg2 |
||||
|
import json |
||||
|
from sapl.settings import DATABASES, USE_SOLR, SOLR_URL |
||||
|
|
||||
|
|
||||
|
app = Flask(__name__) |
||||
|
|
||||
|
|
||||
|
@app.route('/health') |
||||
|
def health(): |
||||
|
try: |
||||
|
db = DATABASES['default'] |
||||
|
conn = psycopg2.connect(host=db['HOST'], |
||||
|
user=db['USER'], |
||||
|
password=db['PASSWORD'], |
||||
|
database=db['NAME'], |
||||
|
port=db['PORT']) |
||||
|
cursor = conn.cursor() |
||||
|
cursor.execute("SELECT 1;") |
||||
|
resp = {'DATABASE': 'OK'} |
||||
|
except Exception as e: |
||||
|
resp = {'DATABASE': 'ERROR'} |
||||
|
finally: |
||||
|
if cursor: |
||||
|
cursor.close() |
||||
|
conn.close() |
||||
|
|
||||
|
if USE_SOLR: |
||||
|
r = requests.get(SOLR_URL) |
||||
|
if r.ok: |
||||
|
resp.update({'SEARCH_ENGINE': 'OK'}) |
||||
|
else: |
||||
|
resp.update({'SEARCH_ENGINE': 'ERROR'}) |
||||
|
|
||||
|
else: |
||||
|
resp.update({'SEARCH_ENGINE': 'NOT_ENABLED'}) |
||||
|
|
||||
|
return json.dumps(resp) |
||||
|
|
||||
|
|
||||
|
@app.route('/ping') |
||||
|
def ping(): |
||||
|
return "pong" |
||||
|
|
||||
|
|
||||
|
if __name__ == '__main__': |
||||
|
app.run() |
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
!function(e){function a(a){for(var t,o,i=a[0],u=a[1],l=a[2],p=0,f=[];p<i.length;p++)o=i[p],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&f.push(n[o][0]),n[o]=0;for(t in u)Object.prototype.hasOwnProperty.call(u,t)&&(e[t]=u[t]);for(c&&c(a);f.length;)f.shift()();return s.push.apply(s,l||[]),r()}function r(){for(var e,a=0;a<s.length;a++){for(var r=s[a],t=!0,i=1;i<r.length;i++){var u=r[i];0!==n[u]&&(t=!1)}t&&(s.splice(a--,1),e=o(o.s=r[0]))}return e}var t={},n={parlamentar:0},s=[];function o(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,a,r){o.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,a){if(1&a&&(e=o(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var t in e)o.d(r,t,function(a){return e[a]}.bind(null,t));return r},o.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(a,"a",a),a},o.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},o.p="/static/sapl/frontend/";var i=window.webpackJsonp=window.webpackJsonp||[],u=i.push.bind(i);i.push=a,i=i.slice();for(var l=0;l<i.length;l++)a(i[l]);var c=u;s.push([3,"chunk-vendors"]),r()}({3:function(e,a,r){e.exports=r("71e4")},"49c2":function(e,a,r){},"71e4":function(e,a,r){"use strict";r.r(a),function(e){r("cadf"),r("551c"),r("f751"),r("097d"),r("49c2");var a=r("a026"),t=r("44d4"),n=r("bc3a"),s=r.n(n);s.a.defaults.xsrfCookieName="csrftoken",s.a.defaults.xsrfHeaderName="X-CSRFToken",a.a.use(t.a),new a.a({delimiters:["[[","]]"],el:"#app2",data:function(){return{nome_pesquisa:"",is_pesquisa:!1,legislatura_selecionada:"",legislaturas:[],parlamentares:[]}},watch:{nome_pesquisa:function(e){this.debouncepesquisaParlamentar()}},created:function(){this.debouncepesquisaParlamentar=e.debounce(this.pesquisaParlamentar,500)},methods:{getParlamentares:function(e){var a=this;this.legislatura_selecionada&&s.a.get("/api/parlamentares/parlamentar/"+this.legislatura_selecionada+"/parlamentares_by_legislatura/").then((function(e){a.parlamentares=e.data})).catch((function(e){console.error("Ocorreu um erro ao obter os dados de parlamentares:"+e)}))},pesquisaParlamentar:function(e){var a=this;s.a.get("/api/parlamentares/parlamentar/search_parlamentares/",{params:{nome_parlamentar:this.nome_pesquisa}}).then((function(e){a.parlamentares=e.data})).catch((function(e){console.error("Erro ao procurar parlamentar:"+e)}))},pesquisaChange:function(e){this.is_pesquisa=!this.is_pesquisa,this.is_pesquisa?this.parlamentares=[]:this.getParlamentares()}},mounted:function(){var e=this;s.a.get("/api/parlamentares/legislatura/").then((function(a){e.legislaturas=a.data.results,e.legislatura_selecionada=a.data.results[0].id})).then((function(a){e.getParlamentares()})).catch((function(e){console.error("Ocorreu um erro ao obter os dados de legislação: "+e)}))}})}.call(this,r("2ef0"))}}); |
Binary file not shown.
@ -1 +1 @@ |
|||||
{"status":"done","publicPath":"/static/sapl/frontend/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.aa0d128d.css","publicPath":"/static/sapl/frontend/css/chunk-vendors.aa0d128d.css","path":"../sapl/sapl/static/sapl/frontend/css/chunk-vendors.aa0d128d.css"},{"name":"js/chunk-vendors.1bb84b96.js","publicPath":"/static/sapl/frontend/js/chunk-vendors.1bb84b96.js","path":"../sapl/sapl/static/sapl/frontend/js/chunk-vendors.1bb84b96.js"},{"name":"css/chunk-vendors.aa0d128d.css.map","publicPath":"/static/sapl/frontend/css/chunk-vendors.aa0d128d.css.map","path":"../sapl/sapl/static/sapl/frontend/css/chunk-vendors.aa0d128d.css.map"}],"compilacao":[{"name":"css/compilacao.eff62463.css","publicPath":"/static/sapl/frontend/css/compilacao.eff62463.css","path":"../sapl/sapl/static/sapl/frontend/css/compilacao.eff62463.css"},{"name":"js/compilacao.f85808e4.js","publicPath":"/static/sapl/frontend/js/compilacao.f85808e4.js","path":"../sapl/sapl/static/sapl/frontend/js/compilacao.f85808e4.js"},{"name":"css/compilacao.eff62463.css.map","publicPath":"/static/sapl/frontend/css/compilacao.eff62463.css.map","path":"../sapl/sapl/static/sapl/frontend/css/compilacao.eff62463.css.map"}],"global":[{"name":"css/global.3b8f6afb.css","publicPath":"/static/sapl/frontend/css/global.3b8f6afb.css","path":"../sapl/sapl/static/sapl/frontend/css/global.3b8f6afb.css"},{"name":"js/global.0caf9fa1.js","publicPath":"/static/sapl/frontend/js/global.0caf9fa1.js","path":"../sapl/sapl/static/sapl/frontend/js/global.0caf9fa1.js"},{"name":"css/global.3b8f6afb.css.map","publicPath":"/static/sapl/frontend/css/global.3b8f6afb.css.map","path":"../sapl/sapl/static/sapl/frontend/css/global.3b8f6afb.css.map"}],"painel":[{"name":"css/painel.5d957a9b.css","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css","path":"../sapl/sapl/static/sapl/frontend/css/painel.5d957a9b.css"},{"name":"js/painel.fcb12a07.js","publicPath":"/static/sapl/frontend/js/painel.fcb12a07.js","path":"../sapl/sapl/static/sapl/frontend/js/painel.fcb12a07.js"},{"name":"css/painel.5d957a9b.css.map","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css.map","path":"../sapl/sapl/static/sapl/frontend/css/painel.5d957a9b.css.map"}]}} |
{"status":"done","publicPath":"/static/sapl/frontend/","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.aa0d128d.css","publicPath":"/static/sapl/frontend/css/chunk-vendors.aa0d128d.css","path":"../sapl/sapl/static/sapl/frontend/css/chunk-vendors.aa0d128d.css"},{"name":"js/chunk-vendors.a29ef83d.js","publicPath":"/static/sapl/frontend/js/chunk-vendors.a29ef83d.js","path":"../sapl/sapl/static/sapl/frontend/js/chunk-vendors.a29ef83d.js"},{"name":"css/chunk-vendors.aa0d128d.css.map","publicPath":"/static/sapl/frontend/css/chunk-vendors.aa0d128d.css.map","path":"../sapl/sapl/static/sapl/frontend/css/chunk-vendors.aa0d128d.css.map"}],"compilacao":[{"name":"css/compilacao.eff62463.css","publicPath":"/static/sapl/frontend/css/compilacao.eff62463.css","path":"../sapl/sapl/static/sapl/frontend/css/compilacao.eff62463.css"},{"name":"js/compilacao.0684a9a9.js","publicPath":"/static/sapl/frontend/js/compilacao.0684a9a9.js","path":"../sapl/sapl/static/sapl/frontend/js/compilacao.0684a9a9.js"},{"name":"css/compilacao.eff62463.css.map","publicPath":"/static/sapl/frontend/css/compilacao.eff62463.css.map","path":"../sapl/sapl/static/sapl/frontend/css/compilacao.eff62463.css.map"}],"global":[{"name":"css/global.3b8f6afb.css","publicPath":"/static/sapl/frontend/css/global.3b8f6afb.css","path":"../sapl/sapl/static/sapl/frontend/css/global.3b8f6afb.css"},{"name":"js/global.7291511d.js","publicPath":"/static/sapl/frontend/js/global.7291511d.js","path":"../sapl/sapl/static/sapl/frontend/js/global.7291511d.js"},{"name":"css/global.3b8f6afb.css.map","publicPath":"/static/sapl/frontend/css/global.3b8f6afb.css.map","path":"../sapl/sapl/static/sapl/frontend/css/global.3b8f6afb.css.map"}],"painel":[{"name":"css/painel.5d957a9b.css","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css","path":"../sapl/sapl/static/sapl/frontend/css/painel.5d957a9b.css"},{"name":"js/painel.f7b68b0b.js","publicPath":"/static/sapl/frontend/js/painel.f7b68b0b.js","path":"../sapl/sapl/static/sapl/frontend/js/painel.f7b68b0b.js"},{"name":"css/painel.5d957a9b.css.map","publicPath":"/static/sapl/frontend/css/painel.5d957a9b.css.map","path":"../sapl/sapl/static/sapl/frontend/css/painel.5d957a9b.css.map"}],"parlamentar":[{"name":"css/parlamentar.0e433876.css","publicPath":"/static/sapl/frontend/css/parlamentar.0e433876.css","path":"../sapl/sapl/static/sapl/frontend/css/parlamentar.0e433876.css"},{"name":"js/parlamentar.a2666491.js","publicPath":"/static/sapl/frontend/js/parlamentar.a2666491.js","path":"../sapl/sapl/static/sapl/frontend/js/parlamentar.a2666491.js"},{"name":"css/parlamentar.0e433876.css.map","publicPath":"/static/sapl/frontend/css/parlamentar.0e433876.css.map","path":"../sapl/sapl/static/sapl/frontend/css/parlamentar.0e433876.css.map"}]}} |
Loading…
Reference in new issue