Refactor cookie extraction a bit
This commit is contained in:
@@ -41,18 +41,16 @@ compass_cookie = None
|
|||||||
|
|
||||||
for cookie in all_cookies:
|
for cookie in all_cookies:
|
||||||
name_upper = cookie["name"].upper()
|
name_upper = cookie["name"].upper()
|
||||||
if name_upper in target_names:
|
if name_upper not in target_names:
|
||||||
# Process COMPASS cookie separately to pick the one with path '/'
|
continue
|
||||||
if name_upper == "COMPASS":
|
if name_upper == "COMPASS":
|
||||||
if cookie.get("path", "") == "/":
|
if cookie.get("path", "") == "/":
|
||||||
compass_cookie = cookie # select this cookie
|
compass_cookie = cookie
|
||||||
elif not compass_cookie:
|
elif compass_cookie is None:
|
||||||
compass_cookie = cookie # take the first if none with '/' are found yet
|
compass_cookie = cookie
|
||||||
else:
|
else:
|
||||||
# For others, simply store the value
|
|
||||||
extracted[name_upper] = cookie["value"]
|
extracted[name_upper] = cookie["value"]
|
||||||
|
|
||||||
# If we found a COMPASS cookie, add it to the extracted dict.
|
|
||||||
if compass_cookie:
|
if compass_cookie:
|
||||||
extracted["COMPASS"] = compass_cookie["value"]
|
extracted["COMPASS"] = compass_cookie["value"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user