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.4

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.4
File Size Uploaded Provenance Actions
caltechdata_api-2.2.4.tar.gz 49.9 kB Without provenance Details for caltechdata_api-2.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 99.5 kB

Release files / caltechdata_api-2.2.4.tar.gz

Download URL caltechdata_api-2.2.4.tar.gz
Size 49.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1377b5df82bf1cd208fb40fd9c5f61b9d02a14b9ab0662ea35a3a4bb99d337e
BLAKE2b-256 checksum
How to use checksums
02415528436d9b7ea4ccfe00cac6df71765b63396af37cdccb383f33655c7a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL caltechdata_api-2.2.4-py3-none-any.whl
Size 49.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b1b597a2ef7271a17e0904e69e272428e410b919969ac9352c153a1f52ccfaa
BLAKE2b-256 checksum
How to use checksums
786524a3ae57d6386fe3cad318c3d5aed000ea987d6c289b2fa38129d447a11a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for caltechdata-api 2.2.4

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.4 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