gdata.urlfetch | index /usr/local/svn/gdata-python-client/src/gdata/urlfetch.py

`Provides HTTP functions for gdata.service to use on Google App Engine
AppEngineHttpClient: Provides an HTTP request method which uses App Engine's
urlfetch API. Set the http_client member of a GDataService object to an
instance of an AppEngineHttpClient to allow the gdata library to run on
Google App Engine.
run_on_appengine: Function which will modify an existing GDataService object
to allow it to run on App Engine. It works by creating a new instance of
the AppEngineHttpClient and replacing the GDataService object's
http_client.
HttpRequest: Function that wraps google.appengine.api.urlfetch.Fetch in a
common interface which is used by gdata.service.GDataService. In other
words, this module can be used as the gdata service request handler so
that all HTTP requests will be performed by the hosting Google App Engine
server.`

Modules

``

StringIO | atom | google.appengine.api.urlfetch |

Classes

``

__builtin__.object
  HttpResponse
atom.http_interface.GenericHttpClient(__builtin__.object)
  AppEngineHttpClient

class AppEngineHttpClient(atom.http_interface.GenericHttpClient)

``

Method resolution order:
  AppEngineHttpClient
  atom.http_interface.GenericHttpClient
  __builtin__.object

Methods defined here:

__init__(self, headers=None)

request(self, operation, url, data=None, headers=None)
  `Performs an HTTP call to the server, supports GET, POST, PUT, and
  DELETE.
  Usage example, perform and HTTP GET on http://www.google.com/:
  import atom.http
  client = atom.http.HttpClient()
  http_response = client.request('GET', 'http://www.google.com/')
  Args:
  operation: str The HTTP operation to be performed. This is usually one
  of 'GET', 'POST', 'PUT', or 'DELETE'
  data: filestream, list of parts, or other object which can be converted
  to a string. Should be set to None when performing a GET or DELETE.
  If data is a file-like object which can be read, this method will
  read a chunk of 100K bytes at a time and send them.
  If the data is a list of parts to be sent, each part will be
  evaluated and sent.
  url: The full URL to which the request should be sent. Can be a string
  or atom.url.Url.
  headers: dict of strings. HTTP headers which should be sent
  in the request.`

Methods inherited from atom.http_interface.GenericHttpClient:

delete(self, url, headers=None)

get(self, url, headers=None)

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

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

Data descriptors inherited from atom.http_interface.GenericHttpClient:

__dict__
  `dictionary for instance variables (if defined)`

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

Data and other attributes inherited from atom.http_interface.GenericHttpClient:

debug = False

class HttpResponse(__builtin__.object)
`` | `Translates a urlfetch resoinse to look like an hhtplib resoinse. Used to allow the resoinse from HttpRequest to be usable by gdata.service methods.`

Methods defined here:

__init__(self, urlfetch_response)

getheader(self, name)

read(self, length=None)

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

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

Functions

``

HttpRequest(service, operation, data, uri, extra_headers=None, url_params=None, escape_params=True, content_type='application/atom+xml')
  `Performs an HTTP call to the server, supports GET, POST, PUT, and DELETE.
  This function is deprecated, use AppEngineHttpClient.request instead.
  To use this module with gdata.service, you can set this module to be the
  http_request_handler so that HTTP requests use Google App Engine's urlfetch.
  import gdata.service
  import gdata.urlfetch
  gdata.service.http_request_handler = gdata.urlfetch
  Args:
  service: atom.AtomService object which contains some of the parameters
  needed to make the request. The following members are used to
  construct the HTTP call: server (str), additional_headers (dict),
  port (int), and ssl (bool).
  operation: str The HTTP operation to be performed. This is usually one of
  'GET', 'POST', 'PUT', or 'DELETE'
  data: filestream, list of parts, or other object which can be
  converted to a string.
  Should be set to None when performing a GET or PUT.
  If data is a file-like object which can be read, this method will read
  a chunk of 100K bytes at a time and send them.
  If the data is a list of parts to be sent, each part will be evaluated
  and sent.
  uri: The beginning of the URL to which the request should be sent.
  Examples: '/', '/base/feeds/snippets',
  '/m8/feeds/contacts/default/base'
  extra_headers: dict of strings. HTTP headers which should be sent
  in the request. These headers are in addition to those stored in
  service.additional_headers.
  url_params: dict of strings. Key value pairs to be added to the URL as
  URL parameters. For example {'foo':'bar', 'test':'param'} will
  become ?foo=bar&test=param.
  escape_params: bool default True. If true, the keys and values in
  url_params will be URL escaped when the form is constructed
  (Special characters converted to %XX form.)
  content_type: str The MIME type for the data being sent. Defaults to
  'application/atom+xml', this is only used if data is set.`

run_on_appengine(gdata_service)
  `Modifies a GDataService object to allow it to run on App Engine.
  Args:
  gdata_service: An instance of AtomService, GDataService, or any
  of their subclasses which has an http_client member.`

Data
`` |  | __author__ = 'api.jscudder (Jeff Scudder)'

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