caltechdata-api


Namecaltechdata-api JSON
Version 1.10.5 PyPI version JSON
download
home_pagehttps://github.com/caltechlibrary/caltechdata_api
SummaryPython wrapper for CaltechDATA API.
upload_time2025-09-17 23:21:36
maintainerNone
docs_urlNone
authorThomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi
requires_python>=3.6.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CaltechDATA API Python Library

[![DOI](https://img.shields.io/badge/dynamic/json.svg?label=DOI&query=$.pids.doi.identifier&uri=https://data.caltech.edu/api/records/wfjr5-kw507/versions/latest)](https://data.caltech.edu/records/wfjr5-kw507/latest)

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:

```shell
pip install caltechdata_api
```

## Examples

There are some example python scripts in the GitHub repository.

### Create a record:

```shell
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:

```shell
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.

## 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](https://caltechlibrary.github.io/caltechdata_api/caltechdata_api/cli-documentation-for-users).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/caltechlibrary/caltechdata_api",
    "name": "caltechdata-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "Thomas E Morrell, Rohan Bhattarai, Elizabeth Won, Alexander A Abakah, Kshemaahna Nagi",
    "author_email": "tmorrell@caltech.edu, aabakah@caltech.edu, knagi@caltech.edu",
    "download_url": "https://files.pythonhosted.org/packages/e5/5e/82beb4e61de96096517184bfdf2493fe5eabb681005a5f326af8fee93a7f/caltechdata_api-1.10.5.tar.gz",
    "platform": null,
    "description": "# CaltechDATA API Python Library\n\n[![DOI](https://img.shields.io/badge/dynamic/json.svg?label=DOI&query=$.pids.doi.identifier&uri=https://data.caltech.edu/api/records/wfjr5-kw507/versions/latest)](https://data.caltech.edu/records/wfjr5-kw507/latest)\n\nThe `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.\n\n## Features\n\n### Writing and Editing Records\n- `caltechdata_write`: Writes files and a DataCite 4 standard JSON record to the CaltechDATA repository.\n- `caltechdata_edit`: Edits existing records in CaltechDATA.\n\n### Metadata Operations\n- `get_metadata`: Retrieves metadata from CaltechDATA records.\n\n## Requirements\n\n- Python 3.6+\n\n## Installation\n\nInstall the library via pip:\n\n```shell\npip install caltechdata_api\n```\n\n## Examples\n\nThere are some example python scripts in the GitHub repository.\n\n### Create a record:\n\n```shell\npython write.py example.json -fnames logo.gif\n# Output: pbkn6-m9y63 (unique identifier)\n```\n> The response will be the unique identifier for the record. You can put this at\nthe end of a url to visit the record (e.g.\nhttps://data.caltechlibrary.dev/records/pbkn6-m9y63)\n\n### Edit a record \nMake changes to the example.json file to see a change)\n```\npython edit.py example.json -id pbkn6-m9y63\n10.33569/pbkn6-m9y63\n```\n> The response is the DOI for the record, which includes the unique identifier\nfor the record in the default configuration.\n\n## Using Custom DOIs \nSome groups have worked with the library to create custom DOIs. These can be\npassed in the metadata like:\n\n```shell\npython write.py example_custom.json -fnames logo.gif\nm6zxz-p4j22\n```\n\nAnd then you can edit with\n```\npython edit.py example_custom.json -id m6zxz-p4j22\n10.5281/inveniordm.1234\n```\n\nThis returns the custom DOI of the record if it is successful.\n\n\n## Setup and Authentication\n\n1. Acquire a personal access token from your CaltechDATA account (found under \"Applications\" at the top right of your screen).\n2. Copy the token to a file named token.bash.\n3. Load the token in the command line using source token.bash.\n\n## Note on Testing\n\nOnly test your application on the test repository (`data.caltechlibrary.dev`).  Testing the API on the public \nrepository will generate junk records that are annoying to delete.\n\n## Using the Command Line Interface\n\nIf you would like to interact with the CaltechDATA API using the Command line Interface (CLI), please [see the detailed documentation](https://caltechlibrary.github.io/caltechdata_api/caltechdata_api/cli-documentation-for-users).\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for CaltechDATA API.",
    "version": "1.10.5",
    "project_urls": {
        "Homepage": "https://github.com/caltechlibrary/caltechdata_api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "64ce21bb3aacae3e843ee856a35d7b251bb83955571b7db4f1ab0db3813c29c9",
                "md5": "fd053d240aed96ff2efe9b2e86996e8b",
                "sha256": "144807d9cb048c505fcb077ca560a566cb49866a9b926048f411e34676c948a5"
            },
            "downloads": -1,
            "filename": "caltechdata_api-1.10.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd053d240aed96ff2efe9b2e86996e8b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.0",
            "size": 46973,
            "upload_time": "2025-09-17T23:21:35",
            "upload_time_iso_8601": "2025-09-17T23:21:35.006792Z",
            "url": "https://files.pythonhosted.org/packages/64/ce/21bb3aacae3e843ee856a35d7b251bb83955571b7db4f1ab0db3813c29c9/caltechdata_api-1.10.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e55e82beb4e61de96096517184bfdf2493fe5eabb681005a5f326af8fee93a7f",
                "md5": "f54448479c06675dd48604cf409ec528",
                "sha256": "57c8811d11667ed599367c00ed98895945523fef0c4f63fcd40d3e9a6fe16ad1"
            },
            "downloads": -1,
            "filename": "caltechdata_api-1.10.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f54448479c06675dd48604cf409ec528",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 26460,
            "upload_time": "2025-09-17T23:21:36",
            "upload_time_iso_8601": "2025-09-17T23:21:36.242963Z",
            "url": "https://files.pythonhosted.org/packages/e5/5e/82beb4e61de96096517184bfdf2493fe5eabb681005a5f326af8fee93a7f/caltechdata_api-1.10.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-17 23:21:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "caltechlibrary",
    "github_project": "caltechdata_api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "caltechdata-api"
}
        
Elapsed time: 4.70850s