DSpace provides methods for interacting with the DSpaceTools API, which is a custom REST API for the ASU Digital HPS Repository.
Methods
all_collections() | Retrieves details about all of the collections to which a user has access. |
bitstream(bitstream) | Returns information about a bitstream. |
clean_text(s) | Gets rid of garbage. |
collection(collection) | Retrieves details for a specific collection, by id. |
communities() | Retrieves all of the communities to which the user has access. |
community(community) | Retrieves details about a specific community, by id. |
dict_from_node(node[, recursive]) | Converts ElementTree node to a dictionary. |
get_bitstream(bitstream[, save_path]) | Downloads a bitstream and handles it. |
get_digest(path) | Produces an authentication digest based on resource path and your private key. |
get_element_from_resource(path[, idOnly]) | Retrieves the desired resource from the DSpace API. |
get_path(path[, idOnly]) | Produces a full path for the desired resource. |
item(item) | Retrieve an item by id. |
item_metadata(item) | Returs metadata for an item as a simple dictionary, with dc fields as keys. |
list_bitstream_ids(item) | Returns a list of bitstream ids for an item. |
list_collection_ids(community) | Returns a list of collection IDs for a given community. |
list_collections(community) | Retrieves details about the collections in a community. |
list_item_ids(collection) | Returns a list of item IDs for a given collection. |
list_items(collection) | Retrieves details about all items in a collection. |
Retrieves details about all of the collections to which a user has access.
Returns : | list : a list of nested dictionaries. |
---|
Returns information about a bitstream.
Parameters : | item : string or int
|
---|---|
Returns : | dict : a nested dictionary. |
Gets rid of garbage. Strips non-ascii characters, newlines, and leading/ trailing whitespace.
Parameters : | s : string
|
---|---|
Returns : | string : a somewhat cleaner string. |
Retrieves details for a specific collection, by id.
Parameters : | collection : string or int
|
---|---|
Returns : | dict : a nested dictionary. |
Retrieves all of the communities to which the user has access.
Returns : | list : a list of nested dictionaries. |
---|
Retrieves details about a specific community, by id.
Parameters : | community : string or int
|
---|---|
Returns : | dict : a nested dictionary. |
Converts ElementTree node to a dictionary.
Parameters : | node : ElementTree node recursive : boolean
|
---|---|
Returns : | dict : nested dictionary.
|
Downloads a bitstream and handles it. If save_path is provided, returns a file pointer. Otherwise returns the content of the bitstream.
Parameters : | bitstream : string or int
save_path : string or None
|
---|---|
Returns : | Contents of bitstream, or file pointer. : |
Notes
WARNING: This has only been tested on bitstreams containing text data!
TODO: More robust handling for different data types.
Produces an authentication digest based on resource path and your private key.
Parameters : | path : string
|
---|---|
Returns : | string : authentication digest for desired resource. |
Retrieves the desired resource from the DSpace API.
Parameters : | path : string
idOnly : boolean
|
---|---|
Returns : | ElementTree node : containing API response. |
Produces a full path for the desired resource.
Parameters : | path : string
idOnly : boolean
|
---|---|
Returns : | string : full URL of desired resource, including authentication
|
Retrieve an item by id.
Parameters : | item : string or int
|
---|---|
Returns : | dict : a nested dictionary. |
Returs metadata for an item as a simple dictionary, with dc fields as keys.
Parameters : | item : string or int
|
---|---|
Returns : | dict : metadata, with dc fields as keys. |
Returns a list of bitstream ids for an item.
Parameters : | item : string or int
|
---|---|
Returns : | list : a list of bitstream ids. |
Returns a list of collection IDs for a given community.
Parameters : | community : string or int
|
---|---|
Returns : | list : a list of collection ids. |
Retrieves details about the collections in a community.
Parameters : | community : string or int
|
---|---|
Returns : | list : a list of nested dictionaries. |