diff --git a/libbmc/__init__.py b/libbmc/__init__.py index 28e9f10..b42a0d5 100644 --- a/libbmc/__init__.py +++ b/libbmc/__init__.py @@ -7,7 +7,7 @@ __valid_identifiers__ = [] from . import bibtex, doi, fetcher, isbn # noqa from . import citations, papers, repositories # noqa -__version__ = "0.1.2" +__version__ = "0.1.3.1" __all__ = [ "bibtex", "doi", "fetcher", "isbn", diff --git a/libbmc/doi.py b/libbmc/doi.py index f3a4b8d..bdd9f1e 100644 --- a/libbmc/doi.py +++ b/libbmc/doi.py @@ -157,6 +157,9 @@ def get_oa_policy(doi): >>> tmp = get_oa_policy('10.1209/0295-5075/111/40005'); (tmp["published"], tmp["preprint"], tmp["postprint"], tmp["romeo_id"]) ('can', 'can', 'can', '1896') + + >>> get_oa_policy('10.1215/9780822387268') is None + True """ try: r = requests.get("%s%s" % (DISSEMIN_API, doi)) @@ -166,7 +169,8 @@ def get_oa_policy(doi): return ([i for i in result["paper"]["publications"] if i["doi"] == doi][0])["policy"] - except (AssertionError, ValueError, KeyError, RequestException): + except (AssertionError, ValueError, + KeyError, RequestException, IndexError): return None