caltechdata-api 1.8.0__tar.gz → 1.8.1__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 (21) hide show
  1. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/PKG-INFO +1 -1
  2. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/cli.py +21 -12
  3. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/customize_schema.py +1 -18
  4. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/PKG-INFO +1 -1
  5. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/LICENSE +0 -0
  6. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/README.md +0 -0
  7. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/__init__.py +0 -0
  8. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/caltechdata_edit.py +0 -0
  9. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/caltechdata_write.py +0 -0
  10. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/download_file.py +0 -0
  11. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/get_files.py +0 -0
  12. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/get_metadata.py +0 -0
  13. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/md_to_json.py +0 -0
  14. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api/utils.py +0 -0
  15. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/SOURCES.txt +0 -0
  16. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/dependency_links.txt +0 -0
  17. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/entry_points.txt +0 -0
  18. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/requires.txt +0 -0
  19. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/caltechdata_api.egg-info/top_level.txt +0 -0
  20. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/setup.cfg +0 -0
  21. {caltechdata_api-1.8.0 → caltechdata_api-1.8.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: caltechdata_api
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Python wrapper for CaltechDATA API.
5
5
  Home-page: https://github.com/caltechlibrary/caltechdata_api
6
6
  Author: Thomas E Morrell, Bhattarai Rohan , Won Elizabeth
@@ -140,7 +140,7 @@ def get_funding_entries():
140
140
  def validate_funder_identifier(funder_identifier):
141
141
  response = requests.get(f"https://api.ror.org/organizations/{funder_identifier}")
142
142
  if response.status_code == 200:
143
- return True
143
+ return response.json().get("name")
144
144
  else:
145
145
  return False
146
146
 
@@ -157,7 +157,8 @@ def get_funding_details():
157
157
  award_title = get_user_input("Enter the award title for funding: ")
158
158
  while True:
159
159
  funder_identifier = get_user_input("Enter the funder ROR (https://ror.org): ")
160
- if validate_funder_identifier(funder_identifier):
160
+ name = validate_funder_identifier(funder_identifier)
161
+ if name:
161
162
  break
162
163
  else:
163
164
  print(
@@ -169,6 +170,7 @@ def get_funding_details():
169
170
  return {
170
171
  "awardNumber": award_number,
171
172
  "awardTitle": award_title,
173
+ "funderName": name,
172
174
  "funderIdentifier": funder_identifier,
173
175
  "funderIdentifierType": "ROR",
174
176
  }
@@ -194,9 +196,18 @@ def parse_arguments():
194
196
  if license_number.isdigit() and 1 <= int(license_number) <= 8:
195
197
  # Valid license number selected
196
198
  args["license"] = {
197
- "1": "cc0-1.0",
198
- "2": "cc-by-4.0",
199
- "3": "cc-by-nc-4.0",
199
+ "1": {
200
+ "rights": "Creative Commons Zero v1.0 Universal",
201
+ "rightsIdentifier": "cc0-1.0",
202
+ },
203
+ "2": {
204
+ "rights": "Creative Commons Attribution v4.0 Universal",
205
+ "rightsIdentifier": "cc-by-4.0",
206
+ },
207
+ "3": {
208
+ "rights": "Creative Commons Attribution Non-Commercial v4.0 Universal",
209
+ "rightsIdentifier": "cc-by-nc-4.0",
210
+ },
200
211
  }[license_number]
201
212
  break
202
213
  else:
@@ -259,9 +270,11 @@ def get_names(orcid):
259
270
  return family_name, given_name
260
271
 
261
272
 
262
- def write_s3cmd_config(access_key, secret_key, endpoint):
273
+ def write_s3cmd_config(endpoint):
263
274
  configf = os.path.join(home_directory, ".s3cfg")
264
275
  if not os.path.exists(configf):
276
+ access_key = get_user_input("Enter the access key: ")
277
+ secret_key = get_user_input("Enter the secret key: ")
265
278
  with open(configf, "w") as file:
266
279
  file.write(
267
280
  f"""[default]
@@ -286,9 +299,7 @@ def upload_supporting_file(record_id=None):
286
299
  endpoint = "sdsc.osn.xsede.org"
287
300
  path = "ini230004-bucket01/"
288
301
  if not record_id:
289
- access_key = get_user_input("Enter the access key: ")
290
- secret_key = get_user_input("Enter the secret key: ")
291
- write_s3cmd_config(access_key, secret_key, endpoint)
302
+ write_s3cmd_config(endpoint)
292
303
  print("""S3 connection configured.""")
293
304
  break
294
305
  endpoint = f"https://{endpoint}/"
@@ -478,9 +489,7 @@ def create_record(production):
478
489
  ],
479
490
  "types": {"resourceType": "", "resourceTypeGeneral": "Dataset"},
480
491
  "rightsList": [
481
- {
482
- "rightsIdentifier": args["license"],
483
- }
492
+ args["license"],
484
493
  ],
485
494
  "fundingReferences": args["fundingReferences"],
486
495
  "schemaVersion": "http://datacite.org/schema/kernel-4",
@@ -415,24 +415,7 @@ def validate_metadata(json_record):
415
415
  "Each entry in 'titles' must be a dictionary with a 'title' key."
416
416
  )
417
417
 
418
- # Check for 'publication_date'
419
- if "publicationYear" not in json_record and "dates" not in json_record:
420
- errors.append(
421
- "A publication date is required ('publicationYear' or 'dates' field is missing)."
422
- )
423
- if "dates" in json_record:
424
- if not isinstance(json_record["dates"], list):
425
- errors.append("'dates' should be a list.")
426
- else:
427
- for date_entry in json_record["dates"]:
428
- if (
429
- not isinstance(date_entry, dict)
430
- or "dateType" not in date_entry
431
- or "date" not in date_entry
432
- ):
433
- errors.append(
434
- "Each entry in 'dates' must be a dictionary with 'dateType' and 'date' keys."
435
- )
418
+ # Publication date is handled by customize function
436
419
 
437
420
  # Check for 'creators'
438
421
  if "creators" not in json_record:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: caltechdata-api
3
- Version: 1.8.0
3
+ Version: 1.8.1
4
4
  Summary: Python wrapper for CaltechDATA API.
5
5
  Home-page: https://github.com/caltechlibrary/caltechdata_api
6
6
  Author: Thomas E Morrell, Bhattarai Rohan , Won Elizabeth
File without changes