sckott / habanero

client for Crossref search API
https://habanero.readthedocs.io
MIT License
207 stars 30 forks source link

list index out of range when using WorksContainer #106

Closed IvanSterligov closed 2 years ago

IvanSterligov commented 2 years ago

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

sckott commented 2 years ago

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

sckott commented 2 years ago

@IvanSterligov can you reinstall from github and try again?

IvanSterligov commented 2 years ago

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/

sckott commented 2 years ago

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