We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74c9ece commit ef3390eCopy full SHA for ef3390e
mootiro_api_server.py
@@ -0,0 +1,28 @@
1
+import bottle
2
+import json
3
+import psycopg2
4
+
5
+from bottle import route, run, response
6
+from requests import ConnectionError
7
8
+app_v1 = bottle.Bottle()
9
10
+def _get_connection():
11
+ try:
12
+ conn = psycopg2.connect("dbname='mootiro' user='postgres' host='localhost' password='postgres'")
13
+ return conn.cursor()
14
15
+ except:
16
+ print "Erro ao se conectar a base de dados"
17
18
+@app_v1.route("/organizations")
19
+def get_organizations():
20
+ query = _get_connection()
21
+ query.execute("SELECT * from organization_organization")
22
+ org = query.fetchall()
23
+ return org
24
25
+bottle.mount('/v1', app_v1)
26
27
+def _standalone(port=8000):
28
+ run(host='localhost', port=port)
0 commit comments