Commit dcdaad1b02386325797a5c72acf0aab01716a323

Authored by Killian
1 parent 9aab1de738
Exists in soap

passage en soap :) Cette fois ça marche

Showing 2 changed files with 69 additions and 0 deletions Inline Diff

File was created 1 # -*- coding: utf-8 -*-
2 import subprocess
3 import os
4 import json
5 from lxml import etree
6 from flask import Flask, request, render_template
7 from processor.LiaTools import *
8 from processor.Orkis import Orkis
9 from flaskext.enterprise import Enterprise
10 from time import ctime
11 app = Flask(__name__)
12 enterprise = Enterprise(app)
13
14 @app.route("/")
15 def docs():
16 return render_template('index.html')
17
18 @app.route("/tagger",methods=['POST'])
19 def cleaner():
20 # Receive String from post parametre Raw text
21 dirtyString= request.values[u'string']
22 # Charging Processor et check if they are okay ( aim is to dynamic charge later )
23 orkisProc = Orkis(dirtyString)
24 # Processing
25 # Adding lemm of each words cause we went ther phonem too
26 taggedTable= orkisProc.getDico()
27 # Returning a row text to be parse client side
28 return unicode(taggedTable)
29
30 class OrkisService(enterprise.SOAPService):
31 @enterprise.soap(returns=enterprise._sp.String)
32 def get_phon(self):
33 return ctime()
34
35 if __name__ == '__main__':
36 app.debug = True
37 app.run(host='0.0.0.0')
38
File was created 1 from spyne.application import Application
2 from spyne.decorator import srpc
3 from spyne.service import ServiceBase
4 from spyne.model.primitive import Integer
5 from spyne.model.primitive import Unicode
6 from spyne.model.complex import Iterable
7 from spyne.protocol.soap import Soap11
8 from spyne.server.wsgi import WsgiApplication
9 from processor.Orkis import Orkis
10
11 class HelloWorldService(ServiceBase):
12 @srpc(Unicode, _returns=Unicode)
13 def say_hello(name):
14 orkis=Orkis(name)
15 orkis.getDico()
16 return str(orkis)
17
18 application = Application([HelloWorldService],
19 tns='spyne.examples.hello',
20 in_protocol=Soap11(),
21 out_protocol=Soap11()
22 )
23
24 if __name__ == '__main__':
25 # You can use any Wsgi server. Here, we chose
26 # Python's built-in wsgi server but you're not
27 # supposed to use it in production.
28 from wsgiref.simple_server import make_server
29
30 wsgi_app = WsgiApplication(application)
31 server = make_server('0.0.0.0', 8000, wsgi_app)
32 server.serve_forever()
33