Send settings to the LMS using the simple JSON approach
976693
public static function settingsSend($settings, $settings_url, &$debug_log=false) {

        $key_key = self::ltiParameter('key_key');
        $secret = self::decrypt_secret(self::ltiParameter('secret'));

        $retval = LTI::sendJSONSettings($settings, $settings_url, $key_key, $secret, $debug_log);
        return $retval;
    }
1032613
def to_json(self):
        

        result = super(EditorInterface, self).to_json()
        result.update({'controls': self.controls})
        return result
1343683
def _set(self, jsonData) :
        """"""
        
        self["username"] = jsonData["user"]
        self["active"] = jsonData["active"]
        self["extra"] = jsonData["extra"]
        try:
            self["changePassword"] = jsonData["changePassword"]
        except Exception as e:
            pass
            # self["changePassword"] = ""
        
        try :
            self["password"] = jsonData["passwd"]
        except KeyError :
            self["password"] = ""

        self.URL = "%s/user/%s" % (self.connection.URL, self["username"])
1279431
function(msg, config, node) {
    checkConfiguration(msg, node)
      .then(function(settings) {
        var options = toneutils.parseOptions(msg, config);
        options = toneutils.parseLanguage(msg, config, options);
        node.status({fill:'blue', shape:'dot', text:'requesting'});
        return invokeService(config, options, settings);
      })
      .then(function(data){
        node.status({})
        msg.response = data;
        node.send(msg);
        node.status({});
      })
      .catch(function(err){
        payloadutils.reportError(node,msg,err);
        node.send(msg);
      });
  }
627264
def _get_settings(self):
        """"""
        url = self._global_settings_url
        payload = {}
        res = self._send_request('GET', url, payload, 'settings')
        if res and res.status_code in self._resp_ok:
            return res.json()
1348101
def set_preferences(self, **kwargs):
        
        json_data = "json={}".format(json.dumps(kwargs))
        headers = {'content-type': 'application/x-www-form-urlencoded'}
        return self._post('command/setPreferences', data=json_data,
                          headers=headers)
270463
def _populate(self, json):
        
        super(InvoiceItem, self)._populate(json)

        self.from_date = datetime.strptime(json['from'], DATE_FORMAT)
        self.to_date = datetime.strptime(json['to'], DATE_FORMAT)
1265218
private function setupJson()
    {
        $this->io->title('Creating/updating composer.json');
        $this->app['extend.manager.json']->update();
        $this->io->success('Success');
    }
572538
def send(self, test=None):
        '''
        
        '''
        self._check_values()

        # Set up message dictionary
        json_message = self.to_json_message()

        # if (self.__html_body and not self.__text_body) and self.__multipart:
        #     # TODO: Set up regex to strip html
        #     pass

        # If test is not specified, attempt to read the Django setting
        if test is None:
            try:
                from django.conf import settings as django_settings
                test = getattr(django_settings, "POSTMARK_TEST_MODE", None)
            except ImportError:
                pass

        # If this is a test, just print the message
        if test:
            print('JSON message is:\n%s' % json.dumps(json_message, cls=PMJSONEncoder))
            return

        if self.__template_id:
            endpoint_url = __POSTMARK_URL__ + 'email/withTemplate/'
        else:
            endpoint_url = __POSTMARK_URL__ + 'email'

        # Set up the url Request
        req = Request(
            endpoint_url,
            json.dumps(json_message, cls=PMJSONEncoder).encode('utf8'),
            {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'X-Postmark-Server-Token': self.__api_key,
                'User-agent': self.__user_agent
            }
        )

        # Attempt send
        try:
            # print 'sending request to postmark: %s' % json_message
            result = urlopen(req)
            jsontxt = result.read().decode('utf8')
            result.close()
            if result.code == 200:
                self.message_id = json.loads(jsontxt).get('MessageID', None)
                return True
            else:
                raise PMMailSendException('Return code %d: %s' % (result.code, result.msg))
        except HTTPError as err:
            if err.code == 401:
                raise PMMailUnauthorizedException('Sending Unauthorized - incorrect API key.', err)
            elif err.code == 422:
                try:
                    jsontxt = err.read().decode('utf8')
                    jsonobj = json.loads(jsontxt)
                    desc = jsonobj['Message']
                    error_code = jsonobj['ErrorCode']
                except KeyError:
                    raise PMMailUnprocessableEntityException('Unprocessable Entity: Description not given')

                if error_code == 406:
                    raise PMMailInactiveRecipientException('You tried to send email to a recipient that has been marked as inactive.')

                raise PMMailUnprocessableEntityException('Unprocessable Entity: %s' % desc)
            elif err.code == 500:
                raise PMMailServerErrorException('Internal server error at Postmark. Admins have been alerted.', err)
        except URLError as err:
            if hasattr(err, 'reason'):
                raise PMMailURLException('URLError: Failed to reach the server: %s (See "inner_exception" for details)' % err.reason, err)
            elif hasattr(err, 'code'):
                raise PMMailURLException('URLError: %d: The server couldn\'t fufill the request. (See "inner_exception" for details)' % err.code, err)
            else:
                raise PMMailURLException('URLError: The server couldn\'t fufill the request. (See "inner_exception" for details)', err)
608480
def send_custom_hsm(self, whatsapp_id, template_name, language, variables):
        
        data = {
            "to": whatsapp_id,
            "type": "hsm",
            "hsm": {
                "namespace": self.hsm_namespace,
                "element_name": template_name,
                "language": {"policy": "deterministic", "code": language},
                "localizable_params": [{"default": variable} for variable in variables],
            },
        }

        if self.ttl is not None:
            data["ttl"] = self.ttl
        response = self.session.post(
            urllib_parse.urljoin(self.api_url, "/v1/messages"), json=data
        )
        return self.return_response(response)
786089
function (settings, callback) {
          if (typeof settings == "string") {
            settings = { text: settings };
          }

          settings.callback = callback;
          return MessageBox.msgBox(settings);
        }
1276511
def send_callback_json_message(value, *args, **kwargs):
    

    if value:
        kwargs['result'] = value

    send_json_message(args[0], args[1], **kwargs)

    return value
1038709
def send(self, message):  # usually a json string...
        
        for transport in self.transports.values():
            transport.protocol.sendMessage(message)
1125816
def to_json_format(conf):
    ''''''
    if 'fmode' in conf:
        conf['fmode'] = oct(conf['fmode'])[-3:]
    if 'dmode' in conf:
        conf['dmode'] = oct(conf['dmode'])[-3:]
743122
def sendMessage(self, msg_dict):
        
        sent_ids = []
        for name in msg_dict:
            self.last_msg_id += 1
            msg_dict[name]['ID'] = self.last_msg_id
            sent_ids.append((name, self.last_msg_id))
        llrp_msg = LLRPMessage(msgdict=msg_dict)

        assert llrp_msg.msgbytes, "LLRPMessage is empty"
        self.transport.write(llrp_msg.msgbytes)

        return sent_ids
1093710
def send_json_message(address, message, **kwargs):
    

    data = {
        'message': message,
    }

    if not kwargs.get('subject_id'):
        data['subject_id'] = address

    data.update(kwargs)

    hxdispatcher.send(address, data)
1218053
def send_tick(self, payload=""):
        
        data = self.message(MessageType.SEND_TICK, payload)
        return json.loads(data, object_hook=TickReply)