Create a new TokenInstance

        :param unicode ttl: The duration in seconds the credentials are valid

        :returns: Newly created TokenInstance
        :rtype: twilio.rest.api.v2010.account.token.TokenInstance
162547
def create(self, ttl=values.unset):
        
        data = values.of({'Ttl': ttl, })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], )
736517
def create_record_ptr(self, record, data, ttl=60):
        
        resource_record = self._generate_create_dict(record, 'PTR', data, ttl)

        return self.record.createObject(resource_record)
801420
def make_bench_verify_token(alg):
    
    privk = priv_keys[alg].get('default', priv_key)
    token = jwt.generate_jwt(payload, privk, alg, timedelta(days=1))
    def f(_):
        """ Verify token """
        pubk = pub_keys[alg].get('default', pub_key)
        jwt.verify_jwt(token, pubk, [alg])
    return f
738260
def token(self, token_address: Address) -> Token:
        
        if not is_binary_address(token_address):
            raise ValueError('token_address must be a valid address')

        with self._token_creation_lock:
            if token_address not in self.address_to_token:
                self.address_to_token[token_address] = Token(
                    jsonrpc_client=self.client,
                    token_address=token_address,
                    contract_manager=self.contract_manager,
                )

        return self.address_to_token[token_address]
294947
def _generateForTokenSecurity(self,
                                  username, password,
                                  tokenUrl,
                                  expiration=None,
                                  client='requestip'):
        

        query_dict = {'username': username,
                      'password': password,
                      'expiration':str(_defaultTokenExpiration),
                      'client': client,
                      'f': 'json'}
        if client == "referer":
            query_dict['referer'] = self._referer_url
        if expiration is not None:
            query_dict['expiration'] = expiration

        secHandler = None
        if self.cookiejar is not None:
            secHandler = self
            if secHandler is not None:
                secHandler._method = "HANDLER"
        token = self._post(url=tokenUrl,
                           param_dict=query_dict,
                           securityHandler=secHandler,
                           proxy_port=self._proxy_port,
                           proxy_url=self._proxy_url)
        if self.cookiejar is not None:
            if secHandler is not None:
                secHandler._method = "TOKEN"
        if 'error' in token:
            self._token = None
            self._token_created_on = None
            self._token_expires_on = None
            self._expires_in = None

            return token
        elif 'status' in token:
            self._token = None
            self._token_created_on = None
            self._token_expires_on = None
            self._expires_in = None
            #print token['message']
            return token

        else:
            self._token = token['token']
            self._token_created_on = datetime.datetime.now()
            self._token_expires_on = datetime.datetime.fromtimestamp(token['expires'] /1000) - \
                datetime.timedelta(seconds=1)
            self._expires_in = (self._token_expires_on - self._token_created_on).total_seconds()
            return token['token']
648258
def create_token(self, request, refresh_token=False):
        """"""

        if callable(self.expires_in):
            expires_in = self.expires_in(request)
        else:
            expires_in = self.expires_in

        request.expires_in = expires_in

        return self.request_validator.get_jwt_bearer_token(None, None, request)
1354780
def get_instance(self, payload):
        
        return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], )
1336933
function createToken(options) {
    const newToken = chevrotain.createToken(options)
    allTokens.push(newToken)
    return newToken
}
1024677
def lock(self, id=str(uuid.uuid4()), ttl=DEFAULT_TIMEOUT):
        
        return Lock(id, ttl=ttl, client=self)
721471
def token_new():
    """"""
    form = TokenForm(request.form)
    form.scopes.choices = current_oauth2server.scope_choices()

    if form.validate_on_submit():
        t = Token.create_personal(
            form.data['name'], current_user.get_id(), scopes=form.scopes.data
        )
        db.session.commit()
        session['show_personal_access_token'] = True
        return redirect(url_for(".token_view", token_id=t.id))

    if len(current_oauth2server.scope_choices()) == 0:
        del(form.scopes)

    return render_template(
        "invenio_oauth2server/settings/token_new.html",
        form=form,
    )
1148673
def _create_token(token_type, value, lineno, lexpos):
    
    token = lex.LexToken()
    token.type = token_type
    token.value = value
    token.lineno = lineno
    token.lexpos = lexpos
    return token
90083
def set_ttl(self):
        """"""
        try:
            self.ttl = self.soup.find('ttl').string
        except AttributeError:
            self.ttl = None
47241
def issue_token(kind)
      session = Session.new(user: self, seconds: 3600)
      session.save
      if kind == :reset_token
        self.reset_token = session.token
      elsif kind == :verification_token
        self.verification_token = session.token
      end
    end
868288
def authenticate_credentials(self, token: bytes, request=None):
        
        user = AuthToken.get_user_for_token(token)

        if user is None:
            raise AuthenticationFailed(_('Invalid auth token.'))

        if not user.is_active:
            raise AuthenticationFailed(_('User inactive or deleted.'))

        return user, token
542090
def create(ctx, to, amount, symbol, secret, hash, account, expiration):
    
    ctx.blockchain.blocking = True
    tx = ctx.blockchain.htlc_create(
        Amount(amount, symbol),
        to,
        secret,
        hash_type=hash,
        expiration=expiration,
        account=account,
    )
    tx.pop("trx", None)
    print_tx(tx)
    results = tx.get("operation_results", {})
    if results:
        htlc_id = results[0][1]
        print("Your htlc_id is: {}".format(htlc_id))
291764
def access_token(self):
        
        access = AccessToken()

        # Use instantiation time of refresh token as relative timestamp for
        # access token "exp" claim.  This ensures that both a refresh and
        # access token expire relative to the same time if they are created as
        # a pair.
        access.set_exp(from_time=self.current_time)

        no_copy = self.no_copy_claims
        for claim, value in self.payload.items():
            if claim in no_copy:
                continue
            access[claim] = value

        return access
158407
def create_authorizer(self, restapi, uri, authorizer):
        
        authorizer_type = authorizer.get("type", "TOKEN").upper()
        identity_validation_expression = authorizer.get('validation_expression', None)

        authorizer_resource = troposphere.apigateway.Authorizer("Authorizer")
        authorizer_resource.RestApiId = troposphere.Ref(restapi)
        authorizer_resource.Name = authorizer.get("name", "ZappaAuthorizer")
        authorizer_resource.Type = authorizer_type
        authorizer_resource.AuthorizerUri = uri
        authorizer_resource.IdentitySource = "method.request.header.%s" % authorizer.get('token_header', 'Authorization')
        if identity_validation_expression:
            authorizer_resource.IdentityValidationExpression = identity_validation_expression

        if authorizer_type == 'TOKEN':
            if not self.credentials_arn:
                self.get_credentials_arn()
            authorizer_resource.AuthorizerResultTtlInSeconds = authorizer.get('result_ttl', 300)
            authorizer_resource.AuthorizerCredentials = self.credentials_arn
        if authorizer_type == 'COGNITO_USER_POOLS':
            authorizer_resource.ProviderARNs = authorizer.get('provider_arns')

        self.cf_api_resources.append(authorizer_resource.title)
        self.cf_template.add_resource(authorizer_resource)

        return authorizer_resource