caltechdata-api 2.2.2__py3-none-any.whl → 2.2.3__py3-none-any.whl

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.
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: caltechdata_api
3
- Version: 2.2.2
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>
@@ -1,6 +1,6 @@
1
1
  caltechdata_api/__init__.py,sha256=bzrm-nSBmVz7k73oI3hniolXeKbzlJFOMhoyqQ61DwI,585
2
2
  caltechdata_api/caltechdata_edit.py,sha256=pXYkIPwRvhbG_x_6hZIJnP38AdJdnq3nsv3XTYr6KCY,12043
3
- caltechdata_api/caltechdata_write.py,sha256=C-MZwZi8d7OhreBJaB4C51DRH5gQcLo5zEZCPjFUbB0,10338
3
+ caltechdata_api/caltechdata_write.py,sha256=2CpMevIY7ZLcvaxPgR_H10CIvkO9iqxpWJf_J9JncCc,10561
4
4
  caltechdata_api/cli.py,sha256=4hoUJK5U6dWWKgvIATG8VR85Q1JOuNG38UWYu5QlX1c,31788
5
5
  caltechdata_api/customize_schema.py,sha256=3aLbbIlG2PTmP6yXUGuTp56PwFso2qiMgDmy6-qahHs,26510
6
6
  caltechdata_api/download_file.py,sha256=IXObPtkS7mKFUViY1ik2X-nBiNB7V6k-Zj8zf01qAQI,1983
@@ -17,9 +17,9 @@ caltechdata_api/vocabularies/relation_types.yaml,sha256=gTPawCQrdeG8VDVZOtbCa7tP
17
17
  caltechdata_api/vocabularies/resource_types.yaml,sha256=w2KCOeQ0F3rHPJRHOhoPJn8gRDWn4AgwZ_rhYdYidqg,16372
18
18
  caltechdata_api/vocabularies/roles.yaml,sha256=Lgf_P4mDUpe_1GyZlbM3-PC6LAdl4kmNqCsVSqNP1uk,1815
19
19
  caltechdata_api/vocabularies/title_types.yaml,sha256=J3qHCGqTadwujy8cU3lP32PfnpIiA6E-nbQYspaDoLU,332
20
- caltechdata_api-2.2.2.dist-info/licenses/LICENSE,sha256=QvFsgOiOJGxfQjx34g5Fpw2twHYgiIqrcsp1AXxmZiM,1523
21
- caltechdata_api-2.2.2.dist-info/METADATA,sha256=X10yM3dEN4-KwTe3EgJHEOqem6-CtbEl84VAbiBYKYU,4290
22
- caltechdata_api-2.2.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
23
- caltechdata_api-2.2.2.dist-info/entry_points.txt,sha256=AYk_A9Pq_6I4jbRZ5rd_Mxbw2W_981mhyXLYgk1oGcI,61
24
- caltechdata_api-2.2.2.dist-info/top_level.txt,sha256=giC9aULvRY9HlV2IvaPZmwn1b46eLM1rbT3XqYiYOI0,16
25
- caltechdata_api-2.2.2.dist-info/RECORD,,
20
+ caltechdata_api-2.2.3.dist-info/licenses/LICENSE,sha256=QvFsgOiOJGxfQjx34g5Fpw2twHYgiIqrcsp1AXxmZiM,1523
21
+ caltechdata_api-2.2.3.dist-info/METADATA,sha256=04FBnL2rJmeiPMjC1zZ2uN5DxIMtxvgy0Ks3gx122Tw,4290
22
+ caltechdata_api-2.2.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
23
+ caltechdata_api-2.2.3.dist-info/entry_points.txt,sha256=AYk_A9Pq_6I4jbRZ5rd_Mxbw2W_981mhyXLYgk1oGcI,61
24
+ caltechdata_api-2.2.3.dist-info/top_level.txt,sha256=giC9aULvRY9HlV2IvaPZmwn1b46eLM1rbT3XqYiYOI0,16
25
+ caltechdata_api-2.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (84.0.0)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5