Python wrapper for CaltechDATA API.
Project description
CaltechDATA API Python Library
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
- Acquire a personal access token from your CaltechDATA account (found under "Applications" at the top right of your screen).
- Copy the token to a file named token.bash.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file caltechdata_api-1.8.2.tar.gz
.
File metadata
- Download URL: caltechdata_api-1.8.2.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5984ea834f6e285d71ab4a32a595cf47d9a6fad4dc0f14ba149fa4a0737bb119 |
|
MD5 | 26a22f402f62f49af08db9104faea889 |
|
BLAKE2b-256 | 90577cbe984c70c5a0b80e9c7ff71aeb2b45594918f83d66580643ca7248d036 |
File details
Details for the file caltechdata_api-1.8.2-py3-none-any.whl
.
File metadata
- Download URL: caltechdata_api-1.8.2-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a5c59369f8601873764de3228ca9b89727bbd984b3ddfb14140fe36b3105412 |
|
MD5 | b3a46d9dc66f5c989f55fdb5c03a44f4 |
|
BLAKE2b-256 | 6b7862ed5eb9c50feab902d731bf2c29156febc6115467317b778d3e379b06cd |