· 9 years ago · Dec 06, 2016, 07:46 PM
1# -*- coding: utf-8 -*-
2from meya import Component
3
4# optional: prevent others from calling this flow
5# SECRET_KEY = "EKNRT345KC220JXSVBFH"
6
7
8
9class Set_User_Binary(Component):
10
11 def start(self):
12 param_name = 'user_binary'
13
14 # read all the data
15 data = self.db.flow.all()
16
17 # TODO: if you like, you can protect the call
18 # authorize the call
19 # if data['secret_key'] == SECRET_KEY:
20 if True:
21 # set the bot data
22 if param_name in data:
23 self.db.user.set(param_name, data[param_name])
24 else:
25 raise Exception("Missing required parameter.")
26 else:
27 raise Exception("Not allowed.")
28
29 return self.respond(action="next")