atom.http_interface | index /usr/local/google/home/afshar/src/external-gdata-release/google3/src/atom/http_interface.py

`This module provides a common interface for all HTTP requests.
HttpResponse: Represents the server's response to an HTTP request. Provides
an interface identical to httplib.HTTPResponse which is the response
expected from higher level classes which use HttpClient.request.
GenericHttpClient: Provides an interface (superclass) for an object
responsible for making HTTP requests. Subclasses of this object are
used in AtomService and GDataService to make requests to the server. By
changing the http_client member object, the AtomService is able to make
HTTP requests using different logic (for example, when running on
Google App Engine, the http_client makes requests using the App Engine
urlfetch API).`

Modules

``

StringIO |  |  |

Classes

``

__builtin__.object
  GenericHttpClient
  GenericToken
  HttpResponse
exceptions.Exception(exceptions.BaseException)
  Error
    ContentLengthRequired
    UnparsableUrlObject

class ContentLengthRequired(Error)

``

Method resolution order:
  ContentLengthRequired
  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

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 GenericHttpClient(__builtin__.object)

``

Methods defined here:

__init__(self, http_client, headers=None)
  `Args:
  http_client: An object which provides a request method to make an HTTP
  request. The request method in GenericHttpClient performs a
  call-through to the contained HTTP client object.
  headers: A dictionary containing HTTP headers which should be included
  in every HTTP request. Common persistent headers include
  'User-Agent'.`

delete(self, url, headers=None)

get(self, url, headers=None)

post(self, url, data, headers=None)

put(self, url, data, headers=None)

request(self, operation, url, data=None, headers=None)

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:

debug = False

class GenericToken(__builtin__.object)
`` | `Represents an Authorization token to be added to HTTP requests. Some Authorization headers included calculated fields (digital signatures for example) which are based on the parameters of the HTTP request. Therefore the token is responsible for signing the request and adding the Authorization header.`

Methods defined here:

perform_request(self, http_client, operation, url, data=None, headers=None)
  `For the GenericToken, no Authorization token is set.`

valid_for_scope(self, url)
  `Tells the caller if the token authorizes access to the desired URL.
  Since the generic token doesn't add an auth header, it is not valid for
  any scope.`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class HttpResponse(__builtin__.object)

``

Methods defined here:

__init__(self, body=None, status=None, reason=None, headers=None)
  `Constructor for an HttpResponse object.
  HttpResponse represents the server's response to an HTTP request from
  the client. The HttpClient.request method returns a httplib.HTTPResponse
  object and this HttpResponse class is designed to mirror the interface
  exposed by httplib.HTTPResponse.
  Args:
  body: A file like object, with a read() method. The body could also
  be a string, and the constructor will wrap it so that
  HttpResponse.read(self) will return the full string.
  status: The HTTP status code as an int. Example: 200, 201, 404.
  reason: The HTTP status message which follows the code. Example:
  OK, Created, Not Found
  headers: A dictionary containing the HTTP headers in the server's
  response. A common header in the response is Content-Length.`

getheader(self, name, default=None)

read(self, amt=None)

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class UnparsableUrlObject(Error)

``

Method resolution order:
  UnparsableUrlObject
  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
`` |  | USER_AGENT = '%s GData-Python/2.0.18' __author__ = 'api.jscudder (Jeff Scudder)'

Author
`` |  | api.jscudder (Jeff Scudder)