reluce / szurubooru-toolkit

Python package and script collection to manage your szurubooru image board.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyszuru.api.SzurubooruHTTPError: TagNotFoundError

shibaobun opened this issue · comments

commented

i have the autotagger set up and it seems to throw an error when trying to add a tag that doesn't exist in the szurubooru instance yet. here's an example stack trace for a tag, and please let me know if this needs to be a bug reported in the szurubooru application or pyszuru instead!
thank you!

Traceback (most recent call last):

File "/usr/local/bin/auto-tagger", line 6, in <module>
  sys.exit(main())
File "/szurubooru-toolkit/src/szurubooru_toolkit/scripts/auto_tagger.py", line 288, in main
  szuru_tag = szuru.api.getTag(tag)
File "/usr/local/lib/python3.11/site-packages/pyszuru/__init__.py", line 29, in getTag
  t.pull()
File "/usr/local/lib/python3.11/site-packages/pyszuru/resource.py", line 105, in pull
  data = self._api._call("GET", self._get_instance_urlparts())
File "/usr/local/lib/python3.11/site-packages/pyszuru/api.py", line 131, in _call
  self._check_api_response(response)
File "/usr/local/lib/python3.11/site-packages/pyszuru/api.py", line 51, in _check_api_response
  raise SzurubooruHTTPError(msg)
  
pyszuru.api.SzurubooruHTTPError: TagNotFoundError: Tag 'easter_egg' not found.
commented

Thanks for the report, it's a bug on my side. I pushed a (potential) fix to the dev branch attached to this issue. Can you checkout that branch and test it?

commented

I'm sorry 😭

[ERROR] [03.08.2023, 03:29:51 UTC] [auto_tagger.<module>]: An error has been caught in function '<module>', process 'MainProcess' (43807), thread 'MainThread' (140646110342016):
Traceback (most recent call last):
  File "/dev-toolkit/src/szurubooru_toolkit/scripts/auto_tagger.py", line 290, in main
    szuru_tag = szuru.api.getTag(tag)
  File "/usr/local/lib/python3.11/site-packages/pyszuru/__init__.py", line 29, in getTag
    t.pull()
  File "/usr/local/lib/python3.11/site-packages/pyszuru/resource.py", line 105, in pull
    data = self._api._call("GET", self._get_instance_urlparts())
  File "/usr/local/lib/python3.11/site-packages/pyszuru/api.py", line 131, in _call
    self._check_api_response(response)
  File "/usr/local/lib/python3.11/site-packages/pyszuru/api.py", line 51, in _check_api_response
    raise SzurubooruHTTPError(msg)
pyszuru.api.SzurubooruHTTPError: TagNotFoundError: Tag 'i-class_destroyer' not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/dev-toolkit/src/szurubooru_toolkit/scripts/auto_tagger.py", line 345, in <module>
    main()
  File "/dev-toolkit/src/szurubooru_toolkit/scripts/auto_tagger.py", line 292, in main
    if 'TagNotFoundError' in msg:
TypeError: argument of type 'SzurubooruHTTPError' is not iterable
commented

I just updated the branch again. Does that one commit do the job?

commented

Yep it's working great now!!! Thank you!!