Make a copy of the bakery client with a the appropriate controller's
        cookiejar in it.
550944
def bakery_client_for_controller(self, controller_name):
        '''
        '''
        bakery_client = self.bakery_client
        if bakery_client:
            bakery_client = copy.copy(bakery_client)
        else:
            bakery_client = httpbakery.Client()
        bakery_client.cookies = self.jujudata.cookies_for_controller(
            controller_name)
        return bakery_client
1359936
def client_cookie_jar(self):
		
		cookie_jar = WHTTPCookieJar()
		cookie_header = self.get_headers('Cookie')
		for cookie_string in (cookie_header if cookie_header is not None else tuple()):
			for single_cookie in WHTTPCookieJar.import_header_text(cookie_string):
				cookie_jar.add_cookie(single_cookie)

		return cookie_jar.ro()
681014
function serializeCookie(cookie) {
  return {
    path: cookie.path,
    name: cookie.key,
    value: cookie.value,
    domain: cookie.domain
  };
}
363650
def create_cookie(name, value, domain, httponly=None, **kwargs):
    """"""

    if domain == 'localhost':
        domain = ''
    config = dict(
        name=name,
        value=value,
        version=0,
        port=None,
        domain=domain,
        path='/',
        secure=False,
        expires=None,
        discard=True,
        comment=None,
        comment_url=None,
        rfc2109=False,
        rest={'HttpOnly': httponly},
    )

    for key in kwargs:
        if key not in config:
            raise GrabMisuseError('Function `create_cookie` does not accept '
                                  '`%s` argument' % key)

    config.update(**kwargs)
    config['rest']['HttpOnly'] = httponly

    config['port_specified'] = bool(config['port'])
    config['domain_specified'] = bool(config['domain'])
    config['domain_initial_dot'] = (config['domain'] or '').startswith('.')
    config['path_specified'] = bool(config['path'])

    return Cookie(**config)
352732
def _make_cookie(self):
        
        return struct.pack(self.COOKIE_FMT, self.COOKIE_MAGIC,
                           os.getpid(), id(self), thread.get_ident())
1071767
def set(self, name, value, **kwargs):
        
        # support client code that unsets cookies by assignment of a None value:
        if value is None:
            remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path'))
            return

        if isinstance(value, Morsel):
            c = morsel_to_cookie(value)
        else:
            c = create_cookie(name, value, **kwargs)
        self.set_cookie(c)
        return c
185340
function JSONCookies (obj) {
  var cookies = Object.keys(obj)
  var key
  var val

  for (var i = 0; i < cookies.length; i++) {
    key = cookies[i]
    val = JSONCookie(obj[key])

    if (val) {
      obj[key] = val
    }
  }

  return obj
}
961252
private function setCookieJar()
    {
        switch($this->options['cookie_type']){
            case 'array':
                $this->cookiejar = new CookieJar();
                break;
            case 'file':
                $this->cookiejar = new FileCookieJar($this->options['cookie_file_name']);
                break;
            case 'session':
                $this->cookiejar = new SessionCookieJar($this->options['cookie_session_key']);
                break;
            default:
                throw new YouHostingException("You didn't specify a valid cookie type!");
        }
    }
1274996
def make_client(api_version, session=None,
                endpoint=None, service_type='monitoring'):
    """"""

    client_cls = utils.get_client_class('monitoring', api_version, VERSION_MAP)
    c = client_cls(
        session=session,
        service_type=service_type,
        endpoint=endpoint,
        app_name='monascaclient',
        app_version=version.version_string,
    )

    return c
1215115
def set_cookie(self, kaka, request):
        """"""

        if not kaka:
            return

        part = urlparse(request.url)
        _domain = part.hostname
        logger.debug("%s: '%s'", _domain, kaka)

        for cookie_name, morsel in kaka.items():
            std_attr = ATTRS.copy()
            std_attr["name"] = cookie_name
            _tmp = morsel.coded_value
            if _tmp.startswith('"') and _tmp.endswith('"'):
                std_attr["value"] = _tmp[1:-1]
            else:
                std_attr["value"] = _tmp

            std_attr["version"] = 0
            # copy attributes that have values
            for attr in morsel.keys():
                if attr in ATTRS:
                    if morsel[attr]:
                        if attr == "expires":
                            std_attr[attr] = _since_epoch(morsel[attr])
                        elif attr == "path":
                            if morsel[attr].endswith(","):
                                std_attr[attr] = morsel[attr][:-1]
                            else:
                                std_attr[attr] = morsel[attr]
                        else:
                            std_attr[attr] = morsel[attr]
                elif attr == "max-age":
                    if morsel["max-age"]:
                        std_attr["expires"] = time.time() + int(morsel["max-age"])

            for att, item in PAIRS.items():
                if std_attr[att]:
                    std_attr[item] = True

            if std_attr["domain"]:
                if std_attr["domain"].startswith("."):
                    std_attr["domain_initial_dot"] = True
            else:
                std_attr["domain"] = _domain
                std_attr["domain_specified"] = True

            if morsel["max-age"] is 0:
                try:
                    self.cookiejar.clear(domain=std_attr["domain"],
                                         path=std_attr["path"],
                                         name=std_attr["name"])
                except ValueError:
                    pass
            elif std_attr["expires"] and std_attr["expires"] < utc_now():
                try:
                    self.cookiejar.clear(domain=std_attr["domain"],
                                         path=std_attr["path"],
                                         name=std_attr["name"])
                except ValueError:
                    pass
            else:
                new_cookie = http_cookiejar.Cookie(**std_attr)
                self.cookiejar.set_cookie(new_cookie)
1337796
def parse_cookie cookie_content
      out = {}
      CGI::Cookie::parse(cookie_content).each do |key, cookie|
        unless ['expires', 'path'].include? key
          out[CGI::escape(key)] = cookie.value[0] ? (CGI::escape(cookie.value[0]) || '') : ''
        end
      end
      out
    end
813730
public final HttpClient cookie(String name, Consumer<? super Cookie> cookieBuilder) {
		return new HttpClientCookie(this, name, cookieBuilder);
	}
643549
def clean_cookie(self):
        """"""
        if not self.is_cookie_necessary:
            return self
        headers = self.request.get('headers', {})
        cookies = SimpleCookie(headers['Cookie'])
        for k, v in cookies.items():
            new_cookie = '; '.join(
                [i.OutputString() for i in cookies.values() if i != v])
            new_request = deepcopy(self.request)
            new_request['headers']['Cookie'] = new_cookie
            self._add_task('Cookie', k, new_request)
        return self
556106
def write_cookies_to_cache(cj, username):
    
    mkdir_p(PATH_COOKIES, 0o700)
    path = get_cookies_cache_path(username)
    cached_cj = cookielib.MozillaCookieJar()
    for cookie in cj:
        cached_cj.set_cookie(cookie)
    cached_cj.save(path)
190368
def copy(self):
		
		copy_cookie = WHTTPCookie(self.__name, self.__value)
		copy_cookie.__attrs = self.__attrs.copy()
		return copy_cookie
407683
async def connect(self, **kwargs):
        
        kwargs.setdefault('loop', self.loop)
        kwargs.setdefault('max_frame_size', self.max_frame_size)
        kwargs.setdefault('bakery_client', self.bakery_client)
        if 'macaroons' in kwargs:
            if not kwargs['bakery_client']:
                kwargs['bakery_client'] = httpbakery.Client()
            if not kwargs['bakery_client'].cookies:
                kwargs['bakery_client'].cookies = GoCookieJar()
            jar = kwargs['bakery_client'].cookies
            for macaroon in kwargs.pop('macaroons'):
                jar.set_cookie(go_to_py_cookie(macaroon))
        self._connection = await Connection.connect(**kwargs)
1177823
public URLConnectionRequestPropertiesBuilder withCookie(String cookieName, String cookieValue) {
        if (requestProperties.containsKey("Cookie")) {
            // there are existing cookies so just append the new cookie at the end
            final String cookies = requestProperties.get("Cookie");
            requestProperties.put("Cookie", cookies + COOKIES_SEPARATOR + buildCookie(cookieName, cookieValue));
        } else {
            // this is the first cookie to be added
            requestProperties.put("Cookie", buildCookie(cookieName, cookieValue));
        }
        return this;
    }