Setup koji client session
975001
def setup_kojiclient(profile):
    
    opts = koji.read_config(profile)
    for k, v in opts.iteritems():
        opts[k] = os.path.expanduser(v) if type(v) is str else v
    kojiclient = koji.ClientSession(opts['server'], opts=opts)
    kojiclient.ssl_login(opts['cert'], None, opts['serverca'])
    return kojiclient
1350311
def load_session_from_file(self, username, sessionfile):
        """"""
        session = requests.Session()
        session.cookies = requests.utils.cookiejar_from_dict(pickle.load(sessionfile))
        session.headers.update(self._default_http_header())
        session.headers.update({'X-CSRFToken': session.cookies.get_dict()['csrftoken']})
        self._session = session
        self.username = username
907499
def _build_cookie_jar(cls, session: AppSession):
        ''''''

        if not session.args.cookies:
            return

        if session.args.load_cookies or session.args.save_cookies:
            session.factory.set('CookieJar', BetterMozillaCookieJar)

            cookie_jar = session.factory.new('CookieJar')

            if session.args.load_cookies:
                cookie_jar.load(session.args.load_cookies, ignore_discard=True)
        else:
            cookie_jar = session.factory.new('CookieJar')

        policy = session.factory.new('CookiePolicy', cookie_jar=cookie_jar)

        cookie_jar.set_policy(policy)

        _logger.debug(__('Loaded cookies: {0}', list(cookie_jar)))

        cookie_jar_wrapper = session.factory.new(
            'CookieJarWrapper',
            cookie_jar,
            save_filename=session.args.save_cookies,
            keep_session_cookies=session.args.keep_session_cookies,
        )

        return cookie_jar_wrapper
125984
protected void init() {
    if (settings.autostart()) {
      runner = settings.getRunner();
      logger.config("Using runner " + runner.getClass().getSimpleName());
    } else {
      settings.setPort(OperaDefaults.SERVER_DEFAULT_PORT_IDENTIFIER);
    }

    createScopeServices();

    // Launch Opera if the runner has been setup
    if (runner != null) {
      runner.startOpera();
    }

    services.init();
    debugger = services.getDebugger();
    debugger.setDriver(this);

    windowManager = services.getWindowManager();
    exec = services.getExec();
    core = services.getCore();
    cookieManager = services.getCookieManager();
    //cookieManager.updateCookieSettings();

    mouse = new OperaMouse(this);
    keyboard = new OperaKeyboard(this);
    services.getConsoleLogger().onConsoleMessage(new ConsoleMessageConverter(logs));

    // Get product from Opera
    settings.setProduct(utils().getProduct());

    // TODO(andreastt): Expose profile on core service
    if (!utils().getUserAgent().contains("Mini")) {
      preferences = new OperaScopePreferences(services.getPrefs());

      // Enable popups for testing purposes
      preferences().set("User Prefs", "Ignore Unrequested Popups", false);

      // Mobile has disabled JavaScript autofocus for usability reasons
      if (utils().getProduct().is(MOBILE)) {
        preferences().set("User Prefs", "Allow Autofocus Form Element", true);
      }
    }

    // Update browser's proxy configuration
    proxy = new OperaProxy(this);
    proxy.parse(settings.getProxy());
  }
101898
function init(options) {
  options = options || {}
  var port = options.port || 6466
  global.client = global.client || socketIOClient(`http://localhost:${port}`)
  client = global.client
  log.debug(`Started global js socketIO client for ${process.env.ADAPTER} at ${port}`)
  client.emit('join', ioid) // first join for serialization
  client.on('disconnect', client.disconnect)
  client.on('take', hasher.handle) // add listener
  
  // add methods
  client.pass = pass
  client.clientPass = clientPass
  return client
}
1344090
def setup_client(token)
      client = Octokit::Client.new(access_token: token)
      client.auto_paginate = true
      client
    end
793150
def render_koji(self):
        
        phase = 'prebuild_plugins'
        plugin = 'koji'
        if not self.dj.dock_json_has_plugin_conf(phase, plugin):
            return

        if self.spec.yum_repourls.value:
            logger.info("removing koji from request "
                        "because there is yum repo specified")
            self.dj.remove_plugin(phase, plugin)
        elif not (self.spec.koji_target.value and
                  self.spec.kojiroot.value and
                  self.spec.kojihub.value):
            logger.info("removing koji from request as not specified")
            self.dj.remove_plugin(phase, plugin)
        else:
            self.dj.dock_json_set_arg(phase, plugin,
                                      "target", self.spec.koji_target.value)
            self.dj.dock_json_set_arg(phase, plugin,
                                      "root", self.spec.kojiroot.value)
            self.dj.dock_json_set_arg(phase, plugin,
                                      "hub", self.spec.kojihub.value)
            if self.spec.proxy.value:
                self.dj.dock_json_set_arg(phase, plugin,
                                          "proxy", self.spec.proxy.value)
138542
def get_session(user_agent):
    """"""

    client = requests.Session()
    client.headers.update({
        'Content-Type': 'application/json',
        'User-Agent': user_agent,
    })
    retry = Retry(connect=3, backoff_factor=3)
    adapter = HTTPAdapter(max_retries=retry)
    client.mount('https://', adapter)
    return client
83935
function init(ctx) {
        var server = ctx.server;

        return registerCookieJar(server)
            .then(function () {
                registerJwtCookie(server);
                server.ext('onPreAuth', getJwtFromCookie);

                return new Q(ctx);
            });
    }
1115215
function Session(identity, connection, options) {
  if (!(this instanceof Session)) {
    return new Session(identity, connection, options);
  }

  assert(identity instanceof Identity, 'Invalid identity supplied');

  if (!(connection instanceof Connection)) {
    options = connection || {};
    options.passive = true;
  }

  this.options = merge(Object.create(Session.DEFAULTS), options);
  this.client = new Client(identity);
  this._identity = identity;

  if (!this.options.passive) {
    this._connection = connection;
    this._connection.open(this._onConnect.bind(this));
  } else {
    this._onConnect();
  }

  if (this.options.subscribe) {
    this.client.on('message', this._onMessage.bind(this)).subscribe();
  }
}
444521
function(opts){
  //setup options
  this.opts = new ObjectManage({
    username: '',
    password: '',
    domain: 'cdn.oose.io',
    prism: {
      host: null,
      port: 5971
    }
  })
  this.opts.$load(opts)
  //set properties
  this.api = {}
  this.authenticated = false
  this.connected = false
  this.session = {}
}
894389
def setup(self):
        '''
        
        '''
        self.zoo_client.add_listener(self.state_listener)

        if self.ensure:
            self.zoo_client.ensure_path(self.my_file)
999599
protected function setUpSession () {
		if ($this->session === NULL) {
			$sessionClass = $this->application->GetSessionClass();
			$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
			$this->session = $sessionClass::GetNamespace($selfClass);
			$this->session->SetExpirationSeconds($this->sessionExpirationSeconds);
		}
	}
169735
private ClientSession newSession() {
    ClientSession session = new ClientSession(clientId, transport.client(), selector, ioContext, connectionStrategy, sessionTimeout,
                                              unstabilityTimeout
    );

    // Update the session change listener.
    if (changeListener != null)
      changeListener.close();
    changeListener = session.onStateChange(this::onStateChange);

    // Register all event listeners.
    eventListeners.forEach(l -> l.register(session));
    return session;
  }
779202
public void clientSessionDidStart (PresentsSession client)
    {
        if (ignoreClient(client)) {
            return;
        }

        // create and publish a ClientInfo record for this client
        ClientInfo clinfo = createClientInfo();
        initClientInfo(client, clinfo);

        // sanity check
        if (_nodeobj.clients.contains(clinfo)) {
            log.warning("Received clientSessionDidStart() for already registered client!?",
                        "old", _nodeobj.clients.get(clinfo.getKey()), "new", clinfo);
            // go ahead and update the record
            _nodeobj.updateClients(clinfo);
        } else {
            _nodeobj.addToClients(clinfo);
        }
    }
1081617
def setup(self):
        """"""
        if self.dry_run is not True:
            self.client = self._get_client()
            self._disable_access_key()
654283
public function sessionInit()
    {
        ini_set('session.auto_start', 0);
        $config = Container::get('config')->get('session');
        if ($config['adapter'] != '') {
            $class = '\\Kotori\\Http\\Session\\' . ucfirst($config['adapter']);
            if (!class_exists($class) || !session_set_save_handler(new $class($config))) {
                throw new NotFoundException('error session handler:' . $class);
            }
        }

        session_name('KOTORI_SESSID');
        if (isset($config['auto_start']) && $config['auto_start']) {
            session_start();
            $this->hasSessionStarted = true;
        }
    }