MCPcopy Index your code
hub / github.com/webpy/webpy / cookies

Function cookies

web/webapi.py:564–583  ·  view source on GitHub ↗

Returns a `storage` object with all the request cookies in it. See `storify` for how `requireds` and `defaults` work. This is forgiving on bad HTTP_COOKIE input, it tries to parse at least the cookies it can. The values are converted to unicode if _unicode=True is passed.

(*requireds, **defaults)

Source from the content-addressed store, hash-verified

562
563
564def cookies(*requireds, **defaults):
565 """Returns a `storage` object with all the request cookies in it.
566
567 See `storify` for how `requireds` and `defaults` work.
568
569 This is forgiving on bad HTTP_COOKIE input, it tries to parse at least
570 the cookies it can.
571
572 The values are converted to unicode if _unicode=True is passed.
573 """
574 # parse cookie string and cache the result for next time.
575 if "_parsed_cookies" not in ctx:
576 http_cookie = ctx.env.get("HTTP_COOKIE", "")
577 ctx._parsed_cookies = parse_cookies(http_cookie)
578
579 try:
580 return storify(ctx._parsed_cookies, *requireds, **defaults)
581 except KeyError:
582 badrequest()
583 raise StopIteration()
584
585
586def debug(*args):

Callers

nothing calls this directly

Calls 3

parse_cookiesFunction · 0.85
storifyFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected