Patch the current session with Request level operation config.

        This is deprecated, we shouldn't patch the session with
        arguments at the Request, and "config" should be used.
548749
def send(self, request, **kwargs):
        
        session = request.context.session

        old_max_redirects = None
        if 'max_redirects' in kwargs:
            warnings.warn("max_redirects in operation kwargs is deprecated, use config.redirect_policy instead",
                          DeprecationWarning)
            old_max_redirects = session.max_redirects
            session.max_redirects = int(kwargs['max_redirects'])

        old_trust_env = None
        if 'use_env_proxies' in kwargs:
            warnings.warn("use_env_proxies in operation kwargs is deprecated, use config.proxies instead",
                          DeprecationWarning)
            old_trust_env = session.trust_env
            session.trust_env = bool(kwargs['use_env_proxies'])

        old_retries = {}
        if 'retries' in kwargs:
            warnings.warn("retries in operation kwargs is deprecated, use config.retry_policy instead",
                          DeprecationWarning)
            max_retries = kwargs['retries']
            for protocol in self._protocols:
                old_retries[protocol] = session.adapters[protocol].max_retries
                session.adapters[protocol].max_retries = max_retries

        try:
            return self.next.send(request, **kwargs)
        finally:
            if old_max_redirects:
                session.max_redirects = old_max_redirects

            if old_trust_env:
                session.trust_env = old_trust_env

            if old_retries:
                for protocol in self._protocols:
                    session.adapters[protocol].max_retries = old_retries[protocol]
643769
def prepare_request(self, **kwargs):
        

        if self.transport is None:
            self.setup_transport(self.transport_param)
        self.reset()
        self.request_counter = next(REQUEST_COUNTER)
        if kwargs:
            self.setup(**kwargs)
        if self.proxylist.size() and self.config['proxy_auto_change']:
            self.change_proxy()
        self.request_method = self.detect_request_method()
        self.transport.process_config(self)
1334072
def replace(self, scaling_group, name, cooldown, min_entities,
            max_entities, metadata=None):
        
        body = self._create_group_config_body(name, cooldown, min_entities,
                max_entities, metadata=metadata)
        group_id = utils.get_id(scaling_group)
        uri = "/%s/%s/config" % (self.uri_base, group_id)
        resp, resp_body = self.api.method_put(uri, body=body)
596431
def patch(self, url, headers=None, body=None, kwargs=None):
        
        return self._request(
            method='patch',
            url=url,
            headers=headers,
            body=body,
            kwargs=kwargs
        )
522228
def _update_request_context_with_user(self, user=None):
        ''''''

        ctx = _request_ctx_stack.top
        ctx.user = self.anonymous_user() if user is None else user
1045547
def patch(self, **kwargs):
        """"""
        start = datetime.now()
        r = requests.patch(self._url(), auth=(self.key, ""), data=kwargs)
        self._delay_for_ratelimits(start)

        if r.status_code not in self.TRUTHY_CODES:
            return self._handle_request_exception(r)

        # Refetch for safety. We could modify based on response,
        # but I'm afraid of some edge cases and marshal functions.
        self.fetch()
1287520
def set_handler(self, handler):
        
        if self.handler is not None:
            raise Exception('Attempted to overwrite BaseSession handler')

        self.handler = handler
        self.transport_name = self.handler.name

        if self.conn_info is None:
            self.conn_info = handler.get_conn_info()
            self.stats.sessionOpened(self.transport_name)

        return True
1255314
def _request(self, *args, **kwargs):
        # type (Any) -> Response
        """"""
        self._amend_request_kwargs(kwargs)
        _response = self._requests_session.request(*args, **kwargs)
        try:
            _response.raise_for_status()
        except HTTPError as e:
            if e.response is not None:
                raise_from(ConjureHTTPError(e), e)
            raise e
        return _response
243855
def patch():
    
    if getattr(httplib, PATCH_FLAG, False):
        return
    # we set an attribute to avoid multiple wrapping
    setattr(httplib, PATCH_FLAG, True)

    wrapt.wrap_function_wrapper(
        httplib_client_module,
        'HTTPConnection._send_request',
        _send_request
    )

    wrapt.wrap_function_wrapper(
        httplib_client_module,
        'HTTPConnection.getresponse',
        _xray_traced_http_getresponse
    )

    wrapt.wrap_function_wrapper(
        httplib_client_module,
        'HTTPResponse.read',
        _xray_traced_http_client_read
    )
1112068
def send_request(self, *args, **kwargs):
        
        try:
            return self.session.request(*args, **kwargs)
        except ConnectionError:
            self.session.close()
            return self.session.request(*args, **kwargs)
778308
def patch(self, service, path, body, **kwargs):
        
        return self.make_request(Methods.PATCH, service, path, body=body,
                                 **kwargs)
888890
def request(self, method, url, **kwargs):
        
        if 'timeout' not in kwargs:
            if self.timeout is not None:
                kwargs['timeout'] = self.timeout
            else:
                kwargs['timeout'] = (DEFAULT_CONNECT_TIMEOUT,
                                     DEFAULT_READ_TIMEOUT)
        return super(Session, self).request(method=method, url=url, **kwargs)
1242987
public void onSessionDestruction(Request currentRequest, Session session)
	{
		HttpServletResponse response = (HttpServletResponse)httpResponse.get();
		storeSessionDataInCookie(SESSION_TOKEN_KEY, null, response);
		storeSessionDataInCookie(USER_ID_KEY, null, response);
	}
146297
def _reset_session(self):
        
        headers = {"User-Agent": self._user_agent}
        self._session = requests.Session()
        self._session.headers.update(headers)
        self._is_logged_in = False
402161
def _init_session(self, session):
        # type: (requests.Session) -> None
        
        _patch_redirect(session)

        # Change max_retries in current all installed adapters
        max_retries = self.config.retry_policy()
        for protocol in self._protocols:
            session.adapters[protocol].max_retries = max_retries
336718
function() {
  var app = this;
  var config = app.config;
  var cookiesecret = config.cookie_secret;
  if (!cookiesecret) {
    cookiesecret = crypto.randomBytes(64).toString('base64');
    log.warn('no cookie_secret set in config/app.js, randomly choosing %s', cookiesecret);
  }
  app.use(cookieParser(cookiesecret));
  var sessionconfig = {
    secret: cookiesecret,
    resave: false,
    saveUninitialized: false,
  //the rolling feature doesn't impact how long session live on the server-side
  //but it does update the expire time on the session cookie
  //and as a side effect forces the session cookie to be set every request
  //without this the cookie for existing sessions will not be sent if it doesn't have an expires
  //but we need it to be in the case where we downgrade a persistent session to browser-session one
  //when the user logs in again without "rememberme" checked
  //(search for "debug('already set browser-session cookie');" in express-session)
    rolling: !!config.persistentSessionSeconds,
  };
  if (config.sessionfactory) {
    config.sessionfactory(sessionconfig, app, session);
  } else {
    // /es5 needed for node 0.10 and 0.12 compatibility
    var MongoStore = require('connect-mongo/es5')(session);
    sessionconfig.store = new MongoStore({
          url: config.dburl,
          //would be nice to save session natively but that fails if keys have '.' or '$'
          //stringify: false,
          //the session ttl if session.cookie.expires isn't set:
          ttl: config.browsersessionSessionSeconds
    });
  }
  //the session middleware works as follows:
  //if no req.session is set read sessionid out of session cookie and load the session
  //if session cookie isn't present generates a new session
  //at the end of the request the session is stored if modified and set-cookie header is sent

  //XXX express-session deprecated undefined resave option; provide resave option
  //express-session deprecated undefined saveUninitialized option; provide saveUninitialized option

  app.use(session(sessionconfig));
}
18453
def _prepare_put_or_patch(self, kwargs):
        """"""

        requests_params = self._handle_requests_params(kwargs)
        update_uri = self._meta_data['uri']
        session = self._meta_data['bigip']._meta_data['icr_session']
        read_only = self._meta_data.get('read_only_attributes', [])
        return requests_params, update_uri, session, read_only