1. beno
  2. python-sword2

Wiki

Clone wiki

python-sword2 / Home

Python client for SWORD version 2 (SWORD2)

SWORD homepage

SWORD overview

SWORD was originally a JISC-funded initiative to define and develop a standard mechanism for depositing into repositories and other systems. Why was it created? because there was no standard way of doing this. A standard deposit interface to repositories allows more services to be built which can offer functionality such as deposit from multiple locations, e.g. disparate repositories, desktop drag’n'drop tools or from within standard office applications. SWORD can also facilitate deposit to multiple repositories, increasingly important for depositors who wish to deposit to funder, institutional or subject repositories. Other possibilities include migration of content between repositories, transfer to preservation services and many more.

SWORD is an Atom Publishing Profile

Rather than develop a new standard from scratch, SWORD chose to leverage the existing Atom Publishing Protocol (APP), “an application-level protocol for publishing and editing Web resources”. APP is based on the HTTP transfer of Atom-formatted representations yet SWORD has focussed on two key aspects of the protocol – the deposit of files, rather than Atom documents, and the extension mechanism for specifying additional deposit parameters. Also worth noting is that SWORD does not specify the implementation of all of the functionality of APP, rather it supports deposit only – implementations are free to support update and delete if they wish but this is out of the SWORD remit.

Python Client library

Support for the SWORD2 APP Profile

  • Retrieving a Service Document
    • Listing Collections
  • Creating a Resource
    • Creating a Resource with a Binary File Deposit
    • Creating a Resource with a Multipart Deposit
    • Creating a Resource with an Atom Entry
  • Retrieving the content
  • Replacing the Content of a Resource
    • Replacing the File Content of a Resource
    • Replacing the Metadata of a Resource
    • Replacing the Metadata and File Content of a Resource
  • Adding Content to a Resource
    • Adding New Files to the Media Resource
    • Adding New Packages or Files to a Container
    • Adding New Metadata to a Container
    • Adding New Metadata and Packages or Files to a Container with Multipart
  • Deleting the Content of a Resource
  • Deleting the Container
  • Retrieving the [SWORD2] Statement -- partial support
  • Authentication and Mediated Deposit
    • Mediation In Service Description
  • Continued Deposit
    • Completing a Previously Incomplete Deposit
  • Receipts
    • Handling the Deposit Receipt
    • Handling Error Documents

Dependencies

The core dependency is httplib2, and uses this for all of its HTTP requests and response handling.

The python client tries to use any suitable ElementTree library implementation (lxml, xml.etree, cElementTree, ElementTree) and will fail without one.

Documentation:

(for sword2 package version >= 0.1.15)

Licensing

This python project is under an "MIT" license and can be freely used under its terms.

Updated