caltechdata-api 1.10.4__tar.gz → 1.10.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/PKG-INFO +10 -5
  2. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/caltechdata_edit.py +5 -0
  3. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/caltechdata_write.py +20 -10
  4. caltechdata_api-1.10.6/caltechdata_api/vocabularies/date_types.yaml +55 -0
  5. caltechdata_api-1.10.6/caltechdata_api/vocabularies/description_types.yaml +34 -0
  6. caltechdata_api-1.10.6/caltechdata_api/vocabularies/identifier_types.yaml +110 -0
  7. caltechdata_api-1.10.6/caltechdata_api/vocabularies/licenses.csv +419 -0
  8. caltechdata_api-1.10.6/caltechdata_api/vocabularies/relation_types.yaml +155 -0
  9. caltechdata_api-1.10.6/caltechdata_api/vocabularies/resource_types.yaml +675 -0
  10. caltechdata_api-1.10.6/caltechdata_api/vocabularies/roles.yaml +105 -0
  11. caltechdata_api-1.10.6/caltechdata_api/vocabularies/title_types.yaml +20 -0
  12. caltechdata_api-1.10.6/caltechdata_api/vocabularies.yaml +24 -0
  13. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/PKG-INFO +11 -6
  14. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/SOURCES.txt +13 -1
  15. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/entry_points.txt +0 -1
  16. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/setup.cfg +1 -1
  17. caltechdata_api-1.10.6/tests/test_download.py +27 -0
  18. caltechdata_api-1.10.6/tests/test_rdm.py +95 -0
  19. caltechdata_api-1.10.6/tests/test_unit.py +166 -0
  20. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/LICENSE +0 -0
  21. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/README.md +0 -0
  22. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/__init__.py +0 -0
  23. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/cli.py +0 -0
  24. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/customize_schema.py +0 -0
  25. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/download_file.py +0 -0
  26. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/get_files.py +0 -0
  27. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/get_metadata.py +0 -0
  28. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/md_to_json.py +0 -0
  29. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api/utils.py +0 -0
  30. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/dependency_links.txt +0 -0
  31. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/requires.txt +0 -0
  32. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/caltechdata_api.egg-info/top_level.txt +0 -0
  33. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/pyproject.toml +0 -0
  34. {caltechdata_api-1.10.4 → caltechdata_api-1.10.6}/setup.py +0 -0
@@ -1,12 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: caltechdata_api
3
- Version: 1.10.4
3
+ Version: 1.10.6
4
4
  Summary: Python wrapper for CaltechDATA API.
5
5
  Home-page: https://github.com/caltechlibrary/caltechdata_api
6
6
  Author: Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
7
7
  Author-email: tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu
8
8
  License: MIT
9
- Platform: UNKNOWN
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
11
  Classifier: Programming Language :: Python :: 3.7
@@ -18,6 +17,14 @@ Classifier: Operating System :: OS Independent
18
17
  Requires-Python: >=3.6.0
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE
20
+ Requires-Dist: requests
21
+ Requires-Dist: datacite>1.1.0
22
+ Requires-Dist: tqdm>=4.62.3
23
+ Requires-Dist: pyyaml
24
+ Requires-Dist: s3fs
25
+ Requires-Dist: cryptography
26
+ Requires-Dist: s3cmd
27
+ Dynamic: license-file
21
28
 
22
29
  # CaltechDATA API Python Library
23
30
 
@@ -101,5 +108,3 @@ repository will generate junk records that are annoying to delete.
101
108
  ## Using the Command Line Interface
102
109
 
103
110
  If you would like to interact with the CaltechDATA API using the Command line Interface (CLI), please [see the detailed documentation](https://caltechlibrary.github.io/caltechdata_api/caltechdata_api/cli-documentation-for-users).
104
-
105
-
@@ -109,6 +109,7 @@ def caltechdata_edit(
109
109
  authors=False,
110
110
  keepfiles=False,
111
111
  return_id=False,
112
+ local=False,
112
113
  ):
113
114
  # Make a copy of the metadata to make sure our local changes don't leak
114
115
  metadata = copy.deepcopy(metadata)
@@ -159,11 +160,15 @@ def caltechdata_edit(
159
160
  if authors == False:
160
161
  if production == True:
161
162
  url = "https://data.caltech.edu/"
163
+ elif local == True:
164
+ url = "https://127.0.0.1:5000/"
162
165
  else:
163
166
  url = "https://data.caltechlibrary.dev/"
164
167
  else:
165
168
  if production == True:
166
169
  url = "https://authors.library.caltech.edu/"
170
+ elif local == True:
171
+ url = "https://127.0.0.1:5000/"
167
172
  else:
168
173
  url = "https://authors.caltechlibrary.dev/"
169
174
 
@@ -132,16 +132,21 @@ def send_to_community(
132
132
  if result.status_code != 202:
133
133
  raise Exception(result.text)
134
134
  if publish:
135
- accept_link = result.json()["links"]["actions"]["accept"]
136
- data = comment = {
137
- "payload": {
138
- "content": "This record is accepted automatically with the CaltechDATA API",
139
- "format": "html",
135
+ if "accept" in result.json()["links"]["actions"]:
136
+ accept_link = result.json()["links"]["actions"]["accept"]
137
+ data = comment = {
138
+ "payload": {
139
+ "content": "This record is accepted automatically with the CaltechDATA API",
140
+ "format": "html",
141
+ }
140
142
  }
141
- }
142
- result = requests.post(accept_link, json=data, headers=headers, verify=verify)
143
- if result.status_code != 200:
144
- raise Exception(result.text)
143
+ result = requests.post(
144
+ accept_link, json=data, headers=headers, verify=verify
145
+ )
146
+ if result.status_code != 200:
147
+ raise Exception(result.text)
148
+ # Otherwise we have direct publish permissions and don't need to acccept
149
+ # the request
145
150
  return result
146
151
 
147
152
 
@@ -161,6 +166,7 @@ def caltechdata_write(
161
166
  default_preview=None,
162
167
  review_message=None,
163
168
  verify=True,
169
+ local=False,
164
170
  ):
165
171
  """
166
172
  File links are links to files existing in external systems that will
@@ -233,14 +239,18 @@ def caltechdata_write(
233
239
  data = customize_schema.customize_schema(metadata, schema=schema)
234
240
  if production == True:
235
241
  url = "https://data.caltech.edu/"
242
+ elif local == True:
243
+ url = "https://127.0.0.1:5000/"
236
244
  else:
237
245
  url = "https://data.caltechlibrary.dev/"
238
246
  else:
239
247
  data = metadata
240
248
  if production == True:
241
249
  url = "https://authors.library.caltech.edu/"
242
- else:
250
+ elif local == True:
243
251
  url = "https://127.0.0.1:5000/"
252
+ else:
253
+ url = "https://authors.caltechlibrary.dev/"
244
254
 
245
255
  headers = {
246
256
  "Authorization": "Bearer %s" % token,
@@ -0,0 +1,55 @@
1
+ - id: accepted
2
+ props:
3
+ datacite: Accepted
4
+ title:
5
+ en: Accepted
6
+ - id: available
7
+ props:
8
+ datacite: Available
9
+ title:
10
+ en: Available
11
+ - id: collected
12
+ props:
13
+ datacite: Collected
14
+ title:
15
+ en: Collected
16
+ - id: copyrighted
17
+ props:
18
+ datacite: Copyrighted
19
+ title:
20
+ en: Copyrighted
21
+ - id: created
22
+ props:
23
+ datacite: Created
24
+ title:
25
+ en: Created
26
+ - id: issued
27
+ props:
28
+ datacite: Issued
29
+ title:
30
+ en: Issued
31
+ - id: other
32
+ props:
33
+ datacite: Other
34
+ title:
35
+ en: Other
36
+ - id: submitted
37
+ props:
38
+ datacite: Submitted
39
+ title:
40
+ en: Submitted
41
+ - id: updated
42
+ props:
43
+ datacite: Updated
44
+ title:
45
+ en: Updated
46
+ - id: valid
47
+ props:
48
+ datacite: Valid
49
+ title:
50
+ en: Valid
51
+ - id: withdrawn
52
+ props:
53
+ datacite: Withdrawn
54
+ title:
55
+ en: Withdrawn
@@ -0,0 +1,34 @@
1
+ - id: abstract
2
+ props:
3
+ datacite: Abstract
4
+ title:
5
+ en: Abstract
6
+ - id: methods
7
+ props:
8
+ datacite: Methods
9
+ title:
10
+ en: Methods
11
+ - id: series-information
12
+ props:
13
+ datacite: SeriesInformation
14
+ title:
15
+ en: Series information
16
+ - id: table-of-contents
17
+ props:
18
+ datacite: TableOfContents
19
+ title:
20
+ en: Table of contents
21
+ - id: technical-info
22
+ props:
23
+ datacite: TechnicalInfo
24
+ title:
25
+ en: Technical info
26
+ - id: other
27
+ props:
28
+ datacite: Other
29
+ title:
30
+ en: Other
31
+ # Not really a datacite mapping, but needed to support passing custom types
32
+ - id: files
33
+ props:
34
+ datacite: files
@@ -0,0 +1,110 @@
1
+ - id: ark
2
+ props:
3
+ datacite: ARK
4
+ title:
5
+ en: ARK
6
+ - id: arxiv
7
+ props:
8
+ datacite: arXiv
9
+ title:
10
+ en: arXiv
11
+ - id: bibcode
12
+ props:
13
+ datacite: bibcode
14
+ title:
15
+ en: Bibcode
16
+ - id: doi
17
+ props:
18
+ datacite: DOI
19
+ title:
20
+ en: DOI
21
+ - id: ean13
22
+ props:
23
+ datacite: EAN13
24
+ title:
25
+ en: EAN13
26
+ - id: eissn
27
+ props:
28
+ datacite: EISSN
29
+ title:
30
+ en: EISSN
31
+ - id: handle
32
+ props:
33
+ datacite: Handle
34
+ title:
35
+ en: Handle
36
+ - id: igsn
37
+ props:
38
+ datacite: IGSN
39
+ title:
40
+ en: IGSN
41
+ - id: isbn
42
+ props:
43
+ datacite: ISBN
44
+ title:
45
+ en: ISBN
46
+ - id: issn
47
+ props:
48
+ datacite: ISSN
49
+ title:
50
+ en: ISSN
51
+ - id: istc
52
+ props:
53
+ datacite: ISTC
54
+ title:
55
+ en: ISTC
56
+ - id: lissn
57
+ props:
58
+ datacite: LISSN
59
+ title:
60
+ en: LISSN
61
+ - id: lsid
62
+ props:
63
+ datacite: LSID
64
+ title:
65
+ en: LSID
66
+ - id: pmid
67
+ props:
68
+ datacite: PMID
69
+ title:
70
+ en: PMID
71
+ - id: purl
72
+ props:
73
+ datacite: PURL
74
+ title:
75
+ en: PURL
76
+ - id: upc
77
+ props:
78
+ datacite: UPC
79
+ title:
80
+ en: UPC
81
+ - id: url
82
+ props:
83
+ datacite: URL
84
+ title:
85
+ en: URL
86
+ - id: urn
87
+ props:
88
+ datacite: URN
89
+ title:
90
+ en: URN
91
+ - id: w3id
92
+ props:
93
+ datacite: w3id
94
+ title:
95
+ en: W3ID
96
+ - id: cdid
97
+ props:
98
+ datacite: cdid
99
+ title:
100
+ en: CALTECHDATA_ID
101
+ - id: tiltid
102
+ props:
103
+ datacite: tiltid
104
+ title:
105
+ en: TILT_SERIES_ID
106
+ - id: dsa-110-id
107
+ props:
108
+ datacite: dsa-110-id
109
+ title:
110
+ en: DSA_110_ID