dpriskorn / OpenAlexAPI

Python library for the OpenAlex HTTP API
GNU General Public License v3.0
22 stars 11 forks source link

Loading a work crashes when oa_status is blank #13

Open v0idness opened 2 years ago

v0idness commented 2 years ago

Hi,

I'm experiencing the following issue whenever I retrieve a work that has no information given for the oa_status variable (example: https://api.openalex.org/works/W2150191218):

oa = openalexapi.OpenAlex()
oa.get_single_work("https://openalex.org/W2150191218")

yields:

Traceback (most recent call last): File "mappings/openalex.py", line 5, in oa.get_single_work("https://openalex.org/W2150191218") File "env/lib/python3.8/site-packages/openalexapi/init.py", line 35, in get_single_work return Work(**response.json()) File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for Work open_access -> oa_status none is not an allowed value (type=type_error.none.not_allowed)