dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 4adf1f05d00818e03c09d6b4beec4624d4a0831e
parent e02404c3559ef517c338004c903587bd61048b8a
Author: Anders Damsgaard Christensen <adc@geo.au.dk>
Date:   Fri, 27 Jan 2017 16:02:07 -0800

add verbosity flag

Diffstat:
Mbin/scholarref.py | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/bin/scholarref.py b/bin/scholarref.py @@ -33,6 +33,7 @@ import requests import sys import re +verbose = False query = ' '.join(sys.argv[1:]) nhits = 1 @@ -54,6 +55,8 @@ except Exception as e: # get the DOI of the first result doi = dois[0] +if verbose: + print('Received DOI from ' + doi_search_url) # fix escaped chars doi = doi.replace('\\', '') @@ -62,6 +65,8 @@ doi = doi.replace('\\', '') # use REST API (see http://crosscite.org/cn/) headers = {'Accept': 'application/x-bibtex'} r = requests.post('http://dx.doi.org/' + doi, headers=headers) +if verbose: + print('Received bibtex entry from dx.doi.org') # extract bibtex r.encoding = 'utf-8'