I am trying to check if my cookie is outdated.
I am testing on Facebook.com. I want to avoid logins for every attempt. but when the cookie is outdated all the web pages configurations and classes change so this is why I'm trying to keep my cookie updated.
Mainly I get the cookies from inspect element
-> storage
> copy pasted
everything under facebook.com
to a CSV file and then adding each line of this CSV file to the browser using
def addCookie(self, file):
with open(file) as f:
dict_read = DictReader(f)
list_of_dicts = list(dict_read)
return list_of_dicts
when the script starts.
The code in the main is:
cookies = bot.addCookie(
"facebook_cookies.csv")
for _ in cookies:
bot.add_cookie(_)