Package musicbrainz2 :: Module webservice :: Class WebService
[frames | no frames]

Type WebService

 object --+    
          |    
IWebService --+
              |
             WebService


An interface to the MusicBrainz XML web service via HTTP.

By default, this class uses the MusicBrainz server but may be configured for accessing other servers as well using the constructor. This implements IWebService, so additional documentation on method parameters can be found there.
Method Summary
  __init__(self, host, port, pathPrefix, username, password, realm, opener)
Constructor.
  get(self, entity, id_, include, filter, version)
Query the web service via HTTP-GET.
  post(self, entity, id_, data, version)
Send data to the web service via HTTP-POST.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

__init__(self, host='musicbrainz.org', port=80, pathPrefix='/ws', username=None, password=None, realm='musicbrainz.org', opener=None)
(Constructor)

Constructor.

This can be used without parameters. In this case, the MusicBrainz server will be used.
Parameters:
host - a string containing a host name
port - an integer containing a port number
pathPrefix - a string prepended to all URLs
username - a string containing a MusicBrainz user name
password - a string containing the user's password
realm - a string containing the realm used for authentication
opener - an urllib2.OpenerDirector object used for queries
Overrides:
__builtin__.object.__init__

get(self, entity, id_, include=(), filter={}, version='1')

Query the web service via HTTP-GET.

Returns a file-like object containing the result or raises a WebServiceError. Conditions leading to errors may be invalid entities, IDs, include or filter parameters and unsupported version numbers.
Raises:
ConnectionError - couldn't connect to server
RequestError - invalid IDs or parameters
AuthenticationError - invalid user name and/or password
ResourceNotFoundError - resource doesn't exist
Overrides:
musicbrainz2.webservice.IWebService.get

See Also: IWebService.get

post(self, entity, id_, data, version='1')

Send data to the web service via HTTP-POST.

Note that this may require authentication. You can set user name, password and realm in the constructor.
Raises:
ConnectionError - couldn't connect to server
RequestError - invalid IDs or parameters
AuthenticationError - invalid user name and/or password
ResourceNotFoundError - resource doesn't exist
Overrides:
musicbrainz2.webservice.IWebService.post

See Also: IWebService.post


Generated by Epydoc 2.1 on Sat Aug 26 18:34:32 2006 http://epydoc.sf.net