1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-08-17 12:19:38 +02:00

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:
Alexander Graf 2017-04-10 21:05:58 +02:00
parent dc748a0541
commit a7d1c5bbb0

View File

@ -40,6 +40,9 @@ class NonfatalException(InstaloaderException):
class ProfileNotExistsException(NonfatalException):
pass
class ProfileAccessDeniedException(NonfatalException):
pass
class ProfileHasNoPicsException(NonfatalException):
pass
@ -91,8 +94,8 @@ def get_username_by_id(session: requests.Session, profile_id: int) -> str:
"you (id: " + str(profile_id) + ").")
else:
if test_login(session):
raise ConnectionException("Username could not be determined due to connection error" +
" (id: "+ str(profile_id) +").")
raise ProfileAccessDeniedException("Username could not be determined due to error {0} (id: {1})."
.format(str(resp.status_code), str(profile_id)))
raise LoginRequiredException("Login required to determine username (id: " +
str(profile_id) + ").")