I am developing an openerp module. Someone makes a POST to a url.the POST contains json data:
{
"phone":"987654321",
"message":"this is a test",
"date": "2015/10/09 12:00:00",
}
I want to get the data from the URL,and handle the parameters inside the openerp. This is my code so far :
from flask import Flask, request
app = Flask(__name__)
class myClass():
def __init__(self):
self.HOST = "http://0.0.0.0:8069"
self.DB = 'database'
self.LOGIN = 'admin'
self.PASSWORD = 'admin'
self.phone = None
self.message = None
self.date = None
def authenticate(self):
p = {'jsonrpc': "2.0",
'method': "call",
'params': {
'db': self.DB,
'login': self.LOGIN,
'password': self.PASSWORD}
}
@app.route("/post", methods=['GET', 'POST'])
def post():
sent_obj = myClass()
sent_obj.phone = request.args.get('phone')
sent_obj.message = request.args.get('message')
sent_obj.date = request.args.get('date')
if __name__ == "__main__":
app.debug = True
app.run()
How can i use flask, so i can get the data from the url, authenticate openerp, and handle the data inside the openerp?What is the procedure i have to follow?I am really confused...