Command line tool (``koordinates-create-token``) used to create an API token.
330711
def console_create():
    
    import argparse
    import getpass
    import re
    import sys
    import requests
    from six.moves import input
    from koordinates.client import Client

    parser = argparse.ArgumentParser(description="Command line tool to create a Koordinates API Token.")
    parser.add_argument('site', help="Domain (eg. labs.koordinates.com) for the Koordinates site.", metavar='SITE')
    parser.add_argument('email', help="User account email address", metavar='EMAIL')
    parser.add_argument('name', help="Description for the key", metavar='NAME')
    parser.add_argument('--scopes', help="Scopes for the new API token", nargs='+', metavar="SCOPE")
    parser.add_argument('--referrers', help="Restrict the request referrers for the token. You can use * as a wildcard, eg. *.example.com", nargs='+', metavar='HOST')
    parser.add_argument('--expires', help="Expiry time in ISO 8601 (YYYY-MM-DD) format", metavar="DATE")
    args = parser.parse_args()

    # check we have a valid-ish looking domain name
    if not re.match(r'(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)', args.site):
        parser.error("'%s' doesn't look like a valid domain name." % args.site)

    # check we have a valid-ish looking email address
    if not re.match(r'[^@]+@[^@]+\.[^@]+$', args.email):
        parser.error("'%s' doesn't look like a valid email address." % args.email)

    password = getpass.getpass('Account password for %s: ' % args.email)
    if not password:
        parser.error("Empty password.")

    expires_at = make_date(args.expires)

    print("\nNew API Token Parameters:")
    print("  Koordinates Site: %s" % args.site)
    print("  User email address: %s" % args.email)
    print("  Name: %s" % args.name)
    print("  Scopes: %s" % ' '.join(args.scopes or ['(default)']))
    print("  Referrer restrictions: %s" % ' '.join(args.referrers or ['(none)']))
    print("  Expires: %s" % (expires_at or '(never)'))
    if input("Continue? [Yn] ").lower() == 'n':
        sys.exit(1)

    token = Token(name=args.name)
    if args.scopes:
        token.scopes = args.scopes
    if args.referrers:
        token.referrers = args.referrers
    if expires_at:
        token.expires_at = expires_at

    print("\nRequesting token...")
    # need a dummy token here for initialisation
    client = Client(host=args.site, token='-dummy-')
    try:
        token = client.tokens.create(token, args.email, password)
    except requests.HTTPError as e:
        print("%s: %s" % (e, e.response.text))

        # Helpful tips for specific errors
        if e.response.status_code == 401:
            print("  => Check your email address, password, and site domain carefully.")

        sys.exit(1)

    print("Token created successfully.\n  Key: %s\n  Scopes: %s" % (token.key, token.scope))
1336933
function createToken(options) {
    const newToken = chevrotain.createToken(options)
    allTokens.push(newToken)
    return newToken
}
767115
def create_deployment(deployment_name,
                      token_manager=None,
                      app_url=defaults.APP_URL):
    
    headers = token_manager.get_access_token_headers()

    payload = {
        'name': deployment_name,
        'isAdmin': True
    }

    deployment_url = environment.get_deployment_url(app_url=app_url)
    response = requests.post('%s/api/v1/deployments' % deployment_url,
                             data=json.dumps(payload),
                             headers=headers)

    if response.status_code == 201:
        return response.json()

    else:
        raise JutException('Error %s: %s' % (response.status_code, response.text))
1106935
def create_token():
    '''
        
    '''
    username = id_generator()
    password = id_generator()
    create_couchdb_admin(username, password)
    create_token_file(username, password)

    return 'Token {} created'.format(username)
729955
def main(api_key, markup):
    ''''''
    match = GIPHY.search(markup)

    attrs = None

    if match:
        attrs = dict(
            [(key, value.strip())
             for (key, value) in match.groupdict().items() if value])

    else:
        raise ValueError('Error processing input. '
                         'Expected syntax: {}'.format(SYNTAX))

    return create_html(api_key, attrs)
449424
private static Token createPlainToken(final String name, final String configuration) {
		if (name.equals("date")) {
			return createDateToken(configuration);
		} else if ("pid".equals(name)) {
			return new ProcessIdToken();
		} else if ("thread".equals(name)) {
			return new ThreadNameToken();
		} else if ("thread-id".equals(name)) {
			return new ThreadIdToken();
		} else if ("context".equals(name)) {
			return createThreadContextToken(configuration);
		} else if ("class".equals(name)) {
			return new FullClassNameToken();
		} else if ("class-name".equals(name)) {
			return new SimpleClassNameToken();
		} else if ("package".equals(name)) {
			return new PackageNameToken();
		} else if ("method".equals(name)) {
			return new MethodNameToken();
		} else if ("file".equals(name)) {
			return new FileNameToken();
		} else if ("line".equals(name)) {
			return new LineNumberToken();
		} else if ("tag".equals(name)) {
			return configuration == null ? new LoggerTagToken() : new LoggerTagToken(configuration);
		} else if ("level".equals(name)) {
			return new SeverityLevelToken();
		} else if ("message".equals(name)) {
			return new MessageAndExceptionToken();
		} else if ("message-only".equals(name)) {
			return new MessageToken();
		} else if ("exception".equals(name)) {
			return new ExceptionToken();
		} else if ("opening-curly-bracket".equals(name)) {
			return new PlainTextToken("{");
		} else if ("closing-curly-bracket".equals(name)) {
			return new PlainTextToken("}");
		} else if ("pipe".equals(name)) {
			return new PlainTextToken("|");
		} else {
			return null;
		}
	}
789933
def make_command(command: Callable) -> Callable:
    """"""
    @wraps(command)
    def actualcommand(self, *args, **kwds):  # pylint: disable=missing-docstring
        data = command(self, *args, **kwds)
        name = command.__name__[3:]
        signal = '{uuid}{sep}{event}'.format(
            uuid=self._uuid,  # pylint: disable=protected-access
            sep=SEPARATOR,
            event=name
        )
        if flask.has_request_context():
            emit(signal, {'data': pack(data)})
        else:
            sio = flask.current_app.extensions['socketio']
            sio.emit(signal, {'data': pack(data)})
        eventlet.sleep()

    return actualcommand
13874
function createApi () {
  api = {
    eth: {
      blockNumber: sinon.stub().resolves(new BigNumber(2)),
      gasPrice: sinon.stub().resolves(GASPRICE)
    },
    parity: {
      gasPriceHistogram: sinon.stub().resolves(HISTOGRAM)
    }
  };

  return api;
}
836400
def api(name, url, token, **kwargs):
    """"""
    return Client(token).api(name, url, **kwargs)
197287
def token(config, token):
    """"""
    if not token:
        info_out(
            "To generate a personal API token, go to:\n\n\t"
            "https://github.com/settings/tokens\n\n"
            "To read more about it, go to:\n\n\t"
            "https://help.github.com/articles/creating-an-access"
            "-token-for-command-line-use/\n\n"
            'Remember to enable "repo" in the scopes.'
        )
        token = getpass.getpass("GitHub API Token: ").strip()
    url = urllib.parse.urljoin(config.github_url, "/user")
    assert url.startswith("https://"), url
    response = requests.get(url, headers={"Authorization": "token {}".format(token)})
    if response.status_code == 200:
        update(
            config.configfile,
            {
                "GITHUB": {
                    "github_url": config.github_url,
                    "token": token,
                    "login": response.json()["login"],
                }
            },
        )
        name = response.json()["name"] or response.json()["login"]
        success_out("Hi! {}".format(name))
    else:
        error_out("Failed - {} ({})".format(response.status_code, response.content))
1342001
def gen_token():
    """"""
    return ''.join(
        random.choice(
            string.ascii_uppercase + string.ascii_lowercase + string.digits)
        for _ in range(32))
432606
def any_channel_validate_token_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/any_channel/validate_token"
        return self.call(api_path, method="POST", data=data, **kwargs)
1211325
def _api_create(cls, api_key=djstripe_settings.STRIPE_SECRET_KEY, **kwargs):
		

		return cls.stripe_class.create(api_key=api_key, **kwargs)
1106775
def create_entitlement(owner, repo, name, token, show_tokens):
    """"""
    client = get_entitlements_api()

    data = {}
    if name is not None:
        data["name"] = name

    if token is not None:
        data["token"] = token

    with catch_raise_api_exception():
        data, _, headers = client.entitlements_create_with_http_info(
            owner=owner, repo=repo, data=data, show_tokens=show_tokens
        )

    ratelimits.maybe_rate_limit(client, headers)
    return data.to_dict()
1163437
def _create_api_method(cls, name, api_method):
    
    def _api_method(self, **kwargs):
        # lookup the command
        command = api_method['name']
        if kwargs:
            return self._make_request(command, kwargs)
        else:
            kwargs = {}
            return self._make_request(command, kwargs)
    _api_method.__doc__ = api_method['description']
    _api_method.__doc__ += _add_params_docstring(api_method['params'])
    _api_method.__name__ = str(name)
    setattr(cls, _api_method.__name__, _api_method)
1214902
def automation_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/automations.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
31181
def _create_parser(self):
        
        parser = CommandParser(get_internal_version_str())
        parser.register_list_command(self._setup_run_command(ListCommand))
        parser.register_upload_command(self._setup_run_command(UploadCommand))
        parser.register_add_user_command(self._setup_run_command(AddUserCommand))
        parser.register_remove_user_command(self._setup_run_command(RemoveUserCommand))
        parser.register_download_command(self._setup_run_command(DownloadCommand))
        parser.register_share_command(self._setup_run_command(ShareCommand))
        parser.register_deliver_command(self._setup_run_command(DeliverCommand))
        parser.register_delete_command(self._setup_run_command(DeleteCommand))
        parser.register_list_auth_roles_command(self._setup_run_command(ListAuthRolesCommand))
        return parser