asks/cookie_utils.py
def parse_cookies(response, host):
    """
    Sticks cookies to a response.
    """
    cookie_pie = []
    try:
        for cookie in response.headers["set-cookie"]:
            cookie_jar = {}
            name_val, *rest = cookie.split(";")
            name, value = name_val.split("=", 1)
            cookie_jar["name"] = name.strip()
            cookie_jar["value"] = value
            for item in rest:
                try:
                    name, value = item.split("=")
                    if value.startswith("."):
                        value = value[1:]
                    cookie_jar[name.lower().lstrip()] = value
                except ValueError:
                    cookie_jar[item.lower().lstrip()] = True
            cookie_pie.append(cookie_jar)
        response.cookies = [Cookie(host, x) for x in cookie_pie]
    except KeyError:
        pass

    Sticks cookies to a response.
    
Sticks cookies to a response.
Sticks cookies to a response .
def parse_cookies(response, host):
    cookie_pie = []
    try:
        for cookie in response.headers["set-cookie"]:
            cookie_jar = {}
            name_val, *rest = cookie.split(";")
            name, value = name_val.split("=", 1)
            cookie_jar["name"] = name.strip()
            cookie_jar["value"] = value
            for item in rest:
                try:
                    name, value = item.split("=")
                    if value.startswith("."):
                        value = value[1:]
                    cookie_jar[name.lower().lstrip()] = value
                except ValueError:
                    cookie_jar[item.lower().lstrip()] = True
            cookie_pie.append(cookie_jar)
        response.cookies = [Cookie(host, x) for x in cookie_pie]
    except KeyError:
        pass
def parse_cookies ( response , host ) : cookie_pie = [ ] try : for cookie in response . headers [ "set-cookie" ] : cookie_jar = { } name_val , * rest = cookie . split ( ";" ) name , value = name_val . split ( "=" , 1 ) cookie_jar [ "name" ] = name . strip ( ) cookie_jar [ "value" ] = value for item in rest : try : name , value = item . split ( "=" ) if value . startswith ( "." ) : value = value [ 1 : ] cookie_jar [ name . lower ( ) . lstrip ( ) ] = value except ValueError : cookie_jar [ item . lower ( ) . lstrip ( ) ] = True cookie_pie . append ( cookie_jar ) response . cookies = [ Cookie ( host , x ) for x in cookie_pie ] except KeyError : pass
Sticks cookies to a response.
Sticks cookies to a response .
"""
    Sticks cookies to a response.
    """
response
host