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

some get_paper results are empty #48

Closed
piotrm0 opened this issue Jan 14, 2023 · 2 comments
Closed

some get_paper results are empty #48

piotrm0 opened this issue Jan 14, 2023 · 2 comments

Comments

@piotrm0
Copy link

piotrm0 commented Jan 14, 2023

Here are two examples:

print(sch.get_paper("c77cd64f26228442ffff9219bfd870c83c8747c0"))
print(sch.get_paper("d7701e78e0bfc92b03a89582e80cfb751ac03f26"))

results in

{}
{}

But those are real papers according to the API:

curl https://api.semanticscholar.org/graph/v1/paper/c77cd64f26228442ffff9219bfd870c83c8747c0
curl https://api.semanticscholar.org/graph/v1/paper/d7701e78e0bfc92b03a89582e80cfb751ac03f26

results in:

{"paperId": "c77cd64f26228442ffff9219bfd870c83c8747c0", "title": "Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints"}
{"paperId": "d7701e78e0bfc92b03a89582e80cfb751ac03f26", "title": "Explaining Explanations: An Overview of Interpretability of Machine Learning"}

My version is "0.3.2".

@danielnsilva
Copy link
Owner

danielnsilva commented Jan 16, 2023

I've noticed last few weeks that requesting particular fields produces an internal server error for some papers. In your examples, I believe the tldr field is the cause.

By default, the library tries to fetch all fields. So, you can work around it by restricting the list of returned fields.

from semanticscholar import SemanticScholar                                       
sch = SemanticScholar()
print(sch.get_paper("c77cd64f26228442ffff9219bfd870c83c8747c0", fields=['year']))
curl https://api.semanticscholar.org/graph/v1/paper/c77cd64f26228442ffff9219bfd870c83c8747c0?fields=year

Output:

{'paperId': 'c77cd64f26228442ffff9219bfd870c83c8747c0', 'year': 1977}

This will cause error:

curl https://api.semanticscholar.org/graph/v1/paper/c77cd64f26228442ffff9219bfd870c83c8747c0?fields=tldr

Ouput:

{"message": "Internal Server Error"}

In addition, future versions of the package will raise exceptions for certain conditions like that instead of returning empty objects.

danielnsilva added a commit that referenced this issue Jan 21, 2023
Change `ApiRequester` to raise an exception for HTTP 500 responses instead of returning empty objects (#48).
@piotrm0
Copy link
Author

piotrm0 commented Jan 23, 2023

Upthumb.

@piotrm0 piotrm0 closed this as completed Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants