-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_doi.py
49 lines (39 loc) · 1.5 KB
/
test_doi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
"""
"""
import crossref.doi as cdoi
#Is valid?
#---------------------------------------------------
doi = '10.1111/cheese'
doi_valid_status = cdoi.is_valid(doi)
print('DOI valid status: %s' % doi_valid_status)
#Getting the DOI link
#----------------------------------------------------
#TODO: Should verify that this throws the expected error
#doi = '10.1111/cheese'
#link = cdoi.get_doi_link(doi)
#print('DOI link is: %s' % link)
doi = '10.1111/j.1525-1403.2006.00056.x'
link = cdoi.get_doi_link(doi)
print('DOI link is: %s' % link)
#Cleaning the DOI
#----------------------------------------------------
#TODO: Need to validate output
doi = 'doi:10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='value')
print('Cleaned doi to value is: %s' % cleaned_doi)
doi = 'http://dx.doi.org/10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='value')
print('Cleaned doi to value is: %s' % cleaned_doi)
doi = 'https://dx.doi.org/10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='value')
print('Cleaned doi to value is: %s' % cleaned_doi)
doi = 'http://doi.org/10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='http')
print('Cleaned doi to value is: %s' % cleaned_doi)
doi = 'https://doi.org/10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='https')
print('Cleaned doi to value is: %s' % cleaned_doi)
doi = '10.1002/nau.1930090206'
cleaned_doi = cdoi.clean_doi(doi,_format='value')
print('Cleaned doi to value is: %s' % cleaned_doi)