lukasschwab / arxiv.py

Python wrapper for the arXiv API
MIT License
1.11k stars 123 forks source link

avoid an error when no items returned #22

Closed refraction-ray closed 5 years ago

refraction-ray commented 5 years ago

Ideally, the following line is enough to avoid error from empty response. https://github.com/lukasschwab/arxiv.py/blob/e2f4ee4d2357331825c93dfe6b2f7110044637d2/arxiv/arxiv.py#L38 But there are some special cases, say id_list=["1912.08031"], the results array is not empty but with one element of no meaning. This will cause error in mod_query_result function. Therefore, I added one line code to check this behavior avoiding unnecessary errors and make sure the return value results is an empty list when there are no matching items.

lukasschwab commented 5 years ago

Good catch! I'm going to make a minor change––combining the logic on lines 38 and 39––then test and merge.