caltechdata-api 1.10.0__tar.gz → 1.10.2__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.
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/PKG-INFO +6 -3
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/README.md +3 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/__init__.py +1 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/caltechdata_edit.py +42 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/cli.py +20 -4
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/customize_schema.py +1 -1
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/PKG-INFO +6 -3
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/setup.cfg +3 -3
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/LICENSE +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/caltechdata_write.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/download_file.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/get_files.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/get_metadata.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/md_to_json.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api/utils.py +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/SOURCES.txt +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/dependency_links.txt +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/entry_points.txt +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/requires.txt +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/top_level.txt +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/pyproject.toml +0 -0
- {caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/setup.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: caltechdata_api
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.2
|
|
4
4
|
Summary: Python wrapper for CaltechDATA API.
|
|
5
5
|
Home-page: https://github.com/caltechlibrary/caltechdata_api
|
|
6
|
-
Author: Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah
|
|
7
|
-
Author-email: tmorrell@caltech.edu, aabakah@caltech.edu
|
|
6
|
+
Author: Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
|
|
7
|
+
Author-email: tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu
|
|
8
8
|
License: MIT
|
|
9
9
|
Platform: UNKNOWN
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -98,5 +98,8 @@ This returns the custom DOI of the record if it is successful.
|
|
|
98
98
|
Only test your application on the test repository (`data.caltechlibrary.dev`). Testing the API on the public
|
|
99
99
|
repository will generate junk records that are annoying to delete.
|
|
100
100
|
|
|
101
|
+
## Using the Command Line Interface
|
|
102
|
+
|
|
103
|
+
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).
|
|
101
104
|
|
|
102
105
|
|
|
@@ -77,3 +77,6 @@ This returns the custom DOI of the record if it is successful.
|
|
|
77
77
|
Only test your application on the test repository (`data.caltechlibrary.dev`). Testing the API on the public
|
|
78
78
|
repository will generate junk records that are annoying to delete.
|
|
79
79
|
|
|
80
|
+
## Using the Command Line Interface
|
|
81
|
+
|
|
82
|
+
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).
|
|
@@ -49,6 +49,48 @@ def caltechdata_accept(ids, token=None, production=False):
|
|
|
49
49
|
raise Exception(result.text)
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
def caltechdata_reject(ids, token=None, production=False, authors=False):
|
|
53
|
+
# Reject a record from a community
|
|
54
|
+
|
|
55
|
+
# If no token is provided, get from RDMTOK environment variable
|
|
56
|
+
if not token:
|
|
57
|
+
token = os.environ["RDMTOK"]
|
|
58
|
+
|
|
59
|
+
if production == True:
|
|
60
|
+
if authors:
|
|
61
|
+
url = "https://authors.library.caltech.edu"
|
|
62
|
+
else:
|
|
63
|
+
url = "https://data.caltech.edu"
|
|
64
|
+
else:
|
|
65
|
+
if authors:
|
|
66
|
+
url = "https://authors.caltechlibrary.dev"
|
|
67
|
+
else:
|
|
68
|
+
url = "https://data.caltechlibrary.dev"
|
|
69
|
+
|
|
70
|
+
headers = {
|
|
71
|
+
"Authorization": "Bearer %s" % token,
|
|
72
|
+
"Content-type": "application/json",
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for idv in ids:
|
|
76
|
+
result = requests.get(
|
|
77
|
+
url + "/api/records/" + idv + "/draft/review", headers=headers
|
|
78
|
+
)
|
|
79
|
+
print(url + "/api/records/" + idv + "/draft/review")
|
|
80
|
+
if result.status_code != 200:
|
|
81
|
+
raise Exception(result.text)
|
|
82
|
+
accept_link = result.json()["links"]["actions"]["decline"]
|
|
83
|
+
data = comment = {
|
|
84
|
+
"payload": {
|
|
85
|
+
"content": "This record was declined automatically with the CaltechDATA API",
|
|
86
|
+
"format": "html",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
result = requests.post(accept_link, json=data, headers=headers)
|
|
90
|
+
if result.status_code != 200:
|
|
91
|
+
raise Exception(result.text)
|
|
92
|
+
|
|
93
|
+
|
|
52
94
|
def caltechdata_edit(
|
|
53
95
|
idv,
|
|
54
96
|
metadata={},
|
|
@@ -360,6 +360,7 @@ def upload_supporting_file(record_id=None):
|
|
|
360
360
|
filepaths = []
|
|
361
361
|
file_link = ""
|
|
362
362
|
file_links = []
|
|
363
|
+
idx = 0
|
|
363
364
|
while True:
|
|
364
365
|
choice = get_user_input(
|
|
365
366
|
"Do you want to upload or link data files? (upload/link/n): "
|
|
@@ -402,14 +403,28 @@ def upload_supporting_file(record_id=None):
|
|
|
402
403
|
files = [
|
|
403
404
|
f for f in os.listdir() if not f.endswith(".json") and os.path.isfile(f)
|
|
404
405
|
]
|
|
405
|
-
|
|
406
|
+
idx += 1
|
|
407
|
+
print((f"{idx}/ \n").join(files))
|
|
406
408
|
while True:
|
|
407
409
|
filename = get_user_input(
|
|
408
|
-
"Enter the filename to upload as a supporting file (or 'n' to finish): "
|
|
410
|
+
"Enter the filename to upload as a supporting file (or '*' to get all files currently in this directory, or the index number of the file as displayed followed by a /, otherwise 'n' to finish): "
|
|
409
411
|
)
|
|
410
|
-
if filename == "
|
|
412
|
+
if filename == "*":
|
|
413
|
+
for files_name in files:
|
|
414
|
+
filepath = os.path.abspath(files_name)
|
|
415
|
+
filepaths.append(filepath)
|
|
416
|
+
print("All files added successfully")
|
|
417
|
+
elif filename == "n":
|
|
411
418
|
break
|
|
412
|
-
|
|
419
|
+
elif (not len(filename) == 0) and (filename[len(filename) - 1] == "/"):
|
|
420
|
+
try:
|
|
421
|
+
files_name = files[int(filename[0]) - 1]
|
|
422
|
+
filepath = os.path.abspath(files_name)
|
|
423
|
+
filepaths.append(filepath)
|
|
424
|
+
print("File added successfully")
|
|
425
|
+
except ValueError:
|
|
426
|
+
continue
|
|
427
|
+
elif filename in files:
|
|
413
428
|
file_size = os.path.getsize(filename)
|
|
414
429
|
if file_size > 1024 * 1024 * 1024:
|
|
415
430
|
print(
|
|
@@ -420,6 +435,7 @@ def upload_supporting_file(record_id=None):
|
|
|
420
435
|
else:
|
|
421
436
|
filepath = os.path.abspath(filename)
|
|
422
437
|
filepaths.append(filepath)
|
|
438
|
+
print("File added successfully")
|
|
423
439
|
else:
|
|
424
440
|
print(
|
|
425
441
|
f"Error: File '{filename}' not found. Please enter a valid filename."
|
|
@@ -17,7 +17,7 @@ def grid_to_ror(grid):
|
|
|
17
17
|
elif grid == "grid.465477.3":
|
|
18
18
|
ror = "00em52312"
|
|
19
19
|
else:
|
|
20
|
-
url = f"https://api.ror.org/organizations?query.advanced=external_ids.
|
|
20
|
+
url = f"https://api.ror.org/organizations?query.advanced=external_ids.all:{grid}"
|
|
21
21
|
results = requests.get(url).json()
|
|
22
22
|
if len(results["items"]) == 0:
|
|
23
23
|
print(url + "doesn't have a valid ROR")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: caltechdata-api
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.2
|
|
4
4
|
Summary: Python wrapper for CaltechDATA API.
|
|
5
5
|
Home-page: https://github.com/caltechlibrary/caltechdata_api
|
|
6
|
-
Author: Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah
|
|
7
|
-
Author-email: tmorrell@caltech.edu, aabakah@caltech.edu
|
|
6
|
+
Author: Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
|
|
7
|
+
Author-email: tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu
|
|
8
8
|
License: MIT
|
|
9
9
|
Platform: UNKNOWN
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -98,5 +98,8 @@ This returns the custom DOI of the record if it is successful.
|
|
|
98
98
|
Only test your application on the test repository (`data.caltechlibrary.dev`). Testing the API on the public
|
|
99
99
|
repository will generate junk records that are annoying to delete.
|
|
100
100
|
|
|
101
|
+
## Using the Command Line Interface
|
|
102
|
+
|
|
103
|
+
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).
|
|
101
104
|
|
|
102
105
|
|
|
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[metadata]
|
|
6
6
|
name = caltechdata_api
|
|
7
|
-
version = 1.10.
|
|
8
|
-
author = Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah
|
|
9
|
-
author_email = tmorrell@caltech.edu, aabakah@caltech.edu
|
|
7
|
+
version = 1.10.2
|
|
8
|
+
author = Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
|
|
9
|
+
author_email = tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu
|
|
10
10
|
description = Python wrapper for CaltechDATA API.
|
|
11
11
|
long_description = file: README.md
|
|
12
12
|
long_description_content_type = text/markdown
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{caltechdata_api-1.10.0 → caltechdata_api-1.10.2}/caltechdata_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|