dspace-rest-client


Namedspace-rest-client JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://github.com/the-library-code/dspace-rest-client
SummaryA DSpace 7 REST API client library
upload_time2024-04-03 22:45:35
maintainerNone
docs_urlNone
authorKim Shepherd
requires_python>=3.8.0
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DSpace Python REST Client Library
This client library allows Python 3 scripts (Python 2 probably compatible but not officially supported) to interact with
DSpace 7+ repositories, using the DSpace REST API.

This library is a work in progress and so far offers basic create, update, retrieve functionality for
Community, Collection, Bundle, Item, Bitstream, Group and User (EPerson) objects.

Help with extending the scope and improving the code is always welcome!

PyPI homepage: https://pypi.org/project/dspace-rest-client/

## Requirements
* Python 3.x (developed using Python 3.8.5)
* Python Requests module (see `requirements.txt`)
* Working DSpace 7 repository with an accessible REST API

## Installation
To install with pip: 
`pip install dspace_rest_client`

(or `pip3` or `python -m pip` as appropriate to your environment)

To install manually, clone this repository and install the requirements:
```commandline
git clone https://github.com/the-library-code/dspace-rest-python.git
pip install -r requirements.txt
```


## Usage
After installing dependencies, you're ready to run the script.
You can either pass the base API URL to the DSpaceClient() constructor or set them as environment variables.

Some environment variables can be used when setting up the REST client connection.
`DSPACE_API_ENDPOINT` is the base URL of your endpoint eg. http://localhost:8080/server
`DSPACE_API_USERNAME` and `DSPACE_API_PASSWORD` are credentials to use for authentication.

See the `example.py` script for an example of community, collection, item, bundle and bitstream creation.
Just set the credentials and base URL at the top of the script to match your test system, or if you've set environment
variables, remove the arguments from the DSpaceClient() instantiation and the environment variables will be used as
defaults.

The output from the `example.py` script should look something like:

```commandline
╰─$ python example.py                                                                                                                                                                                                              1 ↵
Updating token to 9730dfb9-c4ea-4f56-a2f0-4dc4cacf5059
Authenticated successfully as kim@shepherd.nz
API Post: Updating token to b44f91c2-5386-4c11-a1ca-1ea06613fae4
{"timestamp":"2022-02-10T05:44:12.758+00:00","status":403,"error":"Forbidden","message":"Access is denied. Invalid CSRF token.","path":"/server/api/core/communities"}
API Post: Retrying request with updated CSRF token
community 31264734-49c0-4bff-8ed7-e09e3abbfe7a created successfully!
New community created! Handle: 123456789/10
collection c010ef9c-2483-47c3-83af-8a8c1f72e888 created successfully!
New collection created! Handle: 123456789/11
item e59dfc7a-f96e-4897-a913-e962b220132b created successfully!
New item created! Handle: 123456789/12
New bundle created! UUID: 528d1dd9-ca62-4609-bb2e-1ab367299447
New bitstream created! UUID: 4740048b-25fa-4040-b0d1-4b27f13de75d
All finished with example data creation. Visit your test repository to review created objects
```

## Credits

Created by [Kim Shepherd](https://www.github.com/kshepherd) for [The Library Code GmbH](https://www.lib-co.de) with support from Universität Hohenheim

## License

This work is licensed under the [BSD 3-Clause License](https://github.com/the-library-code/dspace-rest-python/blob/088169cdcb1a92ff33589b1af8c08a17f9885bbf/LICENSE)

Copyright 2021 The Library Code GmbH



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/the-library-code/dspace-rest-client",
    "name": "dspace-rest-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": null,
    "keywords": null,
    "author": "Kim Shepherd",
    "author_email": "kim@the-library-code.de",
    "download_url": null,
    "platform": null,
    "description": "# DSpace Python REST Client Library\nThis client library allows Python 3 scripts (Python 2 probably compatible but not officially supported) to interact with\nDSpace 7+ repositories, using the DSpace REST API.\n\nThis library is a work in progress and so far offers basic create, update, retrieve functionality for\nCommunity, Collection, Bundle, Item, Bitstream, Group and User (EPerson) objects.\n\nHelp with extending the scope and improving the code is always welcome!\n\nPyPI homepage: https://pypi.org/project/dspace-rest-client/\n\n## Requirements\n* Python 3.x (developed using Python 3.8.5)\n* Python Requests module (see `requirements.txt`)\n* Working DSpace 7 repository with an accessible REST API\n\n## Installation\nTo install with pip: \n`pip install dspace_rest_client`\n\n(or `pip3` or `python -m pip` as appropriate to your environment)\n\nTo install manually, clone this repository and install the requirements:\n```commandline\ngit clone https://github.com/the-library-code/dspace-rest-python.git\npip install -r requirements.txt\n```\n\n\n## Usage\nAfter installing dependencies, you're ready to run the script.\nYou can either pass the base API URL to the DSpaceClient() constructor or set them as environment variables.\n\nSome environment variables can be used when setting up the REST client connection.\n`DSPACE_API_ENDPOINT` is the base URL of your endpoint eg. http://localhost:8080/server\n`DSPACE_API_USERNAME` and `DSPACE_API_PASSWORD` are credentials to use for authentication.\n\nSee the `example.py` script for an example of community, collection, item, bundle and bitstream creation.\nJust set the credentials and base URL at the top of the script to match your test system, or if you've set environment\nvariables, remove the arguments from the DSpaceClient() instantiation and the environment variables will be used as\ndefaults.\n\nThe output from the `example.py` script should look something like:\n\n```commandline\n\u2570\u2500$ python example.py                                                                                                                                                                                                              1 \u21b5\nUpdating token to 9730dfb9-c4ea-4f56-a2f0-4dc4cacf5059\nAuthenticated successfully as kim@shepherd.nz\nAPI Post: Updating token to b44f91c2-5386-4c11-a1ca-1ea06613fae4\n{\"timestamp\":\"2022-02-10T05:44:12.758+00:00\",\"status\":403,\"error\":\"Forbidden\",\"message\":\"Access is denied. Invalid CSRF token.\",\"path\":\"/server/api/core/communities\"}\nAPI Post: Retrying request with updated CSRF token\ncommunity 31264734-49c0-4bff-8ed7-e09e3abbfe7a created successfully!\nNew community created! Handle: 123456789/10\ncollection c010ef9c-2483-47c3-83af-8a8c1f72e888 created successfully!\nNew collection created! Handle: 123456789/11\nitem e59dfc7a-f96e-4897-a913-e962b220132b created successfully!\nNew item created! Handle: 123456789/12\nNew bundle created! UUID: 528d1dd9-ca62-4609-bb2e-1ab367299447\nNew bitstream created! UUID: 4740048b-25fa-4040-b0d1-4b27f13de75d\nAll finished with example data creation. Visit your test repository to review created objects\n```\n\n## Credits\n\nCreated by [Kim Shepherd](https://www.github.com/kshepherd) for [The Library Code GmbH](https://www.lib-co.de) with support from Universit\u00e4t Hohenheim\n\n## License\n\nThis work is licensed under the [BSD 3-Clause License](https://github.com/the-library-code/dspace-rest-python/blob/088169cdcb1a92ff33589b1af8c08a17f9885bbf/LICENSE)\n\nCopyright 2021 The Library Code GmbH\n\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A DSpace 7 REST API client library",
    "version": "0.1.10",
    "project_urls": {
        "Changelog": "https://github.com/the-library-code/dspace-rest-python/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/the-library-code/dspace-rest-python/blob/main/README.md",
        "GitHub": "https://github.com/the-library-code/dspace-rest-python",
        "Homepage": "https://github.com/the-library-code/dspace-rest-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8595613cdd0d434aface9afcc8627af42753b1b68cc7c774a15895172847c759",
                "md5": "b720cada509704a250b5779a2bfc71ca",
                "sha256": "7e53141ab539460b39785afc44c2bbe1c7a8bdf1e22d01eee577474211439438"
            },
            "downloads": -1,
            "filename": "dspace_rest_client-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b720cada509704a250b5779a2bfc71ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 18797,
            "upload_time": "2024-04-03T22:45:35",
            "upload_time_iso_8601": "2024-04-03T22:45:35.640911Z",
            "url": "https://files.pythonhosted.org/packages/85/95/613cdd0d434aface9afcc8627af42753b1b68cc7c774a15895172847c759/dspace_rest_client-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 22:45:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "the-library-code",
    "github_project": "dspace-rest-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "dspace-rest-client"
}
        
Elapsed time: 0.22386s