sckott / habanero

client for Crossref search API

Home Page:https://habanero.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

list index out of range when using WorksContainer

IvanSterligov opened this issue · comments

hi there, and thank you for your useful library!

I'm using the latest habanero build (pip installed today) and get an error when trying to put results in a WorkContainer

from habanero import Crossref, WorksContainer
cr = Crossref(mailto = "(my email)")
res = cr.works(query_affiliation='Higher School of Economics*', cursor='*', works=True, cursor_max=500, progress_bar=True)
x=WorksContainer(res)
print(x)

Traceback (most recent call last):
File "xxx.py", line 4, in
x=WorksContainer(res)
File "xxx\Python310\lib\site-packages\habanero\crossref\workscontainer.py", line 44, in init
keys = list(self.works[0].keys())
IndexError: list index out of range

thanks for the issue @IvanSterligov

yep, i get the same error. its possible i didn't make sure WorksContainer worked with results of a cursor, i'll have a look

@IvanSterligov can you reinstall from github and try again?

thanks for a quick fix! now it's working.

btw I had to modify your recommended git setup line

this one is not ok for me:
pip (or pip3) install git+git://github.com/sckott/habanero.git#egg=habanero

this one is ok:
pip (or pip3) install git+https://github.com/sckott/habanero.git#egg=habanero

the reason: https://github.blog/2021-09-01-improving-git-protocol-security-github/

thanks for the note about install. fixed now in 7d652e1