Fix wrong request_timeout in anonymous_copy() context

Fixes a tiny mistake introduced with #422.
This commit is contained in:
Alexander Graf 2020-01-26 21:55:46 +01:00 committed by André Koch-Kramer
parent fd13d66367
commit 4e87a8cf63

View File

@ -150,8 +150,8 @@ class Instaloader:
""" """
def __init__(self, def __init__(self,
sleep: bool = True, quiet: bool = False, sleep: bool = True,
request_timeout: Optional[float] = None, quiet: bool = False,
user_agent: Optional[str] = None, user_agent: Optional[str] = None,
dirname_pattern: Optional[str] = None, dirname_pattern: Optional[str] = None,
filename_pattern: Optional[str] = None, filename_pattern: Optional[str] = None,
@ -165,6 +165,7 @@ class Instaloader:
post_metadata_txt_pattern: str = None, post_metadata_txt_pattern: str = None,
storyitem_metadata_txt_pattern: str = None, storyitem_metadata_txt_pattern: str = None,
max_connection_attempts: int = 3, max_connection_attempts: int = 3,
request_timeout: Optional[float] = None,
commit_mode: bool = False): commit_mode: bool = False):
self.context = InstaloaderContext(sleep, quiet, user_agent, max_connection_attempts, request_timeout) self.context = InstaloaderContext(sleep, quiet, user_agent, max_connection_attempts, request_timeout)
@ -194,12 +195,11 @@ class Instaloader:
def anonymous_copy(self): def anonymous_copy(self):
"""Yield an anonymous, otherwise equally-configured copy of an Instaloader instance; Then copy its error log.""" """Yield an anonymous, otherwise equally-configured copy of an Instaloader instance; Then copy its error log."""
new_loader = Instaloader( new_loader = Instaloader(
self.context.sleep, sleep=self.context.sleep,
self.context.request_timeout, quiet=self.context.quiet,
self.context.quiet, user_agent=self.context.user_agent,
self.context.user_agent, dirname_pattern=self.dirname_pattern,
self.dirname_pattern, filename_pattern=self.filename_pattern,
self.filename_pattern,
download_pictures=self.download_pictures, download_pictures=self.download_pictures,
download_videos=self.download_videos, download_videos=self.download_videos,
download_video_thumbnails=self.download_video_thumbnails, download_video_thumbnails=self.download_video_thumbnails,
@ -209,7 +209,9 @@ class Instaloader:
compress_json=self.compress_json, compress_json=self.compress_json,
post_metadata_txt_pattern=self.post_metadata_txt_pattern, post_metadata_txt_pattern=self.post_metadata_txt_pattern,
storyitem_metadata_txt_pattern=self.storyitem_metadata_txt_pattern, storyitem_metadata_txt_pattern=self.storyitem_metadata_txt_pattern,
max_connection_attempts=self.context.max_connection_attempts) max_connection_attempts=self.context.max_connection_attempts,
request_timeout=self.context.request_timeout,
commit_mode=self.commit_mode)
yield new_loader yield new_loader
self.context.error_log.extend(new_loader.context.error_log) self.context.error_log.extend(new_loader.context.error_log)
new_loader.context.error_log = [] # avoid double-printing of errors new_loader.context.error_log = [] # avoid double-printing of errors