Return string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring.
(cookie)
| 1830 | |
| 1831 | |
| 1832 | def lwp_cookie_str(cookie): |
| 1833 | """Return string representation of Cookie in the LWP cookie file format. |
| 1834 | |
| 1835 | Actually, the format is extended a bit -- see module docstring. |
| 1836 | |
| 1837 | """ |
| 1838 | h = [(cookie.name, cookie.value), |
| 1839 | ("path", cookie.path), |
| 1840 | ("domain", cookie.domain)] |
| 1841 | if cookie.port is not None: h.append(("port", cookie.port)) |
| 1842 | if cookie.path_specified: h.append(("path_spec", None)) |
| 1843 | if cookie.port_specified: h.append(("port_spec", None)) |
| 1844 | if cookie.domain_initial_dot: h.append(("domain_dot", None)) |
| 1845 | if cookie.secure: h.append(("secure", None)) |
| 1846 | if cookie.expires: h.append(("expires", |
| 1847 | time2isoz(float(cookie.expires)))) |
| 1848 | if cookie.discard: h.append(("discard", None)) |
| 1849 | if cookie.comment: h.append(("comment", cookie.comment)) |
| 1850 | if cookie.comment_url: h.append(("commenturl", cookie.comment_url)) |
| 1851 | |
| 1852 | keys = sorted(cookie._rest.keys()) |
| 1853 | for k in keys: |
| 1854 | h.append((k, str(cookie._rest[k]))) |
| 1855 | |
| 1856 | h.append(("version", str(cookie.version))) |
| 1857 | |
| 1858 | return join_header_words([h]) |
| 1859 | |
| 1860 | class LWPCookieJar(FileCookieJar): |
| 1861 | """ |
searching dependent graphs…