Skip to main content

Python wrapper for CaltechDATA API.

Project description

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.6+

Installation

Install the library via pip:

pip install caltechdata_api

Examples

There are some example python scripts in the GitHub repository.

###Create a record:

python 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)

python 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:

python write.py example_custom.json -fnames logo.gif
m6zxz-p4j22

And then you can edit with

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caltechdata_api-1.9.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

caltechdata_api-1.9.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file caltechdata_api-1.9.0.tar.gz.

File metadata

  • Download URL: caltechdata_api-1.9.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for caltechdata_api-1.9.0.tar.gz
Algorithm Hash digest
SHA256 867b744a0a8393ab5b004329d6cb347bff629f561b9fd82e4ccf47b94866ccc7
MD5 1e1b782a52f9914b555a153811645ad4
BLAKE2b-256 17d23ac947c203b13d0c1e3567fd278a6b93401033192e7c2361acc4380f0eb5

See more details on using hashes here.

File details

Details for the file caltechdata_api-1.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for caltechdata_api-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d3d5ee33fd6f9b2e954f81e14d93d14ee11724200a14568b9eae57e6e530de6
MD5 80f161e4f07f36456bb1afaa84f70431
BLAKE2b-256 fcafd5a8ea9d51090173681a4f0ad0fa9b44eedb8906c0de4d89eaa93bbff1c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page