atom.http | index /build/buildd/python-gdata-2.0.18+dfsg/src/atom/http.py

`HttpClients in this module use httplib to make HTTP requests.
This module make HTTP requests based on httplib, but there are environments
in which an httplib based approach will not work (if running in Google App
Engine for example). In those cases, higher level classes (like AtomService
and GDataService) can swap out the HttpClient to transparently use a
different mechanism for making HTTP requests.
HttpClient: Contains a request method which performs an HTTP call to the
server.
ProxiedHttpClient: Contains a request method which connects to a proxy using
settings stored in operating system environment variables then
performs an HTTP call to the endpoint server.`

Modules

``

atom base64 | httplib os | socket ssl | types

Classes

``

atom.http_interface.Error(exceptions.Exception)
  ProxyError
atom.http_interface.GenericHttpClient(__builtin__.object)
  HttpClient
    ProxiedHttpClient
exceptions.Exception(exceptions.BaseException)
  TestConfigurationError

class HttpClient(atom.http_interface.GenericHttpClient)

``

Method resolution order:
  HttpClient
  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.`

Data and other attributes defined here:

v2_http_client = None

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 ProxiedHttpClient(HttpClient)

``

`Performs an HTTP request through a proxy.
The proxy settings are obtained from enviroment variables. The URL of the
proxy server is assumed to be stored in the environment variables
'https_proxy' and 'http_proxy' respectively. If the proxy server requires
a Basic Auth authorization header, the username and password are expected to
be in the 'proxy-username' or 'proxy_username' variable and the
'proxy-password' or 'proxy_password' variable, or in 'http_proxy' or
'https_proxy' as "protocol://[username:password@]host:port".
After connecting to the proxy server, the request is completed as in
HttpClient.request.
`

Method resolution order:
  ProxiedHttpClient
  HttpClient
  atom.http_interface.GenericHttpClient
  __builtin__.object

Methods inherited from HttpClient:

__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.`

Data and other attributes inherited from HttpClient:

v2_http_client = None

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 ProxyError(atom.http_interface.Error)

``

Method resolution order:
  ProxyError
  atom.http_interface.Error
  exceptions.Exception
  exceptions.BaseException
  __builtin__.object

Data descriptors inherited from atom.http_interface.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 TestConfigurationError(exceptions.Exception)

``

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

Data
`` |  | DEFAULT_CONTENT_TYPE = 'application/atom+xml' __author__ = 'api.jscudder (Jeff Scudder)' ssl_imported = True

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