88
99
1010def get_metadata (
11- idv , production = True , validate = True , emails = False , schema = "43" , token = False
11+ idv ,
12+ production = True ,
13+ validate = True ,
14+ emails = False ,
15+ schema = "43" ,
16+ token = False ,
17+ authors = False ,
1218):
1319 # Returns just DataCite metadata or DataCite metadata with emails
1420
1521 if production == True :
16- url = "https://data.caltech.edu/api/records/"
22+ if authors :
23+ url = "https://authors.library.caltech.edu/api/records/"
24+ else :
25+ url = "https://data.caltech.edu/api/records/"
1726 verify = True
1827 else :
19- url = "https://data.caltechlibrary.dev/api/records/"
28+ if authors :
29+ url = "https://authors.caltechlibrary.dev/api/records/"
30+ else :
31+ url = "https://data.caltechlibrary.dev/api/records/"
2032 verify = True
2133
22- headers = {
23- "accept" : "application/vnd.datacite.datacite+json" ,
24- }
34+ if authors :
35+ headers = {
36+ "accept" : "application/json" ,
37+ }
38+ validate = False
39+ else :
40+ headers = {
41+ "accept" : "application/vnd.datacite.datacite+json" ,
42+ }
2543
2644 if token :
2745 headers ["Authorization" ] = "Bearer %s" % token
@@ -58,6 +76,7 @@ def get_metadata(
5876 help = "The CaltechDATA ID for each record of interest" ,
5977 )
6078 parser .add_argument ("-test" , dest = "production" , action = "store_false" )
79+ parser .add_argument ("-authors" , dest = "authors" , action = "store_true" )
6180 parser .add_argument ("-xml" , dest = "save_xml" , action = "store_true" )
6281 parser .add_argument (
6382 "-skip_validate" ,
@@ -71,14 +90,17 @@ def get_metadata(
7190
7291 production = args .production
7392 schema = args .schema
93+ authors = args .authors
7494 skip_validate = args .skip_validate
7595 if skip_validate :
7696 validate = False
7797 else :
7898 validate = True
7999
80100 for idv in args .ids :
81- metadata = get_metadata (idv , production , validate , schema )
101+ metadata = get_metadata (
102+ idv , production , validate , schema = schema , authors = authors
103+ )
82104 outfile = open (str (idv ) + ".json" , "w" )
83105 outfile .write (json .dumps (metadata , indent = 4 ))
84106 outfile .close ()
0 commit comments