generate a new session
332732
function generateSession() {
    const session = {};
    // you can alter the cookie options in nexts
    session.cookie = {};
    Object.keys(cookie).forEach((prop) => {
      session.cookie[prop] = cookie[prop];
    });
    return session;
  }
364743
def _get_session(self, session):
        

        if not session:
            logger.debug('(SESSION_CREATE) User: %s' % self._user)
            s = requests.Session()
            s.auth = HTTPBasicAuth(self._user, self._password)
        else:
            logger.debug('(SESSION_CREATE) Object: %s' % session)
            s = session

        s.headers.update(
            {
                'content-type': 'application/json',
                'accept': 'application/json',
                'User-Agent': 'pysnow/%s' % pysnow.__version__
            }
        )

        return s
809345
private Session createNewSession() {
		Session session = model.newSession();
		getProxy().setIgnoreList(model.getOptionsParam().getGlobalExcludeURLParam().getTokensNames());
		return session;
	}
1126944
def generate_session_id(data):
    
    host = data['environ']['HOST']
    tty = data['environ'].get('TTY') or 'NO_TTY'
    return ':'.join(map(str, [
        host, tty, os.getppid(), data['start']]))
889378
def create_database_session(engine):
    """"""

    try:
        Session = sessionmaker(bind=engine)
        return Session()
    except OperationalError as e:
        raise DatabaseError(error=e.orig.args[1], code=e.orig.args[0])
530563
def _create_websession(self):
        """"""
        from socket import AF_INET
        from aiohttp import ClientTimeout, TCPConnector

        _LOGGER.debug('Creating web session')
        conn = TCPConnector(
            family=AF_INET,
            limit_per_host=5,
            enable_cleanup_closed=True,
        )

        # Create session object.
        session_timeout = ClientTimeout(connect=10)
        self._websession = ClientSession(connector=conn,
                                         timeout=session_timeout)
        self._supplied_websession = False
788021
async def sessionstart(self):
        ""
        if not hasattr(self, 'session') or not self.session:
            self.session, setcookies = await call_api(self.container, 'session', 'start', {'cookies':self.rawcookie})
            for nc in setcookies:
                self.sent_cookies = [c for c in self.sent_cookies if c.key != nc.key]
                self.sent_cookies.append(nc)
502590
def initiate_session(config):
    
    global baseurl
    baseurl = config['DEFAULT']['baseurl']
    if 'session' in config['DEFAULT']:
        cookies = {
            'PHPSESSID': config['DEFAULT']['session']
        }
        prof_session.cookies = requests.utils.cookiejar_from_dict(cookies)
    try:
        valid = verify_session(prof_session, baseurl)
        if not valid:
            # Looks like this session is not valid anymore, try to get a new one
            get_session(prof_session, baseurl, config)
        return prof_session
    except:
        print("{baseurl} not reachable. Verify your connection".format(baseurl=baseurl))
        exit(1)
814843
def _create_session(self):
        
        self.driver = requests.Session(**self.driver_args)
        # Set default headers
        self.update_headers(self.current_headers)
        self.update_cookies(self.current_cookies)
        self.set_proxy(self.current_proxy)
775401
def _build_session(self, name, start_info, end_info):
    """"""

    assert start_info is not None
    result = api_pb2.Session(
        name=name,
        start_time_secs=start_info.start_time_secs,
        model_uri=start_info.model_uri,
        metric_values=self._build_session_metric_values(name),
        monitor_url=start_info.monitor_url)
    if end_info is not None:
      result.status = end_info.status
      result.end_time_secs = end_info.end_time_secs
    return result
1275860
function createSession(config, cb) {
  checkOpts(config, cb)

  cb = utils.callOnce(cb)

  var url = config.url
  var key = config.key

  config = {
    url: url,
    key: key
  }

  session.createSession(config, cb)
}
729190
def create_session(self, **params):
        
        return self.make_request(self.PRICING_SESSION_URL,
                                 method='post',
                                 headers=self._session_headers(),
                                 callback=lambda resp: resp.headers[
                                     'location'],
                                 data=params)
900742
def start_session(self):
        
        self.session = self._session_start()
        result = yield gen.Task(self.session.fetch)
        self._set_session_cookie()
        if not self.session.get('ip_address'):
            self.session.ip_address = self.request.remote_ip
        self._last_values()
        raise gen.Return(result)
903288
def do_session(self, args):
        """"""
        filename = 'Not specified' if self.__session.filename is None \
            else self.__session.filename

        print('{0: <30}: {1}'.format('Filename', filename))
1072881
function getSession(apiKey) {
  var session = Sessions.get(apiKey)

  if (session) return session

  session = new Session()
  Sessions.set(apiKey, session)

  return session
}
668631
def add_request_session(self):
        """"""
        session = new_request_session(self.config, self.cookies)
        self.request_sessions[thread.get_ident()] = session
598093
def _new_session(self):
        
        if self.labels:
            return self._database.session(labels=self.labels)
        return self._database.session()