Fix logging out when download profile_pic fails
Add try-finally-block to InstaloaderContext.anonymous_copy(). Fixes #159.
This commit is contained in:
parent
dcea0e9672
commit
77ca78e977
@ -75,10 +75,12 @@ class InstaloaderContext:
|
|||||||
username = self.username
|
username = self.username
|
||||||
self._session = self.get_anonymous_session()
|
self._session = self.get_anonymous_session()
|
||||||
self.username = None
|
self.username = None
|
||||||
yield self
|
try:
|
||||||
self._session.close()
|
yield self
|
||||||
self.username = username
|
finally:
|
||||||
self._session = session
|
self._session.close()
|
||||||
|
self.username = username
|
||||||
|
self._session = session
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_logged_in(self) -> bool:
|
def is_logged_in(self) -> bool:
|
||||||
|
@ -552,6 +552,8 @@ class Profile:
|
|||||||
@property
|
@property
|
||||||
def has_viewable_story(self) -> bool:
|
def has_viewable_story(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
.. deprecated:: 4.0.6
|
||||||
|
|
||||||
Some stories are private. This property determines if the :class:`Profile`
|
Some stories are private. This property determines if the :class:`Profile`
|
||||||
has at least one story which can be viewed using the associated :class:`InstaloaderContext`,
|
has at least one story which can be viewed using the associated :class:`InstaloaderContext`,
|
||||||
i.e. the viewer has privileges to view it.
|
i.e. the viewer has privileges to view it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user