djdembeck/bragibooks

JSONDecodeError

stusemple opened this issue · 2 comments

Hi all

I am having trouble with a Server500 error when I submit ASINs for books. Can anyone help me debug this error further? I've hit a brick wall

Thanks!

2023/09/03 17:11:49 stderr requests.exceptions.JSONDecodeError: Expecting value: line 14 column 1 (char 13)
2023/09/03 17:11:49 stderr raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 975, in json
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr self.metadata_dict = book_api_call.json()
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/m4b_merge/audible_helper.py", line 83, in fetch_api_data
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr metadata = audible_helper.BookData(asin).fetch_api_data(config.api_url)
2023/09/03 17:11:49 stderr File "/home/app/web/utils/merge.py", line 114, in make_book_model
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr book = make_book_model(asin, original_path)
2023/09/03 17:11:49 stderr File "/home/app/web/utils/merge.py", line 96, in create_book
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr book = create_book(asin, original_path)
2023/09/03 17:11:49 stderr File "/home/app/web/importer/views.py", line 122, in post
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr return handler(request, *args, **kwargs)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr return self.dispatch(request, *args, **kwargs)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr response = wrapped_callback(request, *callback_args, **callback_kwargs)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr response = get_response(request)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
2023/09/03 17:11:49 stderr Traceback (most recent call last):
2023/09/03 17:11:49 stderr  
2023/09/03 17:11:49 stderr During handling of the above exception, another exception occurred:
2023/09/03 17:11:49 stderr  
2023/09/03 17:11:49 stderr json.decoder.JSONDecodeError: Expecting value: line 14 column 1 (char 13)
2023/09/03 17:11:49 stderr raise JSONDecodeError("Expecting value", s, err.value) from None
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr return _default_decoder.decode(s)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/json/init.py", line 346, in loads
2023/09/03 17:11:49 stderr ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/09/03 17:11:49 stderr return complexjson.loads(self.text, **kwargs)
2023/09/03 17:11:49 stderr File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 971, in json
2023/09/03 17:11:49 stderr Traceback (most recent call last):
2023/09/03 17:11:49 stderr Internal Server Error: /match
2023/09/03 17:11:48 stderr https://www.audible.com:443 "GET /pderror HTTP/1.1" 404 None
2023/09/03 17:11:48 stderr https://www.audible.com:443 "GET /pd/books/B00DC8GDVC/chapters HTTP/1.1" 301 0
2023/09/03 17:11:47 stderr Starting new HTTPS connection (1): www.audible.com:443
2023/09/03 17:11:47 stderr http://www.audible.com:80 "GET /pd/books/B00DC8GDVC/chapters HTTP/1.1" 301 167
2023/09/03 17:11:47 stderr Starting new HTTP connection (1): www.audible.com:80
2023/09/03 17:11:46 stderr https://www.audible.com:443 "GET /pd/The-Richest-Man-in-Babylon-Audiobook/B00DC8GDVC HTTP/1.1" 200 None
2023/09/03 17:11:46 stderr https://www.audible.com:443 "GET /pd/books/B00DC8GDVC HTTP/1.1" 301 None
2023/09/03 17:11:45 stderr Starting new HTTPS connection (1): www.audible.com:443
2023/09/03 17:11:45 stderr http://www.audible.com:80 "GET /pd/books/B00DC8GDVC HTTP/1.1" 301 167
2023/09/03 17:11:45 stderr Starting new HTTP connection (1): www.audible.com:80
2023/09/03 17:11:45 stderr Making models and merging files for: /input/Richest man in Babylon
2023/09/03 17:11:45 stderr Number of files: 1
2023/09/03 17:11:45 stderr Extension is: None
2023/09/03 17:11:45 stderr Final input path is: /input/Richest man in Babylon
2023/09/03 17:11:45 stderr Found multiple (1) subdirs, using those as input (multi-disc)
2023/09/03 17:11:45 stderr Validated ASIN: B00DC8GDVC
2023/09/03 17:11:44 stderr https://www.audible.com:443 "GET /pd/The-Richest-Man-in-Babylon-Audiobook/B00DC8GDVC HTTP/1.1" 200 None
2023/09/03 17:11:44 stderr https://www.audible.com:443 "GET /pd/books/B00DC8GDVC HTTP/1.1" 301 None
2023/09/03 17:11:43 stderr Starting new HTTPS connection (1): www.audible.com:443
2023/09/03 17:11:43 stderr http://www.audible.com:80 "GET /pd/books/B00DC8GDVC HTTP/1.1" 301 167
2023/09/03 17:11:42 stderr Starting new HTTP connection (1): www.audible.com:80
2023/09/03 17:11:42 stderr POST /match
2023/09/03 17:11:42 stderr POST /match
2023/09/03 17:11:40 stderr -----------------------------------
2023/09/03 17:11:40 stderr [{'ASIN is': 'B0036GMFS0'}, {'Author is': 'George S. Clason'}, {'Date is': '2010-02-03'}, {'Narrator is': 'Jason McCoy'}, {'Region is': 'us'}, {'Score is': '50'}, {'Title is': 'The Richest Man in Babylon'}, {'Image Link is': ['https://m.media-amazon.com/images/I/6179yo5YtlL.SL500.jpg']}]
2023/09/03 17:11:40 stderr Result #25, Score: 50
2023/09/03 17:11:40 stderr No author found in file metadata for The Richest Man in Babylon - B0036GMFS0
2023/09/03 17:11:40 stderr Score deduction from album: 6
2023/09/03 17:11:40 stderr -----------------------------------

Did you set your api endpoint to "audible.com"? That's what it looks like your logs are telling me. It needs to be an Audnexus instance (either self hosted or the public one, which is default).

Thank you so much that solved that error. I must have changed the api url from the default one in my efforts to set up the contianer. For anyone in a similar position the api url is https://api.audnex.us