Traceback (most recent call last):
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/flickr_photos_api/api/base.py", line 176, in _call_api
raise exceptions[errors["code"]]
~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: '5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sontag/repos/commons.flickr.org/.venv/bin/commons", line 8, in <module>
sys.exit(main())
^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/src/commons/cli.py", line 41, in update_database
scraper.update_photos_for_user(user_id=m["user"]["id"])
File "/Users/sontag/repos/commons.flickr.org/src/commons/scraper.py", line 39, in update_photos_for_user
total=self.api.count_all_public_photos(user_id=user_id),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/src/commons/api.py", line 255, in count_all_public_photos
resp = self.call(
^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/flickr_photos_api/api/base.py", line 114, in call
return self._call_api(
^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 289, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 379, in __call__
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 314, in iter
return fut.result()
^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 382, in __call__
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/sontag/repos/commons.flickr.org/.venv/lib/python3.12/site-packages/flickr_photos_api/api/base.py", line 178, in _call_api
raise UnrecognisedFlickrApiException(errors)
flickr_photos_api.exceptions.UnrecognisedFlickrApiException: {'code': '5', 'msg': 'User deleted'}
The KeyError at the top of the traceback is confusing – there should be a way to raise the UnrecognisedFlickrApiException without exposing that aspect of the internals.
Example:
The KeyError at the top of the traceback is confusing – there should be a way to raise the
UnrecognisedFlickrApiException
without exposing that aspect of the internals.