#!/usr/bin/python3
import flask
import pymongo

from flask.ext.restful import Api
from werkzeug.contrib.fixers import ProxyFix

#application instance
app = flask.Flask(__name__)

# our api instance
api=Api(app)

#client=connection = MongoClient()
client = pymongo.MongoClient()

#a ressource class that will be mapped to a URL
# list_dbs derived from Resource
class list_dbs(flask.ext.restful.Resource):
    def get(self):
        return client.database_names()

class list_cat(flask.ext.restful.Resource):
    def get(self):
        return client.INSEE.collection_names()

# map the list_dbs ressource to '/list_dbs' endpoint
api.add_resource(list_dbs, '/list_dbs')
api.add_resource(list_cat, '/list_cat')

@app.route('/')
def index():
    return "test index!"

app.wsgi_app = ProxyFix(app.wsgi_app)

if __name__ == '__main__':
    app.run(debug=True)

@@ -40,17 +40,16 @@
 pymongo%0A
-%0A
 from fla
@@ -74,16 +74,40 @@
 ort Api%0A
+from flask import Flask%0A
 from wer
@@ -142,16 +142,88 @@
 ProxyFix
+%0Aimport bson%0Afrom bson import json_util%0Afrom bson.json_util import dumps
 %0A%0A#appli
@@ -238,17 +238,17 @@
 nstance%0A
-a
+A
 pp = fla
@@ -298,161 +298,45 @@
 Api(
-a
+A
 pp)%0A%0A
-#client=connection = MongoClient()%0Aclient = pymongo.MongoClient()%0A%0A#a ressource class that will be mapped to a URL%0A# list_dbs derived from Resource
+client = pymongo.MongoClient()%0A
 %0Acla
@@ -498,32 +498,33 @@
 (self):%0A        
+#
 return client.IN
@@ -550,61 +550,289 @@
 s()%0A
-%0A# map the list_dbs ressource to '/list_dbs' endpoint
+        return client.eurostat.collection_names()%0A%0Aclass cat_eurostat(flask.ext.restful.Resource):%0A    def get(self):%0A        #item = client.eurostat.categories3.find_one(%7B%22name2%22 : %22Database by themes%22%7D)%0A        item = client.eurostat.categories.find()%0A        return dumps(item)%0A
 %0Aapi
@@ -911,12 +911,60 @@
 at')
+%0Aapi.add_resource(cat_eurostat, '/cat_eurostat')
 %0A%0A@
-a
+A
 pp.r
@@ -1012,17 +1012,17 @@
 ndex!%22%0A%0A
-a
+A
 pp.wsgi_
@@ -1036,17 +1036,17 @@
 roxyFix(
-a
+A
 pp.wsgi_
@@ -1082,17 +1082,17 @@
 _':%0A    
-a
+A
 pp.run(d
@@ -1102,8 +1102,101 @@
 g=True)%0A
+%0A#gunicorn --bind=127.0.0.1:8001 webservice:App %0A#curl -i http://127.0.0.1:8001/cat_eurostat%0A

Update webservice.py