Set a cookie value by name. May optionally include domain and path.
(self, name: str, value: str, domain: str = "", path: str = "/")
| 1115 | self.jar.add_cookie_header(urllib_request) |
| 1116 | |
| 1117 | def set(self, name: str, value: str, domain: str = "", path: str = "/") -> None: |
| 1118 | """ |
| 1119 | Set a cookie value by name. May optionally include domain and path. |
| 1120 | """ |
| 1121 | kwargs = { |
| 1122 | "version": 0, |
| 1123 | "name": name, |
| 1124 | "value": value, |
| 1125 | "port": None, |
| 1126 | "port_specified": False, |
| 1127 | "domain": domain, |
| 1128 | "domain_specified": bool(domain), |
| 1129 | "domain_initial_dot": domain.startswith("."), |
| 1130 | "path": path, |
| 1131 | "path_specified": bool(path), |
| 1132 | "secure": False, |
| 1133 | "expires": None, |
| 1134 | "discard": True, |
| 1135 | "comment": None, |
| 1136 | "comment_url": None, |
| 1137 | "rest": {"HttpOnly": None}, |
| 1138 | "rfc2109": False, |
| 1139 | } |
| 1140 | cookie = Cookie(**kwargs) # type: ignore |
| 1141 | self.jar.set_cookie(cookie) |
| 1142 | |
| 1143 | def get( # type: ignore |
| 1144 | self, |
no outgoing calls