atom.client
index
/usr/lib/python2.7/dist-packages/atom/client.py

AtomPubClient provides CRUD ops. in line with the Atom Publishing Protocol.

 
Modules
       
atom

 
Classes
       
__builtin__.object
AtomPubClient
CustomHeaders
exceptions.Exception(exceptions.BaseException)
Error
MissingHost

 
class AtomPubClient(__builtin__.object)
     Methods defined here:
Delete = delete(self, uri=None, auth_token=None, http_request=None, **kwargs)
Get = get(self, uri=None, auth_token=None, http_request=None, **kwargs)
ModifyRequest = modify_request(self, http_request)
Post = post(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
Put = put(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
Request = request(self, method=None, uri=None, auth_token=None, http_request=None, **kwargs)
__init__(self, http_client=None, host=None, auth_token=None, source=None, xoauth_requestor_id=None, **kwargs)
Creates a new AtomPubClient instance.
 
Args:
  source: The name of your application.
  http_client: An object capable of performing HTTP requests through a
               request method. This object is used to perform the request
               when the AtomPubClient's request method is called. Used to
               allow HTTP requests to be directed to a mock server, or use
               an alternate library instead of the default of httplib to
               make HTTP requests.
  host: str The default host name to use if a host is not specified in the
        requested URI.
  auth_token: An object which sets the HTTP Authorization header when its
              modify_request method is called.
delete(self, uri=None, auth_token=None, http_request=None, **kwargs)
Performs a request using the DELETE method, returns an HTTP response.
get(self, uri=None, auth_token=None, http_request=None, **kwargs)
Performs a request using the GET method, returns an HTTP response.
modify_request(self, http_request)
Changes the HTTP request before sending it to the server.
 
Sets the User-Agent HTTP header and fills in the HTTP host portion
of the URL if one was not included in the request (for this it uses
the self.host member if one is set). This method is called in
self.request.
 
Args:
  http_request: An atom.http_core.HttpRequest() (optional) If one is
                not provided, a new HttpRequest is instantiated.
 
Returns:
  An atom.http_core.HttpRequest() with the User-Agent header set and
  if this client has a value in its host member, the host in the request
  URL is set.
post(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
Sends data using the POST method, returns an HTTP response.
put(self, uri=None, data=None, auth_token=None, http_request=None, **kwargs)
Sends data using the PUT method, returns an HTTP response.
request(self, method=None, uri=None, auth_token=None, http_request=None, **kwargs)
Performs an HTTP request to the server indicated.
 
Uses the http_client instance to make the request.
 
Args:
  method: The HTTP method as a string, usually one of 'GET', 'POST',
          'PUT', or 'DELETE'
  uri: The URI desired as a string or atom.http_core.Uri.
  http_request:
  auth_token: An authorization token object whose modify_request method
              sets the HTTP Authorization header.
 
Returns:
  The results of calling self.http_client.request. With the default
  http_client, this is an HTTP response object.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
auth_token = None
host = None
ssl = False
xoauth_requestor_id = None

 
class CustomHeaders(__builtin__.object)
    Add custom headers to an http_request.
 
Usage:
  >>> custom_headers = atom.client.CustomHeaders(header1='value1',
          header2='value2')
  >>> client.get(uri, custom_headers=custom_headers)
 
  Methods defined here:
__init__(self, **kwargs)
Creates a CustomHeaders instance.
 
Initialize the headers dictionary with the arguments list.
modify_request(self, http_request)
Changes the HTTP request before sending it to the server.
 
Adds the custom headers to the HTTP request.
 
Args:
  http_request: An atom.http_core.HttpRequest().
 
Returns:
  An atom.http_core.HttpRequest() with the added custom headers.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Error(exceptions.Exception)
    
Method resolution order:
Error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class MissingHost(Error)
    
Method resolution order:
MissingHost
Error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors inherited from Error:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Data
        __author__ = 'j.s@google.com (Jeff Scudder)'

 
Author
        j.s@google.com (Jeff Scudder)