Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

habanero_utils.py gives TypeError on api.crossref.org 404 err #116

Closed
joej opened this issue Jun 16, 2023 · 4 comments
Closed

habanero_utils.py gives TypeError on api.crossref.org 404 err #116

joej opened this issue Jun 16, 2023 · 4 comments
Labels
Milestone

Comments

@joej
Copy link

joej commented Jun 16, 2023

I called habanero.Crossref.prefixes() or habanero.Crossref.prefixes( dois=['10.1529] ) ... doesn't matter, likely a "bad query"
But the end result is that api.crossref.org gives a 404 w/error message that habanero_utils.py doesn't handle well.

File "./publisher_prefixes.py", line 98, in
data = cr.prefixes(dois=[ '10.1529'] )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.11/site-packages/habanero/crossref/crossref.py", line 608, in prefixes
return request(
^^^^^^^^
File "venv/lib/python3.11/site-packages/habanero/request.py", line 84, in request
raise RequestError(r.status_code, parse_json_err(r))
^^^^^^^^^^^^^^^^^
File "venv/lib/python3.11/site-packages/habanero/habanero_utils.py", line 64, in parse_json_err
return x.json()["message"][0]["message"]
TypeError: string indices must be integers, not 'str'

@sckott
Copy link
Owner

sckott commented Jun 16, 2023

thanks for the report! i'll have a look

@sckott sckott added the bug label Jun 16, 2023
@sckott
Copy link
Owner

sckott commented Jun 16, 2023

forgot to mention issue

@sckott
Copy link
Owner

sckott commented Jun 16, 2023

@joej error parsing is fixed, however, /prefixes route isn't supported anymore, so I made the ids parameter (i think you meant ids instead of dois above?) required so users shouldn't hit that specific error anymore because ids is required.

@sckott sckott added this to the v1.2.6 milestone Jan 26, 2024
@sckott
Copy link
Owner

sckott commented Jan 26, 2024

done

@sckott sckott closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants