browser_cookie3
browser_cookie3 copied to clipboard
browser_cookie3 using outdated cookies?
Hello, I am having a problem with browser cookie 3 not returning the most recent cookie values. I'm trying to access to access two different cookies, one of them is correct, but the other one does not have the same value as when I check in chrome dev tools. I have deleted/changed/reloaded the cookie in chrome and it still does not change in my python script. The only thing different about these two cookies is that the one that isn't updating has an expiration date (in a year), while the correct one has no expiration date.
This is what I am using to get the cookie values:
print([i for i in list(browser_cookie3.chrome(domain_name='steamcommunity.com')) if i.name == "steamLoginSecure"][0].value)
print([i for i in list(browser_cookie3.chrome(domain_name='steamcommunity.com')) if i.name == "sessionid"][0].value)
The first one is not updating. I'm not sure about the second one, but the first one is not the same as the value I see in chrome dev tools and I have tried everything to get it to refresh.
Maybe you have different places where the cookies are stored and thus it finds the wrong ones. Depending on your system the cookie file is automatically chosen by the first file it finds, see for the corresponding code lines here: https://github.com/borisbabic/browser_cookie3/blob/53fa5e30a86216ca2064b129b259fa87509b03dd/browser_cookie3/init.py#L591-L617 You can also give directly the path of the correct cookie file to the function call:
browser_cookie3.chrome(cookie_file='path/to/correct/cookie_file', ...)