-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,22 +99,21 @@ def split_dois(s): | |
|
||
def get_omid_of_doi(s): | ||
api = "https://test.opencitations.net/meta/api/v1/metadata/doi:%s" | ||
return "br/12345" | ||
try: | ||
r = get(api % s, | ||
headers={"User-Agent": "INDEX REST API (via OpenCitations - http://opencitations.net; mailto:[email protected])"}, timeout=60) | ||
headers={"User-Agent": "INDEX REST API (via OpenCitation> | ||
if r.status_code == 200: | ||
json_res = loads(r.text) | ||
if len(json_res) > 0: | ||
#take the one and only result given back by META | ||
body = json_res[0] | ||
matches = findall(r'omid:br/[\dA-Za-z/]+', body["id"]) | ||
if matches: | ||
return matches[0].replace("omid:","") | ||
return matches[0].replace("omid:br/",""), | ||
|
||
except Exception as e: | ||
return "" | ||
return "" | ||
return "", | ||
return "", | ||
|
||
|
||
def metadata(res, *args): | ||
|