summaryrefslogtreecommitdiff
path: root/bibtool/extract.py
diff options
context:
space:
mode:
Diffstat (limited to 'bibtool/extract.py')
-rw-r--r--bibtool/extract.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/bibtool/extract.py b/bibtool/extract.py
index 5793da6..824c077 100644
--- a/bibtool/extract.py
+++ b/bibtool/extract.py
@@ -57,4 +57,10 @@ def get_bibtex_data(doi):
request = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(request) as response:
bibtex = response.read().decode('utf-8')
- return bibtexparser.loads(bibtex)
+
+ bibtex_data = bibtexparser.loads(bibtex)
+ if not bibtex_data.entries:
+ raise Exception('Did not find any Bibtex entry.')
+ if len(bibtex_data.entries) > 1:
+ raise Exception('Found more than one Bibtex entries.')
+ return bibtex_data