1 from typing import Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload
\r
2 from http.client import HTTPResponse
\r
3 from urllib.request import Request
\r
7 class LoadError(OSError): ...
\r
10 class CookieJar(Iterable['Cookie']):
\r
11 def __init__(self, policy: Optional['CookiePolicy'] = ...) -> None: ...
\r
12 def add_cookie_header(self, request: Request) -> None: ...
\r
13 def extract_cookies(self, response: HTTPResponse,
\r
14 request: Request) -> None: ...
\r
15 def set_policy(self, policy: 'CookiePolicy') -> None: ...
\r
16 def make_cookies(self, response: HTTPResponse,
\r
17 request: Request) -> Sequence['Cookie']: ...
\r
18 def set_cookie(self, cookie: 'Cookie') -> None: ...
\r
19 def set_cookie_if_ok(self, cookie: 'Cookie',
\r
20 request: Request) -> None: ...
\r
21 def clear(self, domain: str = ..., path: str = ...,
\r
22 name: str = ...) -> None: ...
\r
23 def clear_session_cookies(self) -> None: ...
\r
24 def __iter__(self) -> Iterator['Cookie']: ...
\r
25 def __len__(self) -> int: ...
\r
27 class FileCookieJar(CookieJar):
\r
28 filename = ... # type: str
\r
29 delayload = ... # type: bool
\r
30 def __init__(self, filename: str = ..., delayload: bool = ...,
\r
31 policy: Optional['CookiePolicy'] = ...) -> None: ...
\r
32 def save(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
\r
33 ignore_expires: bool = ...) -> None: ...
\r
34 def load(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
\r
35 ignore_expires: bool = ...) -> None: ...
\r
36 def revert(self, filename: Optional[str] = ..., ignore_discard: bool = ...,
\r
37 ignore_expires: bool = ...) -> None: ...
\r
39 class MozillaCookieJar(FileCookieJar): ...
\r
40 class LWPCookieJar(FileCookieJar): ...
\r
44 netscape = ... # type: bool
\r
45 rfc2965 = ... # type: bool
\r
46 hide_cookie2 = ... # type: bool
\r
47 def set_ok(self, cookie: 'Cookie', request: Request) -> bool: ...
\r
48 def return_ok(self, cookie: 'Cookie', request: Request) -> bool: ...
\r
49 def domain_return_ok(self, domain: str, request: Request) -> bool: ...
\r
50 def path_return_ok(self, path: str, request: Request) -> bool: ...
\r
53 class DefaultCookiePolicy(CookiePolicy):
\r
54 rfc2109_as_netscape = ... # type: bool
\r
55 strict_domain = ... # type: bool
\r
56 strict_rfc2965_unverifiable = ... # type: bool
\r
57 strict_ns_unverifiable = ... # type: bool
\r
58 strict_ns_domain = ... # type: int
\r
59 strict_ns_set_initial_dollar = ... # type: bool
\r
60 strict_ns_set_path = ... # type: bool
\r
61 DomainStrictNoDots = ... # type: int
\r
62 DomainStrictNonDomain = ... # type: int
\r
63 DomainRFC2965Match = ... # type: int
\r
64 DomainLiberal = ... # type: int
\r
65 DomainStrict = ... # type: int
\r
66 def __init__(self, blocked_domains: Optional[Sequence[str]] = ...,
\r
67 allowed_domains: Optional[Sequence[str]] = ...,
\r
68 netscape: bool = ...,
\r
69 rfc2965: bool = ...,
\r
70 rfc2109_as_netscape: Optional[bool] = ...,
\r
71 hide_cookie2: bool = ..., strict_domain: bool = ...,
\r
72 strict_rfc2965_unverifiable: bool =...,
\r
73 strict_ns_unverifiable: bool = ...,
\r
74 strict_ns_domain: int = ...,
\r
75 strict_ns_set_initial_dollar: bool = ...,
\r
76 strict_ns_set_path: bool = ...) -> None: ...
\r
77 def blocked_domains(self) -> Tuple[str, ...]: ...
\r
78 def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ...
\r
79 def is_blocked(self, domain: str) -> bool: ...
\r
80 def allowed_domains(self) -> Optional[Tuple[str, ...]]: ...
\r
81 def set_allowed_domains(self, allowed_domains: Optional[Sequence[str]]) -> None: ...
\r
82 def is_not_allowed(self, domain: str) -> bool: ...
\r
86 version = ... # type: Optional[int]
\r
87 name = ... # type: str
\r
88 value = ... # type: Optional[str]
\r
89 port = ... # type: Optional[str]
\r
90 path = ... # type: str
\r
91 secure = ... # type: bool
\r
92 expires = ... # type: Optional[int]
\r
93 discard = ... # type: bool
\r
94 comment = ... # type: Optional[str]
\r
95 comment_url = ... # type: Optional[str]
\r
96 rfc2109 = ... # type: bool
\r
97 port_specified = ... # type: bool
\r
98 domain_specified = ... # type: bool
\r
99 domain_initial_dot = ... # type: bool
\r
100 def has_nonstandard_attr(self, name: str) -> bool: ...
\r
102 def get_nonstandard_attr(self, name: str) -> Optional[str]: ...
\r
104 def get_nonstandard_attr(self, name: str, default: _T = ...) -> Union[str, _T]: ...
\r
105 def set_nonstandard_attr(self, name: str, value: str) -> None: ...
\r
106 def is_expired(self, now: int = ...) -> bool: ...
\r