Great tool, thanks! I found myself debugging why this wouldn't work:
cj = browsercookie.firefox(
cookie_file="/Users/cwsr/Library/Application Support/Firefox/Profiles/g653fonx.default-release/cookies.sqlite"
)
Traceback (most recent call last):
File "dump_service_now.py", line 7, in <module>
cookie_file="/Users/cwsr/Library/Application Support/Firefox/Profiles/g653fonx.default-release/cookies.sqlite"
File "/Users/cwsr/.virtualenvs/hackability_report/lib/python3.7/site-packages/browsercookie/__init__.py", line 402, in firefox
return Firefox(cookie_file).load()
File "/Users/cwsr/.virtualenvs/hackability_report/lib/python3.7/site-packages/browsercookie/__init__.py", line 87, in load
for cookie in self.get_cookies():
File "/Users/cwsr/.virtualenvs/hackability_report/lib/python3.7/site-packages/browsercookie/__init__.py", line 233, in get_cookies
with create_local_copy(cookie_file) as tmp_cookie_file:
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/Users/cwsr/.virtualenvs/hackability_report/lib/python3.7/site-packages/browsercookie/__init__.py", line 63, in create_local_copy
open(tmp_cookie_file, 'wb').write(open(cookie_file, 'rb').read())
IsADirectoryError: [Errno 21] Is a directory: '/'
And it's because cookie_file at some point gets turned into plural and is expected to be a list:
class BrowserCookieLoader(object):
def __init__(self, cookie_files=None):
cookie_files = cookie_files or self.find_cookie_files()
self.cookie_files = list(cookie_files)
So the fix for me was to pass a list to cookie_file=.
cj = browsercookie.firefox(
cookie_file=["/Users/cwsr/Library/Application Support/Firefox/Profiles/g653fonx.default-release/cookies.sqlite"]
)
I think the best way would be to rename the kwarg to plural, i.e. cookie_files=. I can also do it, but right now I don't feel like I've seen enough source code to implement this in a solid manner.
Great tool, thanks! I found myself debugging why this wouldn't work:
And it's because
cookie_file
at some point gets turned into plural and is expected to be a list:So the fix for me was to pass a list to
cookie_file=
.I think the best way would be to rename the kwarg to plural, i.e.
cookie_files=
. I can also do it, but right now I don't feel like I've seen enough source code to implement this in a solid manner.Thanks for you work! Christian