本文整理汇总了Python中Cookie.__setitem__方法的典型用法代码示例。如果您正苦于以下问题:Python Cookie.__setitem__方法的具体用法?Python Cookie.__setitem__怎么用?Python Cookie.__setitem__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie.__setitem__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Cookie [as 别名]
# 或者: from Cookie import __setitem__ [as 别名]
def __init__(self):
# Set defaults
self.key = self.value = self.coded_value = None
# Set default attributes
for K in self._reserved:
dict.__setitem__(self, K, "")
# end __init__
示例2: __setitem__
# 需要导入模块: import Cookie [as 别名]
# 或者: from Cookie import __setitem__ [as 别名]
def __setitem__(self, K, V):
K = K.lower()
if not K in self._reserved:
raise CookieError("Invalid Attribute %s" % K)
dict.__setitem__(self, K, V)
# end __setitem__
示例3: __set
# 需要导入模块: import Cookie [as 别名]
# 或者: from Cookie import __setitem__ [as 别名]
def __set(self, key, real_value, coded_value):
"""Private method for setting a cookie's value"""
M = self.get(key, Morsel())
M.set(key, real_value, coded_value)
dict.__setitem__(self, key, M)
# end __set
示例4: load
# 需要导入模块: import Cookie [as 别名]
# 或者: from Cookie import __setitem__ [as 别名]
def load(self, rawdata):
"""Load cookies from a string (presumably HTTP_COOKIE) or
from a dictionary. Loading cookies from a dictionary 'd'
is equivalent to calling:
map(Cookie.__setitem__, d.keys(), d.values())
"""
if type(rawdata) == type(""):
self.__ParseString(rawdata)
else:
# self.update() wouldn't call our custom __setitem__
for k, v in rawdata.items():
self[k] = v
return
# end load()