Python wrapper for the CaltechDATA API.
Project description
caltechdata_api
Python library for using the CaltechDATA API
- caltechdata_write write files and a DataCite 4 standard json record to CaltechDATA repository
- caltechdata_edit edits records in CaltechDATA
- get_metadata gets metadata from CaltechDATA records
Requires Python 3 (Recommended via Anaconda https://www.anaconda.com/download) with reqests library.
Examples
There are some example python scripts in the GitHub repository.
Create a record:
python example.py example.json -fnames logo.gif
Successfully created record https://cd-sandbox.tind.io/records/352.
Edit a record (make changes to the example.json file to see a change)
python edit.py example.json -ids 352 -fnames logo.gif
Successfully modified record https://cd-sandbox.tind.io/records/352
Setup
Install by typing 'pip install caltechdata_api'
Usage
Write API access is controlled by repository staff. Email us at data@caltech.edu with your request if you want to use the write API.
You need to acquire a personal access token from your CaltechDATA account (find it at the top right of your screen under "Applications"). Make sure you include the "deposit_api:write" and "file_manager:upload" scopes. Then copy the token to token.bash. Type source token.bash in the command line to load the token.
Only test your application on the test repository. Testing the API on the public repository will generate junk records that are annoying to delete.
TODO
Handle incorrect token on file upload
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
Hashes for caltechdata_api-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b2db84b0d6fd390e4f20c38b667f7816a2be050f896205d24f672c98f5fbc1c |
|
MD5 | 61e870bd60d8228033731e5d6c501f3e |
|
BLAKE2b-256 | ea0f501351713656450485d7e3ae2e268c219328c42f8d3ffd7827973eee0507 |