Skip to content

Commit

Permalink
Handle explicitly passed None value
Browse files Browse the repository at this point in the history
tomquirk#128 adds the ability to customize cookie dir. But
it also allows passing `None` as an argument for `cookies_dir`, which
raises `TypeError` while calling `os.path.exists(self.cookie_dir)`.

Setting `cookies_dir`'s default value to `None` and handling `None`
while setting it to the `self` fixes this unexpected behavior.
  • Loading branch information
burakyilmaz321 committed Nov 1, 2020
1 parent bf6a8b0 commit c0401a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions linkedin_api/cookie_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class CookieRepository(object):
TODO: refactor to use http.cookiejar.FileCookieJar
"""

def __init__(self, cookies_dir=settings.COOKIE_PATH):
self.cookies_dir = cookies_dir
def __init__(self, cookies_dir=None):
self.cookies_dir = cookies_dir if cookies_dir else settings.COOKIE_PATH

def save(self, cookies, username):
self._ensure_cookies_dir()
Expand Down

0 comments on commit c0401a7

Please sign in to comment.