本文整理匯總了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()