MCPcopy
hub / github.com/encode/httpx / set

Method set

httpx/_models.py:1117–1141  ·  httpx/_models.py::Cookies.set

Set a cookie value by name. May optionally include domain and path.

(self, name: str, value: str, domain: str = "", path: str = "/")

Source from the content-addressed store, hash-verified

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

Callers 9

__init__Method · 0.95
__setitem__Method · 0.95
test_cookies_updateFunction · 0.95
test_cookies_with_domainFunction · 0.95
test_cookies_reprFunction · 0.95
sendMethod · 0.45
handle_async_requestMethod · 0.45
restartMethod · 0.45

Calls

no outgoing calls

Tested by 5

test_cookies_updateFunction · 0.76
test_cookies_with_domainFunction · 0.76
test_cookies_reprFunction · 0.76
restartMethod · 0.36