Create Telegram Templates which can be used to send telegrams
            :param client_key: Client Key Nationstates Gave you
            :param tgid: TGID from api template
            :param key: Key from api Template
775953
def telegram(self, client_key=None, tgid=None, key=None):
        
        return Telegram(self, client_key, tgid, key)
1154641
def create(self, client_id, name, html_url, zip_url):
        """"""
        body = {
            "Name": name,
            "HtmlPageURL": html_url,
            "ZipFileURL": zip_url}
        response = self._post("/templates/%s.json" %
                              client_id, json.dumps(body))
        self.template_id = json_to_py(response)
        return self.template_id
1133728
def create(key_body)
      client.ensure_master_key!

      path = ""
      response = access_keys_post(client.master_key, path, key_body)
      client.process_response(response.code.to_i, response.body)
    end
243023
def send_keys(self, keysToSend):
        
        if self.driver.w3c:
            self.driver.execute(Command.W3C_SET_ALERT_VALUE, {'value': keys_to_typing(keysToSend),
                                                              'text': keysToSend})
        else:
            self.driver.execute(Command.SET_ALERT_VALUE, {'text': keysToSend})
522824
def setup(cls, client_id, client_secret):
        
        cls.client_id = client_id
        cls.client_secret = client_secret
508557
function Yubikey(clientId, secretKey) {
  this.clientId = clientId || process.env['YUBIKEY_CLIENT_ID'];
  this.secretKey = secretKey || process.env['YUBIKEY_SECRET_KEY'];

  if (!(this.clientId && this.secretKey)) {
    throw new Error("need client id and secret key");
  }
}
1181338
def example():
    
    client = Client(ACCOUNT_SID, AUTH_TOKEN)

    # Get all messages
    all_messages = client.messages.list()
    print('There are {} messages in your account.'.format(len(all_messages)))

    # Get only last 10 messages...
    some_messages = client.messages.list(limit=10)
    print('Here are the last 10 messages in your account:')
    for m in some_messages:
        print(m)

    # Get messages in smaller pages...
    all_messages = client.messages.list(page_size=10)
    print('There are {} messages in your account.'.format(len(all_messages)))

    print('Sending a message...')
    new_message = client.messages.create(to='XXXX', from_='YYYY', body='Twilio rocks!')

    print('Making a call...')
    new_call = client.calls.create(to='XXXX', from_='YYYY', method='GET')

    print('Serving TwiML')
    twiml_response = VoiceResponse()
    twiml_response.say('Hello!')
    twiml_response.hangup()
    twiml_xml = twiml_response.to_xml()
    print('Generated twiml: {}'.format(twiml_xml))
155080
function createAuthKey(callback, channel) {

    flow.retryUntilIsDone(callback, null,
        function (callback) {
            flow.runSeries([
                require('./request-pq'),
                require('./request-dh-params'),
                require('./set-client-dh-params')
            ], callback, channel);
        });
}
1045602
async def _create_exported_sender(self, dc_id):
        
        # Thanks badoualy/kotlogram on /telegram/api/DefaultTelegramClient.kt
        # for clearly showing how to export the authorization
        dc = await self._get_dc(dc_id)
        # Can't reuse self._sender._connection as it has its own seqno.
        #
        # If one were to do that, Telegram would reset the connection
        # with no further clues.
        sender = MTProtoSender(None, self._loop, loggers=self._log)
        await sender.connect(self._connection(
            dc.ip_address,
            dc.port,
            dc.id,
            loop=self._loop,
            loggers=self._log,
            proxy=self._proxy
        ))
        self._log[__name__].info('Exporting authorization for data center %s',
                                 dc)
        auth = await self(functions.auth.ExportAuthorizationRequest(dc_id))
        req = self._init_with(functions.auth.ImportAuthorizationRequest(
            id=auth.id, bytes=auth.bytes
        ))
        await sender.send(req)
        return sender
427817
def generate_creds_params
      define_singleton_method :creds_params,
        if @service_tokens
          lambda do |options|
            token = options.delete(:service_token)
            service_id = options[:service_id]
            raise ArgumentError, "need to specify a service_token and a service_id" unless token && service_id
            'service_token='.freeze + CGI.escape(token)
          end
        elsif @provider_key
          warn DEPRECATION_MSG_PROVIDER_KEY if @warn_deprecated
          lambda do |_|
            "provider_key=#{CGI.escape @provider_key}".freeze
          end
        else
          raise ArgumentError, 'missing credentials - either use "service_tokens: true" or specify a provider_key value'
        end
    end
410970
def _auth_key_callback(self, auth_key):
        
        self.session.auth_key = auth_key
        self.session.save()
602349
def from_tgt(ksoc, tgt, key):
		
		kc = KerbrosComm(None, ksoc)
		kc.kerberos_TGT = tgt
		
		kc.kerberos_cipher_type = key['keytype']
		kc.kerberos_session_key = Key(kc.kerberos_cipher_type, key['keyvalue']) 
		kc.kerberos_cipher = _enctype_table[kc.kerberos_cipher_type]
		return kc
1056444
def mget(msg_id, keys)
      keys = keys.map{|suffix| key(msg_id, suffix)}
      with_failover { redis.mget(*keys) }
    end
3740
def _encode_message_header(cls, client_id, correlation_id, request_key,
                               api_version=0):
        
        return (struct.pack('>hhih',
                            request_key,          # ApiKey
                            api_version,          # ApiVersion
                            correlation_id,       # CorrelationId
                            len(client_id)) +     # ClientId size
                client_id)
986391
def notify_telegram(title, content, token=None, chat=None, mention_user=None, **kwargs):
    
    # test import
    import telegram  # noqa: F401

    cfg = Config.instance()

    # get default token and chat
    if not token:
        token = cfg.get_expanded("notifications", "telegram_token")
    if not chat:
        chat = cfg.get_expanded("notifications", "telegram_chat")

    if not token or not chat:
        logger.warning("cannot send Telegram notification, token ({}) or chat ({}) empty".format(
            token, chat))
        return False

    # append the user to mention to the title
    # unless explicitly set to empty string
    mention_text = ""
    if mention_user is None:
        mention_user = cfg.get_expanded("notifications", "telegram_mention_user")
    if mention_user:
        mention_text = " (@{})".format(mention_user)

    # request data for the API call
    request = {
        "parse_mode": "Markdown",
    }

    # standard or attachment content?
    if isinstance(content, six.string_types):
        request["text"] = "{}{}\n\n{}".format(title, mention_text, content)
    else:
        # content is a dict, add some formatting
        request["text"] = "{}{}\n\n".format(title, mention_text)

        for key, value in content.items():
            request["text"] += "_{}_: {}\n".format(key, value)

    # extend by arbitrary kwargs
    request.update(kwargs)

    # threaded, non-blocking API communication
    thread = threading.Thread(target=_notify_telegram, args=(token, chat, request))
    thread.start()

    return True
1124840
def keys_create(gandi, fqdn, flag):
    """"""
    key_info = gandi.dns.keys_create(fqdn, int(flag))

    output_keys = ['uuid', 'algorithm', 'algorithm_name', 'ds', 'fingerprint',
                   'public_key', 'flags', 'tag', 'status']
    output_generic(gandi, key_info, output_keys, justify=15)
    return key_info
1085915
def request_token(self, board):
    '''
    '''
    nonce = str(uuid.uuid4())

    data = {'scopes': 'write',
            'client_id': self.client_id,
            'application_name': 'HelpMe',
            'public_key': self.public_key.replace("'",""),
            'nonce': nonce }

    url = (board + "/user-api-key/new?scopes=write&application_name=HelpMe&public_key=" + 
           self.public_key.replace("'", "") + 
           "&client_id=" + self.client_id +
           "&nonce=" + nonce )

    bot.newline()
    bot.info('Open browser to:')
    bot.info(url)
    bot.newline()
    
    # the user will open browser, get a token, and then have it saved here.
    bot.info('Copy paste token, press Ctrl-D to save it:')

    lines = []

    # The message is multiple lines
    while True:
        try:
            line = enter_input()
        except EOFError:
            break
        if line:
            lines.append(line)

    message = "\n".join(lines)

    # Write to temporary file, we only need to get key
    tmpfile = mktemp()
    with open(tmpfile, 'w') as filey:
        filey.write(message)

    # Read in again, and get token **important** is binary
    with open(tmpfile, 'rb') as filey:
        message = filey.read()

    # uses pycryptodome (3.7.2)
    cipher = Cipher_PKCS1_v1_5.new(self.key)
    decrypted = json.loads(cipher.decrypt(b64decode(message), None).decode())

    # Validate nonce is in response
    if "nonce" not in decrypted:
        bot.exit('Missing nonce field in response for token, invalid.')

    # Must return nonce that we sent
    if decrypted['nonce'] != nonce:
        bot.exit('Invalid nonce, exiting.')

    return decrypted['key']