Make check_id() exceptions Non-fatal
The check_id() step, including the get_username_by_id(), which is used to determine whether a profile's account name has changed since the last download using it's unique id when Instaloader is operating logged-in, is actually optional and should not cause termination in any case.
This commit is contained in:
parent
dc748a0541
commit
a7d1c5bbb0
@ -40,6 +40,9 @@ class NonfatalException(InstaloaderException):
|
|||||||
class ProfileNotExistsException(NonfatalException):
|
class ProfileNotExistsException(NonfatalException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class ProfileAccessDeniedException(NonfatalException):
|
||||||
|
pass
|
||||||
|
|
||||||
class ProfileHasNoPicsException(NonfatalException):
|
class ProfileHasNoPicsException(NonfatalException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -91,8 +94,8 @@ def get_username_by_id(session: requests.Session, profile_id: int) -> str:
|
|||||||
"you (id: " + str(profile_id) + ").")
|
"you (id: " + str(profile_id) + ").")
|
||||||
else:
|
else:
|
||||||
if test_login(session):
|
if test_login(session):
|
||||||
raise ConnectionException("Username could not be determined due to connection error" +
|
raise ProfileAccessDeniedException("Username could not be determined due to error {0} (id: {1})."
|
||||||
" (id: "+ str(profile_id) +").")
|
.format(str(resp.status_code), str(profile_id)))
|
||||||
raise LoginRequiredException("Login required to determine username (id: " +
|
raise LoginRequiredException("Login required to determine username (id: " +
|
||||||
str(profile_id) + ").")
|
str(profile_id) + ").")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user