Skip to main content

CaltechDATA API Python Library

DOI

The caltechdata_api Python library provides a convenient interface for interacting with the CaltechDATA API. It allows users to write files, create DataCite 4 standard JSON records, edit existing records, and retrieve metadata from the CaltechDATA repository.

Features

Writing and Editing Records

  • caltechdata_write: Writes files and a DataCite 4 standard JSON record to the CaltechDATA repository.
  • caltechdata_edit: Edits existing records in CaltechDATA.

Metadata Operations

  • get_metadata: Retrieves metadata from CaltechDATA records.

Requirements

  • Python 3.9+

Installation

Install the library via pip:

pip install caltechdata_api

Or add it to a uv project:

uv add caltechdata_api

You can also run a script using uv:

uv run write.py

Examples

There are some example python scripts in the GitHub repository.

Create a record:

uv run write.py example.json -fnames logo.gif
# Output: pbkn6-m9y63 (unique identifier)

The response will be the unique identifier for the record. You can put this at the end of a url to visit the record (e.g. https://data.caltechlibrary.dev/records/pbkn6-m9y63)

Edit a record

Make changes to the example.json file to see a change)

uv run edit.py example.json -id pbkn6-m9y63
10.33569/pbkn6-m9y63

The response is the DOI for the record, which includes the unique identifier for the record in the default configuration.

Using Custom DOIs

Some groups have worked with the library to create custom DOIs. These can be passed in the metadata like:

uv run write.py example_custom.json -fnames logo.gif
m6zxz-p4j22

And then you can edit with

uv run edit.py example_custom.json -id m6zxz-p4j22
10.5281/inveniordm.1234

This returns the custom DOI of the record if it is successful.

Setup and Authentication

  1. Acquire a personal access token from your CaltechDATA account (found under "Applications" at the top right of your screen).
  2. Copy the token to a file named token.bash.
  3. Load the token in the command line using source token.bash.

Note on Testing

Only test your application on the test repository (data.caltechlibrary.dev). Testing the API on the public repository will generate junk records that are annoying to delete.

Using the Command Line Interface

If you would like to interact with the CaltechDATA API using the Command line Interface (CLI), please see the detailed documentation.

Metadata

Release files for caltechdata-api 2.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for caltechdata-api 2.2.3
File Size Uploaded Provenance Actions
caltechdata_api-2.2.3.tar.gz 46.5 kB Without provenance Details for caltechdata_api-2.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for caltechdata-api 2.2.3
File Interpreter ABI Platform Actions
caltechdata_api-2.2.3-py3-none-any.whl Python 3 none any Details for caltechdata_api-2.2.3-py3-none-any.whl

Total release size: 95.7 kB

Release files / caltechdata_api-2.2.3.tar.gz

Download URL caltechdata_api-2.2.3.tar.gz
Size 46.5 kB
Tags Source
SHA-256 checksum
How to use checksums
afa091c13d8a249ed49fd7818fa6db5af9def9b121c62794b044fd6ee97b7391
BLAKE2b-256 checksum
How to use checksums
98ea859baa64bc341204120d5d132e77ea0a7a34f863d696f61b97e5b1db27fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / caltechdata_api-2.2.3-py3-none-any.whl

Download URL caltechdata_api-2.2.3-py3-none-any.whl
Size 49.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31211df43d138e026a24dc6c2128023977727da46df0f78ef89cbc4451361d0f
BLAKE2b-256 checksum
How to use checksums
dbfec04bde5acccc4c44c06ad73c32eb878b8355915584fb3c99436c5a77b6df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for caltechdata-api 2.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.2.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page