A dictionary of ``http.cookies.Morsel`` objects.
(self)
| 385 | |
| 386 | @property |
| 387 | def cookies(self) -> Dict[str, http.cookies.Morsel]: |
| 388 | """A dictionary of ``http.cookies.Morsel`` objects.""" |
| 389 | if not hasattr(self, "_cookies"): |
| 390 | self._cookies = ( |
| 391 | http.cookies.SimpleCookie() |
| 392 | ) # type: http.cookies.SimpleCookie |
| 393 | if "Cookie" in self.headers: |
| 394 | try: |
| 395 | parsed = parse_cookie(self.headers["Cookie"]) |
| 396 | except Exception: |
| 397 | pass |
| 398 | else: |
| 399 | for k, v in parsed.items(): |
| 400 | try: |
| 401 | self._cookies[k] = v |
| 402 | except Exception: |
| 403 | # SimpleCookie imposes some restrictions on keys; |
| 404 | # parse_cookie does not. Discard any cookies |
| 405 | # with disallowed keys. |
| 406 | pass |
| 407 | return self._cookies |
| 408 | |
| 409 | def full_url(self) -> str: |
| 410 | """Reconstructs the full URL for this request.""" |
nothing calls this directly
no test coverage detected