Szwendacz99 / BookStack-Python-exporter

Customizable script for exporting notes from BookStack through API. Export Pages, Chapters, Books, attachments and images.
MIT License
23 stars 3 forks source link

Error when getting info about image-gallery #14

Closed csmith73 closed 1 month ago

csmith73 commented 1 month ago

I am getting the following error when the script tries to get info about the image-gallery. I am using bookstack v22.06.2

INFO :: Getting info about Image gallery. DEBUG :: Making http request: http://10.10.10.38/api/image-gallery?count=50&offset=0 Traceback (most recent call last): File "C:\Users\csmith\Downloads\BookStack-Python-exporter-main\BookStack-Python-exporter-main\exporter.py", line 660, in <module> for image_data in api_get_listing('image-gallery'): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\csmith\Downloads\BookStack-Python-exporter-main\BookStack-Python-exporter-main\exporter.py", line 407, in api_get_listing api_get_bytes(path, count=count, offset=len(result))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\csmith\Downloads\BookStack-Python-exporter-main\BookStack-Python-exporter-main\exporter.py", line 379, in api_get_bytes with urlopen(request) as response: ^^^^^^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 521, in open response = meth(req, response) ^^^^^^^^^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 630, in http_response response = self.parent.error( ^^^^^^^^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 559, in error return self._call_chain(*args) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "C:\Python_Install\3_12_3\Lib\urllib\request.py", line 639, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

Szwendacz99 commented 1 month ago

That is pretty old version of BookStack, so the most reasonable fix would be to upgrade it. Otherwise you could just remove --images argument for the script, so images won't be downloaded. I can't tell how API endpoints looked like in that version of BookStack, but if the gallery endpoint was not there yet, there is probably no reasonable "fix" to do in this exporter script, as it depends on what BookStack API provide.

csmith73 commented 1 month ago

Okay thanks. That is what I figured but just wanted to double check. Trying to upgrade bookstack now but not having much luck.

csmith73 commented 1 month ago

I was able to update bookstack and now the script works great. Thanks!

Szwendacz99 commented 1 month ago

ok, I close the issue then