Skip to content

Commit

Permalink
[zsh] Simplify doi2bib script
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelRobitaille committed Apr 8, 2022
1 parent 5fb98e7 commit a724ea9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bin/doi2bib
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import sys
import urllib.request
from urllib.error import HTTPError

BASE_URL = 'http://dx.doi.org/'

try:
doi = sys.argv[1]
except IndexError:
print('Usage:\n{} <doi>'.format(sys.argv[0]))
sys.exit(1)

url = BASE_URL + doi
req = urllib.request.Request(url)
req = urllib.request.Request(f'http://dx.doi.org/{doi}')
req.add_header('Accept', 'application/x-bibtex')
try:
with urllib.request.urlopen(req) as f:
Expand Down

0 comments on commit a724ea9

Please sign in to comment.