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

error when getting dois #22

Open
kirk86 opened this issue Jan 22, 2020 · 2 comments
Open

error when getting dois #22

kirk86 opened this issue Jan 22, 2020 · 2 comments
Labels

Comments

@kirk86
Copy link

kirk86 commented Jan 22, 2020

Get DOI absent using the title?y(yes, automatic)/m(manual)/n(do nothing)y
Traceback (most recent call last):
  File "/home/user/bin/bibcure", line 177, in <module>
    main()
  File "/home/user/bin/bibcure", line 137, in main
    bibs = update_bibs_get_doi(bibs)
  File "/home/user/lib/python3.7/site-packages/bibcure/title.py", line 26, in update_bibs_get_doi
    bibs[i] = update_bib(bib, get_first)
  File "/home/user/lib/python3.7/site-packages/bibcure/title.py", line 10, in update_bib
    found, bib_string = get_bib_from_title(bib["title"], get_first)
  File "/home/user/lib/python3.7/site-packages/title2bib/crossref.py", line 86, in get_bib_from_title
    found, item = get_from_title(title, get_first)
  File "/home/user/lib/python3.7/site-packages/title2bib/crossref.py", line 50, in get_from_title
    items = r.json()["message"]["items"]
TypeError: list indices must be integers or slices, not str

@devmessias devmessias added the bug label Jan 25, 2020
@chrisersen
Copy link

Same errormessage here with title2bib "A useful paper with hopefully unique title"

@YukinoHayakawa
Copy link

Seems this error derives from an HTTP 400 error from the crossref API:

b'{"status":"failed","message-type":"validation-failure","message":[{"type":"unknown-parameter","value":"query.title","message":"Parameter query.title has been deprecated. Please use query.bibliographic instead. See https://status.crossref.org/incidents/4y45gj63jsp4 "}]}\n'

Change the query accordingly seems to fix the issue:

# title2bib/crossref.py

def get_from_title(title, get_first=False):
    found = False
    params = {"query.bibliographic": title, "rows": 20} # change title to bibliographic
    r = find_cross_info(params)
    items = r.json()["message"]["items"]

If this is the correct way to fix it I can make a pull request later.

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

4 participants