mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit a2ce8832d6a5d4042b1102d56d692a385cd4fe19
parent 858caac7c121efe13f45c02e7b7b2809c7a4405b
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat,  3 Dec 2022 18:41:25 +0100

fix problem with one doi

Diffstat:
adddoi | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/adddoi b/adddoi @@ -27,8 +27,12 @@ def searchurl(doi): r2 = requests.get(url_crossref) data_crossref = json.loads(r2.text) assert(data_crossref['message']['DOI'].lower() == doi.lower()) - assert(data_crossref['message']['agency']['id'] == 'datacite') - return True, None # OK, it is a datacite DOI, so probably OA + dapublisher = data_crossref['message']['agency']['id'] + assert(dapublisher in ['datacite', 'crossref']) + if dapublisher == 'datacite': + return True, None # OK, it is a datacite DOI, so probably OA + else: + return False, None # this is a crossref DOI not listed in unpaywall, so fail :( assert(data['doi'].lower() == doi.lower()) if not data['is_oa']: return False, None # closed-access and no OA version available :(