Example #1
0
 def post_back_json(self, MSISDN):
     session = getVumiSession(self.r_server,
                              self.routing_key + '.' + MSISDN)
     if session and session.get_decision_tree():
         json_string = json.dumps(session.get_decision_tree().get_data())
         if self.post_url['url']:
             params = [(self.post_url['params'][0], json_string)]
             url = self.post_url['url']
             auth_string = ''
             if self.post_url['username']:
                 auth_string += self.post_url['username']
                 if self.post_url['password']:
                     auth_string += ":" + self.post_url['password']
                 auth_string += "@"
             resp_url, resp = utils.callback("http://" + auth_string + url,
                                             params)
             return resp
     return None
Example #2
0
 def get_session(self, MSISDN):
     sess = getVumiSession(self.r_server,
                           self.routing_key + '.' + MSISDN)
     if not sess.get_decision_tree():
         sess.set_decision_tree(self.setup_new_decision_tree(MSISDN))
     return sess