Skip to content

J4bbi/dspace_rest_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DSpace REST API client

Make it easy and simple to talk to DSpace.

Requirements

Written in Python3 and requires no external packages.

There is a class for each DSpace object type: Community, Collection, Item and Bitstream as well as a wee Metadata wrapper object.

Documentation

By default the load_item_metadata parameter is set to False because usually we don't want to download the entire metadata of each item. The REST API gets around this overload problem by offering the optional expand parameter whereby you instruct the API explicitly to return related information.

If load_item_metadata is set to True a separate API call will be made to retrieve metadata on each time. This can take quite some time if say querying all items in a 1000 item DSpace. So use with caution.

Usage

The following example establishes a connection to a server and prints out the name of the first top-level community.

import dspace_rest_client

d = DSpaceRestClient(user='[email protected]',
                    password=PASSWORD,
                    rest_url='https://demo.dspace.org/rest',
                    verify_ssl=False)
top_communites = d.get_top_communities()
print(top_communites[0].name)
d.logout()

You can also do more complex queries. For instance, this query returns items that have been modified after March 18th 2019.

import dspace_rest_client

d = DSpaceRestClient(user='[email protected]',
                    password=PASSWORD,
                    rest_url='https://demo.dspace.org/rest',
                    verify_ssl=False)

t = datetime.date(2019, 3, 18).timetuple()

for i in d.get_items():
   if(i.lastModified > t):
       print(i)
d.logout()

See also

REST Based Quality Control Reports are accessible via a neat web UI. See for instance here.

TODO

LICENSE

Copyright (c) 2019, Hrafn Malmquist All rights reserved.

This source code is licensed under the BSD-3-clause license found in the LICENSE file in the root directory of this source tree.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages