MCPcopy Create free account
hub / github.com/Integuru-AI/Integuru / parse_cookie_file_to_dict

Function parse_cookie_file_to_dict

integuru/util/har_processing.py:216–242  ·  view source on GitHub ↗

Parses a JSON cookie file and returns a dictionary of cookie data.

(cookie_file_path: str)

Source from the content-addressed store, hash-verified

214
215
216def parse_cookie_file_to_dict(cookie_file_path: str) -> Dict[str, Dict[str, Any]]:
217 """
218 Parses a JSON cookie file and returns a dictionary of cookie data.
219 """
220 parsed_data = {}
221
222 with open(cookie_file_path, "r") as file:
223 cookies = json.load(file)
224
225 for cookie in cookies:
226 name = cookie.get("name")
227 value = cookie.get("value")
228 domain = cookie.get("domain")
229 path = cookie.get("path")
230
231 if name:
232 parsed_data[name] = {
233 "value": value,
234 "domain": domain,
235 "path": path,
236 "expires": cookie.get("expires"),
237 "httpOnly": cookie.get("httpOnly"),
238 "secure": cookie.get("secure"),
239 "sameSite": cookie.get("sameSite"),
240 }
241
242 return parsed_data

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected