From 04053711a7e975ca4339411af21e7b0ce8d15c10 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 2 Jun 2021 00:27:27 -0700 Subject: add crossref postgrest fetch support to python db helpers --- python/sandcrawler/db.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'python/sandcrawler/db.py') 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): -- cgit v1.2.3