caltechdata-api 2.2.1__tar.gz → 2.2.3__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 (33) hide show
  1. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/PKG-INFO +1 -1
  2. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/caltechdata_edit.py +6 -6
  3. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/caltechdata_write.py +15 -9
  4. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/PKG-INFO +1 -1
  5. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/pyproject.toml +1 -1
  6. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/LICENSE +0 -0
  7. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/README.md +0 -0
  8. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/__init__.py +0 -0
  9. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/cli.py +0 -0
  10. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/customize_schema.py +0 -0
  11. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/download_file.py +0 -0
  12. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/download_from_record.py +0 -0
  13. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/get_metadata.py +0 -0
  14. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/md_to_json.py +0 -0
  15. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/utils.py +0 -0
  16. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/date_types.yaml +0 -0
  17. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/description_types.yaml +0 -0
  18. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/identifier_types.yaml +0 -0
  19. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/licenses.csv +0 -0
  20. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/relation_types.yaml +0 -0
  21. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/resource_types.yaml +0 -0
  22. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/roles.yaml +0 -0
  23. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies/title_types.yaml +0 -0
  24. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api/vocabularies.yaml +0 -0
  25. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/SOURCES.txt +0 -0
  26. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/dependency_links.txt +0 -0
  27. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/entry_points.txt +0 -0
  28. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/requires.txt +0 -0
  29. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/caltechdata_api.egg-info/top_level.txt +0 -0
  30. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/setup.cfg +0 -0
  31. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/tests/test_download.py +0 -0
  32. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/tests/test_rdm.py +0 -0
  33. {caltechdata_api-2.2.1 → caltechdata_api-2.2.3}/tests/test_unit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: caltechdata_api
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Python wrapper for CaltechDATA API.
5
5
  Author: Rohan Bhattarai, Elizabeth Won
6
6
  Author-email: Thomas E Morrell <tmorrell@caltech.edu>, Alexander A Abakah <aabakah@caltech.edu>, Kshemaahna Nagi <knagi@caltech.edu>
@@ -131,18 +131,18 @@ def caltechdata_edit(
131
131
 
132
132
  if authors == False:
133
133
  if production == True:
134
- url = "https://data.caltech.edu/"
134
+ url = "https://data.caltech.edu"
135
135
  elif local == True:
136
- url = "https://127.0.0.1:5000/"
136
+ url = "https://127.0.0.1:5000"
137
137
  else:
138
- url = "https://data.caltechlibrary.dev/"
138
+ url = "https://data.caltechlibrary.dev"
139
139
  else:
140
140
  if production == True:
141
- url = "https://authors.library.caltech.edu/"
141
+ url = "https://authors.library.caltech.edu"
142
142
  elif local == True:
143
- url = "https://127.0.0.1:5000/"
143
+ url = "https://127.0.0.1:5000"
144
144
  else:
145
- url = "https://authors.caltechlibrary.dev/"
145
+ url = "https://authors.caltechlibrary.dev"
146
146
 
147
147
  headers = {
148
148
  "Authorization": "Bearer %s" % token,
@@ -69,14 +69,19 @@ def write_files_rdm(
69
69
 
70
70
  def add_file_links(file_upload_link, file_links, headers, keepfiles=False):
71
71
  # Currently configured for S3 links, assuming all are at the same endpoint
72
+ # Links are urls, or (file name, url) pairs when the url file names are not
73
+ # unique across the bucket
72
74
  link_string = ""
73
- endpoint = "https://" + file_links[0].split("/")[2]
75
+ file_links = [
76
+ link if isinstance(link, (list, tuple)) else (link.split("/")[-1], link)
77
+ for link in file_links
78
+ ]
79
+ endpoint = "https://" + file_links[0][1].split("/")[2]
74
80
  s3 = s3fs.S3FileSystem(anon=True, client_kwargs={"endpoint_url": endpoint})
75
81
  index = 0
76
82
  file_json = []
77
83
  f_list = []
78
- for link in file_links:
79
- file = link.split("/")[-1]
84
+ for file, link in file_links:
80
85
  f_list.append(file)
81
86
  path = link.split(endpoint)[1]
82
87
  size = s3.info(path)["size"]
@@ -98,6 +103,7 @@ def add_file_links(file_upload_link, file_links, headers, keepfiles=False):
98
103
  result = requests.delete(ex["links"]["self"], headers=headers)
99
104
  if result.status_code != 204:
100
105
  raise Exception(result.text)
106
+
101
107
  result = requests.post(file_upload_link, headers=headers, json=file_json)
102
108
  if result.status_code != 201:
103
109
  raise Exception(result.text)
@@ -177,18 +183,18 @@ def caltechdata_write(
177
183
 
178
184
  if authors == False:
179
185
  if production == True:
180
- url = "https://data.caltech.edu/"
186
+ url = "https://data.caltech.edu"
181
187
  elif local == True:
182
- url = "https://127.0.0.1:5000/"
188
+ url = "https://127.0.0.1:5000"
183
189
  else:
184
- url = "https://data.caltechlibrary.dev/"
190
+ url = "https://data.caltechlibrary.dev"
185
191
  else:
186
192
  if production == True:
187
- url = "https://authors.library.caltech.edu/"
193
+ url = "https://authors.library.caltech.edu"
188
194
  elif local == True:
189
- url = "https://127.0.0.1:5000/"
195
+ url = "https://127.0.0.1:5000"
190
196
  else:
191
- url = "https://authors.caltechlibrary.dev/"
197
+ url = "https://authors.caltechlibrary.dev"
192
198
 
193
199
  # If files is a string - change to single value array
194
200
  if isinstance(files, str) == True:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: caltechdata_api
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Python wrapper for CaltechDATA API.
5
5
  Author: Rohan Bhattarai, Elizabeth Won
6
6
  Author-email: Thomas E Morrell <tmorrell@caltech.edu>, Alexander A Abakah <aabakah@caltech.edu>, Kshemaahna Nagi <knagi@caltech.edu>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "caltechdata_api"
7
- version = "2.2.1"
7
+ version = "2.2.3"
8
8
  description = "Python wrapper for CaltechDATA API."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
File without changes