mirror of
https://github.com/instaloader/instaloader.git
synced 2024-11-04 09:22:29 +01:00
load_session: don't double check if file can be opened
This commit is contained in:
parent
88219e4d01
commit
1f7fe4ca2f
@ -145,13 +145,12 @@ def save_session(session, filename, quiet=False):
|
|||||||
def load_session(filename, quiet=False):
|
def load_session(filename, quiet=False):
|
||||||
if filename is None:
|
if filename is None:
|
||||||
filename = DEFAULTSESSIONFILE
|
filename = DEFAULTSESSIONFILE
|
||||||
if os.path.isfile(filename):
|
with open(filename, 'rb') as sessionfile:
|
||||||
with open(filename, 'rb') as sessionfile:
|
session = requests.Session()
|
||||||
session = requests.Session()
|
session.cookies = requests.utils.cookiejar_from_dict(pickle.load(sessionfile))
|
||||||
session.cookies = requests.utils.cookiejar_from_dict(pickle.load(sessionfile))
|
session.headers.update(default_http_header())
|
||||||
session.headers.update(default_http_header())
|
log("Loaded session from %s." % filename, quiet=quiet)
|
||||||
log("Loaded session from %s." % filename, quiet=quiet)
|
return session
|
||||||
return session
|
|
||||||
|
|
||||||
def test_login(user, session):
|
def test_login(user, session):
|
||||||
if user is None or session is None:
|
if user is None or session is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user