caltechdata-api 1.10.3__tar.gz → 1.10.4__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 (22) hide show
  1. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/PKG-INFO +1 -1
  2. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/get_metadata.py +20 -10
  3. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/PKG-INFO +1 -1
  4. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/setup.cfg +1 -1
  5. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/LICENSE +0 -0
  6. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/README.md +0 -0
  7. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/__init__.py +0 -0
  8. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/caltechdata_edit.py +0 -0
  9. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/caltechdata_write.py +0 -0
  10. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/cli.py +0 -0
  11. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/customize_schema.py +0 -0
  12. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/download_file.py +0 -0
  13. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/get_files.py +0 -0
  14. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/md_to_json.py +0 -0
  15. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api/utils.py +0 -0
  16. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/SOURCES.txt +0 -0
  17. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/dependency_links.txt +0 -0
  18. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/entry_points.txt +0 -0
  19. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/requires.txt +0 -0
  20. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/caltechdata_api.egg-info/top_level.txt +0 -0
  21. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/pyproject.toml +0 -0
  22. {caltechdata_api-1.10.3 → caltechdata_api-1.10.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: caltechdata_api
3
- Version: 1.10.3
3
+ Version: 1.10.4
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
@@ -44,6 +44,7 @@ def get_metadata(
44
44
  }
45
45
 
46
46
  if token:
47
+ base_headers["Authorization"] = "Bearer %s" % token
47
48
  headers["Authorization"] = "Bearer %s" % token
48
49
 
49
50
  response = requests.get(url + idv, headers=headers, verify=verify)
@@ -58,16 +59,25 @@ def get_metadata(
58
59
  else:
59
60
  instance = response.json()
60
61
  base_metadata = instance["metadata"]
61
- metadata["descriptions"][0]["description"] = base_metadata.get(
62
- "description"
63
- )
64
- additional_descriptions = base_metadata.get(
65
- "additional_descriptions", []
66
- )
67
- count = 1
68
- for desc in additional_descriptions:
69
- metadata["descriptions"][count]["description"] = desc["description"]
70
- count += 1
62
+ if "descriptions" in metadata:
63
+ metadata["descriptions"][0]["description"] = base_metadata.get(
64
+ "description"
65
+ )
66
+ additional_descriptions = base_metadata.get(
67
+ "additional_descriptions", []
68
+ )
69
+ count = 1
70
+ if (
71
+ len(metadata["descriptions"])
72
+ == len(additional_descriptions) + 1
73
+ ):
74
+ for desc in additional_descriptions:
75
+ metadata["descriptions"][count]["description"] = desc[
76
+ "description"
77
+ ]
78
+ count += 1
79
+ else:
80
+ print(f"Record {idv} does not have a description.")
71
81
  if "formats" in metadata:
72
82
  metadata["formats"] = list(set(metadata["formats"]))
73
83
  if validate:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: caltechdata-api
3
- Version: 1.10.3
3
+ Version: 1.10.4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [metadata]
6
6
  name = caltechdata_api
7
- version = 1.10.3
7
+ version = 1.10.4
8
8
  author = Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
9
9
  author_email = tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu
10
10
  description = Python wrapper for CaltechDATA API.