1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-11-04 09:22:29 +01:00

Have default filename argument {load,save}_session

This commit is contained in:
Alexander Graf 2016-07-28 15:40:21 +02:00
parent c69214536a
commit bd2514fcd5

View File

@ -137,7 +137,7 @@ def get_default_session_filename(username):
filename = dirname + "/" + "session-" + username filename = dirname + "/" + "session-" + username
return filename return filename
def save_session(session, username, filename, quiet=False): def save_session(session, username, filename=None, quiet=False):
if filename is None: if filename is None:
filename = get_default_session_filename(username) filename = get_default_session_filename(username)
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
@ -149,7 +149,7 @@ def save_session(session, username, filename, quiet=False):
pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), sessionfile) pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), sessionfile)
log("Saved session to %s." % filename, quiet=quiet) log("Saved session to %s." % filename, quiet=quiet)
def load_session(username, filename, quiet=False): def load_session(username, filename=None, quiet=False):
if filename is None: if filename is None:
filename = get_default_session_filename(username) filename = get_default_session_filename(username)
try: try: