caltechdata-api


Namecaltechdata-api JSON
Version 1.6.1 PyPI version JSON
download
home_pagehttps://github.com/caltechlibrary/caltechdata_api
SummaryPython wrapper for CaltechDATA API.
upload_time2024-05-01 19:52:07
maintainerNone
docs_urlNone
authorThomas E Morrell
requires_python>=3.6.0
licensehttps://data.caltech.edu/license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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 (Anaconda is recommended)
- `requests` library

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




            

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",
    "author_email": "tmorrell@caltech.edu",
    "download_url": "https://files.pythonhosted.org/packages/71/d7/377831bc939edd1ab7cab2cf78bb5dee3a8138dcb3ed68e554ec954679b5/caltechdata_api-1.6.1.tar.gz",
    "platform": null,
    "description": "\n# CaltechDATA API Python Library\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 (Anaconda is recommended)\n- `requests` library\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\n\n",
    "bugtrack_url": null,
    "license": "https://data.caltech.edu/license",
    "summary": "Python wrapper for CaltechDATA API.",
    "version": "1.6.1",
    "project_urls": {
        "Homepage": "https://github.com/caltechlibrary/caltechdata_api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "703a08304966ab20cb89cb32911367073129fd6d4dc7b30cfb25a17980a969e4",
                "md5": "c0fcb8588802534dee8d57e2b55120ac",
                "sha256": "3d16cc42547892a0dbb1727fd7cfed1f97bfd73e0601c3265208e88ffcbcd64e"
            },
            "downloads": -1,
            "filename": "caltechdata_api-1.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0fcb8588802534dee8d57e2b55120ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.0",
            "size": 42791,
            "upload_time": "2024-05-01T19:52:02",
            "upload_time_iso_8601": "2024-05-01T19:52:02.027805Z",
            "url": "https://files.pythonhosted.org/packages/70/3a/08304966ab20cb89cb32911367073129fd6d4dc7b30cfb25a17980a969e4/caltechdata_api-1.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71d7377831bc939edd1ab7cab2cf78bb5dee3a8138dcb3ed68e554ec954679b5",
                "md5": "0674aafe8605282f3ffbec2e2518d96b",
                "sha256": "ada923a218224c7cacba914f81934646e8e0312fc2f61c87129a5283c6f6e446"
            },
            "downloads": -1,
            "filename": "caltechdata_api-1.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0674aafe8605282f3ffbec2e2518d96b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.0",
            "size": 23346,
            "upload_time": "2024-05-01T19:52:07",
            "upload_time_iso_8601": "2024-05-01T19:52:07.703367Z",
            "url": "https://files.pythonhosted.org/packages/71/d7/377831bc939edd1ab7cab2cf78bb5dee3a8138dcb3ed68e554ec954679b5/caltechdata_api-1.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-01 19:52:07",
    "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: 0.22572s