mirror of
https://github.com/instaloader/instaloader.git
synced 2024-08-18 04:39:39 +02:00
download_profiles: raise_errors parameter
With raise_errors=True it behaves like now-deprecated download_profile().
This commit is contained in:
parent
b443cc6654
commit
f988762cb1
@ -776,7 +776,8 @@ class Instaloader:
|
|||||||
tagged: bool = False, highlights: bool = False, stories: bool = False,
|
tagged: bool = False, highlights: bool = False, stories: bool = False,
|
||||||
fast_update: bool = False,
|
fast_update: bool = False,
|
||||||
post_filter: Optional[Callable[[Post], bool]] = None,
|
post_filter: Optional[Callable[[Post], bool]] = None,
|
||||||
storyitem_filter: Optional[Callable[[Post], bool]] = None):
|
storyitem_filter: Optional[Callable[[Post], bool]] = None,
|
||||||
|
raise_errors: bool = False):
|
||||||
"""High-level method to download set of profiles.
|
"""High-level method to download set of profiles.
|
||||||
|
|
||||||
:param profiles: Set of profiles to download.
|
:param profiles: Set of profiles to download.
|
||||||
@ -788,11 +789,19 @@ class Instaloader:
|
|||||||
:param fast_update: :option:`--fast-update`.
|
:param fast_update: :option:`--fast-update`.
|
||||||
:param post_filter: :option:`--post-filter`.
|
:param post_filter: :option:`--post-filter`.
|
||||||
:param storyitem_filter: :option:`--post-filter`.
|
:param storyitem_filter: :option:`--post-filter`.
|
||||||
|
:param raise_errors:
|
||||||
|
Whether :exc:`LoginRequiredException` and :exc:`PrivateProfileNotFollowedException` should be raised or
|
||||||
|
catched and printed with :meth:`InstaloaderContext.error_catcher`.
|
||||||
|
|
||||||
.. versionadded:: 4.1"""
|
.. versionadded:: 4.1"""
|
||||||
|
|
||||||
|
def _error_raiser(_str):
|
||||||
|
yield
|
||||||
|
|
||||||
|
error_handler = _error_raiser if raise_errors else self.context.error_catcher
|
||||||
|
|
||||||
for profile in profiles:
|
for profile in profiles:
|
||||||
with self.context.error_catcher(profile.username):
|
with error_handler(profile.username):
|
||||||
profile_name = profile.username
|
profile_name = profile.username
|
||||||
|
|
||||||
# Save metadata as JSON if desired.
|
# Save metadata as JSON if desired.
|
||||||
|
Loading…
Reference in New Issue
Block a user