get session for current connection
178064
function(self, socket) {
  var app = self.app,
    sid = socket.id;
  var session = self.session.get(sid);
  if (session) {
    return session;
  }

  session = self.session.create(sid, app.getServerId(), socket);
  logger.debug('[%s] getSession session is created with session id: %s', app.getServerId(), sid);

  // bind events for session
  socket.on('disconnect', session.closed.bind(session));
  socket.on('error', session.closed.bind(session));
  session.on('closed', onSessionClose.bind(null, app));
  session.on('bind', function(uid) {
    logger.debug('session on [%s] bind with uid: %s', self.app.serverId, uid);
    // update connection statistics if necessary
    if (self.connection) {
      self.connection.addLoginedUser(uid, {
        loginTime: Date.now(),
        uid: uid,
        address: socket.remoteAddress.ip + ':' + socket.remoteAddress.port
      });
    }
    self.app.event.emit(events.BIND_SESSION, session);
  });

  session.on('unbind', function(uid) {
    if (self.connection) {
      self.connection.removeLoginedUser(uid);
    }
    self.app.event.emit(events.UNBIND_SESSION, session);
  });

  return session;
}
835903
def get_session_value(self, name, default=None):
        """"""
        session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name)
        return self.request.session.get(session_name, default)
318451
def connect(self):
        

        if self.session and self.session.is_expired:
            # Close the session to avoid max concurrent session errors
            self.disconnect(abandon_session=True)

        if not self.session:

            try:
                login_result = self.login(self.username, self.password)
            except AccountFault:
                log.error('Login failed, invalid username or password')
                raise
            else:
                self.session = login_result.session_id

        self.connected = time()
        return self.connected
739407
def getSession(self):
        """"""
        if self.session is not None:
            return self.session

        # Get value of cookie header that was sent
        cookie_str = self.headers.get('Cookie')
        if cookie_str:
            cookie_obj = SimpleCookie(cookie_str)
            sid_morsel = cookie_obj.get(self.SESSION_COOKIE_NAME, None)
            if sid_morsel is not None:
                sid = sid_morsel.value
            else:
                sid = None
        else:
            sid = None

        # If a session id was not set, create a new one
        if sid is None:
            sid = randomString(16, '0123456789abcdef')
            session = None
        else:
            session = self.server.sessions.get(sid)

        # If no session exists for this session ID, create one
        if session is None:
            session = self.server.sessions[sid] = {}

        session['id'] = sid
        self.session = session
        return session
107166
def session(self):
        
        if self._session is None:
            self._session = urllib2.build_opener(urllib2.HTTPHandler)
        return self._session
671874
def get_my_data(self, session=None):
        
        params = clean_locals(locals())
        method = 'GetMyData'
        (response, elapsed_time) = self.request(method, params, session)
        return response
980917
def _get_connection_info():
    """"""

    info = 'Connection: %s,' % CONN.url
    if CONN.creds is not None:
        info += ' userid=%s,' % CONN.creds[0]
    else:
        info += ' no creds,'

    info += ' cacerts=%s,' % ('sys-default' if CONN.ca_certs is None
                              else CONN.ca_certs)

    info += ' verifycert=%s,' % ('off' if CONN.no_verification else 'on')

    info += ' default-namespace=%s' % CONN.default_namespace
    if CONN.x509 is not None:
        info += ', client-cert=%s' % CONN.x509['cert_file']
        try:
            kf = CONN.x509['key_file']
        except KeyError:
            kf = "none"
        info += ":%s" % kf

    if CONN.timeout is not None:
        info += ', timeout=%s' % CONN.timeout

    # pylint: disable=protected-access
    info += ' stats=%s, ' % ('on' if CONN._statistics else 'off')

    info += 'log=%s' % ('on' if CONN._operation_recorders else 'off')

    if isinstance(CONN, FakedWBEMConnection):
        info += ', mock-server'

    return fill(info, 78, subsequent_indent='    ')
1117503
def getReadSession(self):
        '''  '''
        if self.ReadSession is None:
            self.ReadSession=scoped_session(sessionmaker(bind=self.engine))

        return self.ReadSession
639517
def _get_requests_session():
    """"""
    global requests_session
    if requests_session is not None:
        return requests_session
    import requests

    requests_session = requests.Session()
    adapter = requests.adapters.HTTPAdapter(
        max_retries=environments.PIPENV_MAX_RETRIES
    )
    requests_session.mount("https://pypi.org/pypi", adapter)
    return requests_session
544831
public static function get_session_info() {
        $browser_info = get_browser_info();
        $result = new stdClass;
        $result->ip = get_client_ip();
        $result->browser_info = (object)$browser_info;

        return $result;
    }
355926
def get_session(url):
    
    engine = create_engine(url)
    db_session = scoped_session(sessionmaker(engine))
    Base.metadata.create_all(engine)
    return db_session
419288
def connect(self):
        """"""
        if self.state == DISCONNECTED:
            raise errors.NSQException('connection already closed')

        if self.is_connected:
            return

        stream = Stream(self.address, self.port, self.timeout)
        stream.connect()

        self.stream = stream
        self.state = CONNECTED
        self.send(nsq.MAGIC_V2)
382419
def get_session_data(ctx, username, password, salt, server_public, private, preset):
    """"""
    session = SRPClientSession(
        SRPContext(username, password, prime=preset[0], generator=preset[1]),
        private=private)

    session.process(server_public, salt, base64=True)

    click.secho('Client session key: %s' % session.key_b64)
    click.secho('Client session key proof: %s' % session.key_proof_b64)
    click.secho('Client session key hash: %s' % session.key_proof_hash_b64)
1023002
def session(self):
        """"""
        if self._session is None:
            self._session = cachecontrol.CacheControl(
                requests.Session(),
                cache=caches.FileCache('.tvdb_cache'))
        return self._session
611335
public function getCurrentSessionData()
    {
        $varName = $this->getCurrentVarName();

        return isset($_SESSION[$varName]) ? $_SESSION[$varName] : null;
    }
478704
def attach_session(self):
        """"""
        proc = self.cmd('attach-session', '-t%s' % self.id)

        if proc.stderr:
            raise exc.LibTmuxException(proc.stderr)
782838
def get(self, session):
        
        idle = self.idle_connections
        if idle:
            connection = idle.pop(0)
            connection.lock(session)
            if self.idle_start:
                with self._lock:
                    self.idle_start = None
            return connection.handle
        raise NoIdleConnectionsError(self.id)