You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from habanero import Crossref
cr = Crossref()
dois= ['10.1609/aimag.v18i1.1276', '10.1109/ICARSC.2014.6849793']
x = cr.works(ids=dois)
produce:
Traceback (most recent call last):
File "D:\DPRA\CpvAWorkspace\P37_Mupdf16__PdfAnnoteur_V2_postCovid\ReferenceGraphBuilder\test_crossref_on_crash.py", line 8, in <module>
x = cr.works(ids=dois)
File "C:\Python37\lib\site-packages\habanero\crossref\crossref.py", line 360, in works
**kwargs
File "C:\Python37\lib\site-packages\habanero\request.py", line 128, in request
raise RequestError(r.status_code, parse_json_err(r))
File "C:\Python37\lib\site-packages\habanero\habanero_utils.py", line 63, in parse_json_err
return x.json()["message"][0]["message"]
File "C:\Python37\lib\site-packages\requests\models.py", line 889, in json
self.content.decode(encoding), **kwargs
File "C:\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
correction proposition (habanero_utils.py):
def is_json(x):
if (
re.search("json", x.headers.get("Content-Type")).__class__.__name__
== "NoneType"
or x.status_code==404
):
return False
else:
return True
The text was updated successfully, but these errors were encountered:
simple code for reproduce error :
produce:
correction proposition (habanero_utils.py):
The text was updated successfully, but these errors were encountered: