Gets a user agent for the HTTP Request to twitter
@return string user agent
165698
public function getUserAgent()
    {
        return (!empty($this->userAgent)) ? $this->userAgent : self::NAME . '/' . self::VERSION;
    }
538055
@Override
    public String getUserAgent(){
        String[] uas = new String[]{"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36",
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0",
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/38.0"
        };
        return uas[RandomUtils.nextInt(0,uas.length)]+" "+ RandomStringUtils.randomAlphanumeric(8);
    }
1232514
protected function determineClientUserAgent($request)
    {
        $userAgent = null;
        $serverParams = $request->getServerParams();
        $userAgent = $serverParams['HTTP_USER_AGENT'];

        $checkProxyHeaders = $this->checkProxyHeaders;
        if ($checkProxyHeaders && !empty($this->trustedProxies)) {
            if (!in_array($userAgent, $this->trustedProxies)) {
                $checkProxyHeaders = false;
            }
        }

        if ($checkProxyHeaders) {
            foreach ($this->headersToInspect as $header) {
                if ($request->hasHeader($header)) {
                    $userAgent = trim(current(explode(',', $request->getHeaderLine($header))));
                    break;
                }
            }
        }
        return $userAgent;
    }
238554
function getUserAgent() {
	var format = require('util').format,
		version = require('../package').version;

	return format(
		'analyze-css/%s (%s %s, %s %s)',
		version,
		process.release.name,
		process.version,
		process.platform,
		process.arch
	);
}
1012681
public function user()
    {
        if (!is_null($this->user)) {
            return $this->user;
        }

        if ($this->jwt->setRequest($this->request)->getToken() && $this->jwt->check()) {
            $id = $this->jwt->payload()->get('sub');

            return $this->user = $this->provider->retrieveById($id);
        }
    }
190398
public static function getStream()
    {
        $tweetStore = Store::get('Tweet');

        $consumerKey = Setting::getSetting('twitter', 'consumer_key');
        $consumerSecret = Setting::getSetting('twitter', 'consumer_secret');
        $accessToken = Setting::getSetting('twitter', 'access_token');
        $accessTokenSecret = Setting::getSetting('twitter', 'access_token_secret');
        $streamSearch = Setting::getSetting('twitter', 'stream_search');

        $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);

        if (self::canCallAPI()) {
            self::updateLastAPICall();

            $stream = $twitter->search($streamSearch);

            foreach ($stream as $s) {
                if (!$tweetStore->getByTwitterIdForScope($s->id, 'stream')) {
                    $t = new Tweet;
                    $t->setTwitterId($s->id);
                    $t->setText($s->text);
                    $t->setHtmlText(Twitter::clickable($s));
                    $t->setScreenname($s->user->screen_name);
                    $t->setPosted($s->created_at);
                    $t->setCreatedDate(new \DateTime());
                    $t->setScope('stream');
                    $tweetStore->insert($t);
                }
            }
        }
    }
1284545
public function user()
    {
        // If we've already retrieved the user for the current request we can just
        // return it back immediately. We do not want to fetch the user data on
        // every call to this method because that would be tremendously slow.
        if (! is_null($this->user)) {
            return $this->user;
        }

        $user = null;

        // If a user ID was provided in the JWT, then
        // we should attempt to fetch their profile.
        if (! empty($this->id())) {
            $user = $this->provider->retrieveById($this->id());
        }

        return $this->user = $user;
    }
507608
public function getUserAgent($random = false)
    {
        if ($random === false) {
            return 'Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0';
        }

        $headers = [
            'Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Firefox/31.0',
            'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
            'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36',
            'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36',
            'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0',
            'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36',
            'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0',
        ];

        $randomKey = array_rand($headers);

        return $headers[$randomKey];
    }
547000
def get_user_agent():
    '''
    '''
    version = pkg_resources.require("azurerm")[0].version
    user_agent = "python/{} ({}) requests/{} azurerm/{}".format(
        platform.python_version(),
        platform.platform(),
        requests.__version__,
        version)
    return user_agent
603954
protected function _getUserData(Zend_Service_Twitter $twitterService, $twitterUserId) {
        $twitterUserData = $twitterService->users->show($twitterUserId);
        $userColumns = $this->_mapProperties((array)$twitterUserData->toValue());

        $userModel = new Model_User();
        $userConditions = $userModel->select()->from(
            $userModel->getName(), $this->_getSessionColumns());

        $model = new Model_AuthTwitter();
        $model->bindModel('Model_User', array(
            'conditions' => $userConditions,
            'rule' => 'User'
        ));
        $userData = $model->fetchRow(
            $model->select()
                  ->where('twitter_uid = ?', $twitterUserId)
        );
        if (!$userData || !$userData->Model_User) {
            $userData = $model->createNew($twitterUserId, $userColumns);
        } else {
            $model->getObserver('Authenticatable')->updateLoginStats($userData->user_id);
            $userData = $userData->Model_User;
        }
        return $userData;
    }
273019
public function setUserAgent($userAgent = null)
        {
            if (!empty($userAgent)) {
                return $this->userAgent = $userAgent;
            } else {
                $this->userAgent = null;
                foreach($this->getUaHttpHeaders() as $altHeader) {
                    if(!empty($this->httpHeaders[$altHeader])) { // @todo: should use getHttpHeader(), but it would be slow. (Serban)
                        $this->userAgent .= $this->httpHeaders[$altHeader] . " ";
                    }
                }
                return $this->userAgent = (!empty($this->userAgent) ? trim($this->userAgent) : null);
            }
        }
1287648
public function getRequestUser()
    {
        if ($this->requestUser === null) {
            $token = $this->getRequestApiToken();
            if ($token === '') {
                $this->requestUser = 'no-token';
            } else {
                $ip = $this->app->make('ip');
                if ($ip->isBanned()) {
                    $this->requestUser = 'banned';
                } else {
                    $requestUser = null;
                    $list = new UserList();
                    $list->disableAutomaticSorting();
                    $list->filterByAttribute('api_token', $token);
                    $ids = $list->getResultIDs();
                    if (!empty($ids)) {
                        $u = \User::getByUserID($ids[0]);
                        if ($u->isRegistered()) {
                            $requestUser = $u;
                        }
                    }
                    if ($requestUser === null) {
                        $this->requestUser == 'invalid-token';
                        $ip->logSignupRequest();
                        if ($ip->signupRequestThreshholdReached()) {
                            $ip->createIPBan();
                        }
                    } else {
                        $this->requestUser = $requestUser;
                    }
                }
            }
        }
        if ($this->requestUser === 'no-token') {
            throw AccessDeniedException::create(t('API Access Token required'));
        }
        if ($this->requestUser === 'banned') {
            throw AccessDeniedException::create($this->app->make('ip')->getErrorMessage());
        }
        if ($this->requestUser === 'invalid-token') {
            throw AccessDeniedException::create(t('Bad API Access Token'));
        }

        return $this->requestUser;
    }
524774
public function getDefaultUserAgent(): string
    {
        if (! $this->defaultUserAgent) {
            $currentMethodName = __FUNCTION__;
            $isAdapterUserAgent = method_exists($this->getAdapter(), $currentMethodName);
            if ($isAdapterUserAgent) {
                $this->defaultUserAgent = $this->getAdapter()->$currentMethodName();
            } else {
                $defaultAgent = 'Swoft/' . App::version();
                if (! Coroutine::isSupportCoroutine() && \extension_loaded('curl') && \function_exists('curl_version')) {
                    $defaultAgent .= ' curl/' . \curl_version()['version'];
                }
                $defaultAgent .= ' PHP/' . PHP_VERSION;
                $this->defaultUserAgent = $defaultAgent;
            }
        }

        return $this->defaultUserAgent;
    }
427204
public function getUserAgentByCommonLib()
    {
        $this->autoPopulateSuperGlobals();
        if (!is_null($this->brServerGlobals->get('ua'))) {
            return $this->brServerGlobals->get('ua');
        }
        return $this->getUserAgentByCommonLibDetection();
    }
832996
public function user() {
		$user = (int) $this->request->param('ID');
		
		$since = $this->owner->getRequest()->getVar('since');
		$offset = (int) $this->owner->getRequest()->getVar('before');
		if (!$offset) {
			$offset = false;
		}
		$filter = array('OwnerID' => $user);
		$tags = $this->getFilterTags();
		$target = $this->getTargetFilter();
		if ($target) {
			$filter['Target'] = $target;
		}
		
		$sort = $this->request->getVar('sort');
		if (!$sort) {
			$sort = 'ID';
		}
		
		
		$data = $this->owner->microBlogService->getStatusUpdates($filter, $sort, $since, $offset, $toplevel = true, $tags);
		
		$props = array(
			'Posts' => $data, 
			'Options' => $this->getOptions(),
			'QueryOffset'	=> $data->QueryOffset,
			'Target'		=> $target,
			'SortBy'		=> $sort
		);
		
		$timeline = trim($this->customise($props)->renderWith('Timeline'));

		if (Director::is_ajax()) {
			return $timeline;
		}

		$data = array(
			'Timeline'		=> '<strong>WARNING: USER VIEWS ARE IN ALPHA </strong>' . $timeline,
			'OwnerFeed'		=> $timeline,
		);

		return $this->customise($data)->renderWith(array('FullTimeline', 'Page'));
	}
2746
private function getUserAgent()
    {
        $curlinfo = curl_version();
        $uagent = array();
        $uagent[] = 'gocardless-pro-php/3.0.0';
        $uagent[] = 'schema-version/2015-07-06';
        $uagent[] = 'GuzzleHttp/' . \GuzzleHttp\Client::VERSION;
        $uagent[] = 'php/' . phpversion();
        if (extension_loaded('curl') && function_exists('curl_version')) {
            $uagent[] = 'curl/' . \curl_version()['version'];
            $uagent[] = 'curl/' . \curl_version()['host'];
        }
        return implode(' ', $uagent);
    }
971403
public static function getUserAgent($request, $override_sideloaded_browser_ua = true)
    {
        if (!$override_sideloaded_browser_ua) {
            return $request['HTTP_USER_AGENT'];
        }

        if (isset($request[WURFL_Constants::UA])) {
            return $request[WURFL_Constants::UA];
        }
        
        foreach (self::$userAgentSearchOrder as $header) {
            if (isset($request[$header])) {
                return $request[$header];
            }
        }
        
        return '';
    }