本文整理匯總了Python中cookielib.Cookie.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Cookie.__init__方法的具體用法?Python Cookie.__init__怎麽用?Python Cookie.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cookielib.Cookie
的用法示例。
在下文中一共展示了Cookie.__init__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from cookielib import Cookie [as 別名]
# 或者: from cookielib.Cookie import __init__ [as 別名]
def __init__(self, cookie_string):
http_only_check = cookie_string.partition('#HttpOnly_')
http_only = bool(http_only_check[1])
if http_only:
cookie_string = http_only_check[-1]
domain, domain_initial_dot, path, secure, expiration, name, value = cookie_string.split('\t')
domain_initial_dot = domain_initial_dot.lower() == 'true'
secure = secure.lower() == 'true'
rest = {'httponly': None} if http_only else {}
expiration = int(expiration) or None
Cookie.__init__(self, version=0, name=name, value=value, port=None, port_specified=False, domain=domain,
domain_specified=bool(domain), domain_initial_dot=domain_initial_dot,
path=path, path_specified=bool(path), secure=secure, expires=expiration,
discard=not expiration, comment=None, comment_url=None, rest=rest, rfc2109=False)