Create a User-Agent string
760264
def get_user_agent(name="ontobio", version=ontobio_version, modules=None, caller_name=None):
    

    user_agent_array = ["{}/{}".format(name, version)]
    if modules:
        module_info_array = []
        for m in modules:
            mod_name = m.__name__
            mod_version = None
            if hasattr(m, 'get_version'):
                mod_version = m.get_version()
            else:
                mod_version = m.__version__
            module_info_array.append("{}/{}".format(mod_name, mod_version))

        if caller_name:
            module_info_array.append(caller_name)

        user_agent_array.append("({})".format('; '.join(module_info_array)))
    else:
        if caller_name:
            user_agent_array.append("({})".format(caller_name))

    return ' '.join(user_agent_array)
798711
public Request userAgent(String userAgentValue){
        final String userAgent = RequestHeaderFields.USER_AGENT.getName();
        String agent = headers.get(userAgent);
        if (agent == null){
            agent = userAgentValue;
        } else {
            agent = agent + " " + userAgentValue;
        }
        return this.setHeader(userAgent, agent);
    }
63812
function sessionCreated(err, session) {
  var agentInfo = {name: ping + "er", title: "a " + ping + "er" }

  session.createAgent(agentInfo, function(err, agent) {
    console.log(ping + " agent created")

    agent.receive(ping, function(body, reply) {
      reply(null, body)
      bong()
    })
  })

  session.on("ragentCreated", function(ragent) {
    ragentCreated(ragent, "created")
  })

  session.getRemoteAgents(function(err, ragents){
    ragents.forEach(function(ragent) {
      ragentCreated(ragent, "existed")
    })
  })
}
45242
def make_user_agent(prefix=None):
    """"""
    prefix = (prefix or platform.platform(terse=1)).strip().lower()
    return "cloudsmith-cli/%(prefix)s cli:%(version)s api:%(api_version)s" % {
        "version": get_cli_version(),
        "api_version": get_api_version(),
        "prefix": prefix,
    }
369036
def user_agent(style=None) -> _UserAgent:
    
    global useragent
    if (not useragent) and style:
        useragent = UserAgent()

    return useragent[style] if style else DEFAULT_USER_AGENT
1199958
def create_user(post_data):
        '''
        
        '''
        out_dic = {'success': False, 'code': '00'}

        if not tools.check_username_valid(post_data['user_name']):
            out_dic['code'] = '11'
            return out_dic

        if not tools.check_email_valid(post_data['user_email']):
            out_dic['code'] = '21'
            return out_dic

        try:
            TabMember.create(uid=tools.get_uuid(),
                             user_name=post_data['user_name'],
                             user_pass=tools.md5(post_data['user_pass']),
                             user_email=post_data['user_email'],
                             role='1000',  # ‘1000' as default role.
                             time_create=tools.timestamp(),
                             time_update=tools.timestamp(),
                             time_reset_passwd=tools.timestamp(),
                             time_login=tools.timestamp(),
                             time_email=tools.timestamp())

            out_dic['success'] = True
        except:
            out_dic['code'] = '91'
        return out_dic
1038812
def channels_voice_agent_user_display_create(self, agent_id, user_id, data, **kwargs):
        ""
        api_path = "/api/v2/channels/voice/agents/{agent_id}/users/{user_id}/display.json"
        api_path = api_path.format(agent_id=agent_id, user_id=user_id)
        return self.call(api_path, method="POST", data=data, **kwargs)
122604
def create(self, agent_id, menu_data):
        
        return self._post(
            'menu/create',
            params={
                'agentid': agent_id
            },
            data=menu_data
        )
476523
def user_agent(name, version):
    """"""

    def _interpreter():
        name = platform.python_implementation()
        version = platform.python_version()
        bitness = platform.architecture()[0]
        if name == 'PyPy':
            version = '.'.join(map(str, sys.pypy_version_info[:3]))
        full_version = [version]
        if bitness:
            full_version.append(bitness)
        return name, "-".join(full_version)

    tags = [
        (name, version),
        ("python", platform.python_version()),
        _interpreter(),
        ("machine", platform.machine() or 'unknown'),
        ("system", platform.system() or 'unknown'),
        ("platform", platform.platform() or 'unknown'),
    ]

    return ' '.join("{}/{}".format(name, version) for name, version in tags)
219497
def data_filler_user_agent(self, number_of_rows, pipe):
        '''
        '''

        try:
            for i in range(number_of_rows):
                pipe.hmset('user_agent:%s' % i, {
                    'id': rnd_id_generator(self),
                    'ip': self.faker.ipv4(),
                    'countrycode': self.faker.country_code(),
                    'useragent': self.faker.user_agent()
                })
            pipe.execute()
            logger.warning('user_agent Commits are successful after write job!', extra=d)

        except Exception as e:
            logger.error(e, extra=d)
718095
public function setUserAgent($agentString = '')
    {
        if (!is_string($agentString) || trim($agentString) == '') {
            //https://bugs.php.net/bug.php?id=49184
            if (filter_has_var(INPUT_SERVER, 'HTTP_USER_AGENT')) {
                $agentString = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
            } else if (array_key_exists('HTTP_USER_AGENT', $_SERVER) && is_string($_SERVER['HTTP_USER_AGENT'])) {
                $agentString = filter_var($_SERVER['HTTP_USER_AGENT'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
            } else {
                $agentString = '';
            }

            if ($agentString === false || $agentString === NULL) {
                //filter_input or filter_var failed
                $agentString = '';
            }
        }

        $this->reset();
        $this->_agent = $agentString;
        $this->detect();
    }
1197960
def _contentful_user_agent(self):
        
        header = {}
        from . import __version__
        header['sdk'] = {
            'name': 'contentful-management.py',
            'version': __version__
        }
        header['app'] = {
            'name': self.application_name,
            'version': self.application_version
        }
        header['integration'] = {
            'name': self.integration_name,
            'version': self.integration_version
        }
        header['platform'] = {
            'name': 'python',
            'version': platform.python_version()
        }

        os_name = platform.system()
        if os_name == 'Darwin':
            os_name = 'macOS'
        elif not os_name or os_name == 'Java':
            os_name = None
        elif os_name and os_name not in ['macOS', 'Windows']:
            os_name = 'Linux'
        header['os'] = {
            'name': os_name,
            'version': platform.release()
        }

        def format_header(key, values):
            header = "{0} {1}".format(key, values['name'])
            if values['version'] is not None:
                header = "{0}/{1}".format(header, values['version'])
            return "{0};".format(header)

        result = []
        for k, values in header.items():
            if not values['name']:
                continue
            result.append(format_header(k, values))

        return ' '.join(result)
320225
public function configureFromUserAgentString($string, UserAgentStringParser $parser = null)
    {
        $parser = $parser ?: new UserAgentStringParser();
        $result = $string !== null ? $parser->parse($string) : $parser->parseFromGlobal();

        $this->setUserAgentString($string);
        $this->fromArray($result);
    }
485044
def user_agent():
    
    data = {
        "installer": {"name": "pip", "version": pipenv.patched.notpip.__version__},
        "python": platform.python_version(),
        "implementation": {
            "name": platform.python_implementation(),
        },
    }

    if data["implementation"]["name"] == 'CPython':
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'PyPy':
        if sys.pypy_version_info.releaselevel == 'final':
            pypy_version_info = sys.pypy_version_info[:3]
        else:
            pypy_version_info = sys.pypy_version_info
        data["implementation"]["version"] = ".".join(
            [str(x) for x in pypy_version_info]
        )
    elif data["implementation"]["name"] == 'Jython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()
    elif data["implementation"]["name"] == 'IronPython':
        # Complete Guess
        data["implementation"]["version"] = platform.python_version()

    if sys.platform.startswith("linux"):
        from pipenv.patched.notpip._vendor import distro
        distro_infos = dict(filter(
            lambda x: x[1],
            zip(["name", "version", "id"], distro.linux_distribution()),
        ))
        libc = dict(filter(
            lambda x: x[1],
            zip(["lib", "version"], libc_ver()),
        ))
        if libc:
            distro_infos["libc"] = libc
        if distro_infos:
            data["distro"] = distro_infos

    if sys.platform.startswith("darwin") and platform.mac_ver()[0]:
        data["distro"] = {"name": "macOS", "version": platform.mac_ver()[0]}

    if platform.system():
        data.setdefault("system", {})["name"] = platform.system()

    if platform.release():
        data.setdefault("system", {})["release"] = platform.release()

    if platform.machine():
        data["cpu"] = platform.machine()

    if HAS_TLS:
        data["openssl_version"] = ssl.OPENSSL_VERSION

    setuptools_version = get_installed_version("setuptools")
    if setuptools_version is not None:
        data["setuptools_version"] = setuptools_version

    return "{data[installer][name]}/{data[installer][version]} {json}".format(
        data=data,
        json=json.dumps(data, separators=(",", ":"), sort_keys=True),
    )
1281106
private void setUserAgentsRegEx(List<String> agents) {

        if ((agents == null) || (agents.size() == 0)) {
            setValidConfiguration(false);
            LOG.error(Messages.get().getBundle().key(Messages.LOG_NO_USER_AGENTS_0));
        }
        m_userAgentsRegEx = agents;
    }
537688
async def create(cls, user_id: Union[int, str],
                     is_active: bool = True,
                     is_admin: bool = False,
                     resource_policy: str = None,
                     rate_limit: int = None,
                     fields: Iterable[str] = None) -> dict:
        '''
        
        '''
        if fields is None:
            fields = ('access_key', 'secret_key')
        uid_type = 'Int!' if isinstance(user_id, int) else 'String!'
        q = 'mutation($user_id: {0}, $input: KeyPairInput!) {{'.format(uid_type) + \
            '  create_keypair(user_id: $user_id, props: $input) {' \
            '    ok msg keypair { $fields }' \
            '  }' \
            '}'
        q = q.replace('$fields', ' '.join(fields))
        variables = {
            'user_id': user_id,
            'input': {
                'is_active': is_active,
                'is_admin': is_admin,
                'resource_policy': resource_policy,
                'rate_limit': rate_limit,
            },
        }
        rqst = Request(cls.session, 'POST', '/admin/graphql')
        rqst.set_json({
            'query': q,
            'variables': variables,
        })
        async with rqst.fetch() as resp:
            data = await resp.json()
            return data['create_keypair']
386120
public function user_agent($user_agent = NULL)
	{
		if ($user_agent !== NULL)
		{
			\Request::$user_agent = $user_agent;
			return $this;
		}
		return \Request::$user_agent;
	}