aboutsummaryrefslogtreecommitdiffstats
path: root/python/sandcrawler
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-06-02 00:27:27 -0700
committerBryan Newbold <bnewbold@archive.org>2021-06-02 00:27:27 -0700
commit04053711a7e975ca4339411af21e7b0ce8d15c10 (patch)
tree011d9f11a7abe1f1e00a03afd1c61fab2147a86e /python/sandcrawler
parent87a9bb4ed81b503f03e6e77d6b082249523e67d4 (diff)
downloadsandcrawler-04053711a7e975ca4339411af21e7b0ce8d15c10.tar.gz
sandcrawler-04053711a7e975ca4339411af21e7b0ce8d15c10.zip
add crossref postgrest fetch support to python db helpers
Diffstat (limited to 'python/sandcrawler')
-rw-r--r--python/sandcrawler/db.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/sandcrawler/db.py b/python/sandcrawler/db.py
index c87b0ae..e60b310 100644
--- a/python/sandcrawler/db.py
+++ b/python/sandcrawler/db.py
@@ -77,6 +77,15 @@ class SandcrawlerPostgrestClient:
else:
return None
+ def get_crossref(self, doi):
+ resp = requests.get(self.api_url + "/crossref", params=dict(doi='eq.'+doi))
+ resp.raise_for_status()
+ resp = resp.json()
+ if resp:
+ return resp[0]
+ else:
+ return None
+
class SandcrawlerPostgresClient:
def __init__(self, db_url, **kwargs):