Description

PyFedoREST is a pure Python package for creating and managing objects in a Fedora Repository. It is a minimal Python wrapper around V3.2.1 of the Fedora REST API.

The source code for this product is also available from the Fedora Commons SVN at https://fedora-commons.svn.sourceforge.net/svnroot/fedora-commons/incubator/kepler/trunk/python/PyFedoREST. The package is available in both zip and tar/gzip formats as well as eggs for Python 2.4, Python 2.5 or Python 2.6.

In order to use this package, you must install the httplib2 package in your Python path. httplib2 is available from PYPI or Google.

PyFedoREST was written by Rick Moore for Fedora Commons and the Cornell University Library. Funding for this project was provided under a grant from the Mellon Foundation.

Product components

FCRepoRestAPI class

Usage :

from fcrepo.http.restapi import FCRepoRestAPI

rest = FCRepoRestAPI(repository_url='http://localhost:8080/fedora', username='fedoraAdmin',
 password='fedora', realm='any', namespace='fedora')

This pure Python class contains a one-to-one implementation of each method documented in Version 3.2.1 of the Fedora Repository REST API. It is the only class you need import into your application.

FCRepoRequestFactory class

Usage:

from fcrepo.http.RequestFactory import FCRepoRequestFactory

factory = FCRepoRequestFactory(repository_url='http://localhost:8080/fedora', username='fedoraAdmin',
 password='fedora', realm='any')

This is a support class that supplies HTTP connections and services to instances of FCRepoRestAPI. It implements GET, PUT, POST and DELETE methods in a very simple Jython wrapper around the same org.apache.commons.httpclient Java libraries used in the standard Fedora installation. The GET, PUT, POST and DELETE methods (and, thus, the FCRepoRestAPI class methods that use them) each return an instance of the FCRepoResponse class.

FCRepoResponse class

This is a support class that provides a Pythonic interface to elements of a response to an httplib2 request. It is returned by the HTTP methods of a FCRepoRequestFactory and implements the following methods: