Package restkit :: Package client :: Module request :: Class HttpRequest
[hide private]
[frames] | no frames]

Class HttpRequest

source code

object --+
         |
        HttpRequest

Http Connection object.

Nested Classes [hide private]
  response_class
Http Response object returned by HttpConnction
Instance Methods [hide private]
 
__init__(self, timeout=sock._GLOBAL_DEFAULT_TIMEOUT, filters=None, follow_redirect=False, force_follow_redirect=False, max_follow_redirect=5, pool_instance=None, response_class=None, **ssl_args)
HttpRequest constructor
source code
 
make_connection(self)
initate a connection if needed or reuse a socket
source code
 
clean_connections(self) source code
 
release_connection(self, address, socket) source code
 
parse_url(self, url)
parse url and get host/port
source code
 
set_body(self, body, headers, chunked=False)
set HTTP body and manage form if needed
source code
 
request(self, url, method='GET', body=None, headers=None)
make effective request
source code
 
_req_headers(self) source code
 
do_send(self) source code
 
do_redirect(self, response, location)
follow redirections if needed
source code
 
start_response(self)
Get headers, set Body object and return HttpResponse
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  version = (1, 1)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, timeout=sock._GLOBAL_DEFAULT_TIMEOUT, filters=None, follow_redirect=False, force_follow_redirect=False, max_follow_redirect=5, pool_instance=None, response_class=None, **ssl_args)
(Constructor)

source code 

HttpRequest constructor

:param timeout: socket timeout :param filters: list, list of http filters. see the doc of http filters for more info :param follow_redirect: boolean, by default is false. If true, if the HTTP status is 301, 302 or 303 the client will follow the location. :param max_follow_redirect: max number of redirection. If max is reached the RedirectLimit exception is raised. :param pool_instance: a pool instance inherited from `restkit.pool.PoolInterface` :param ssl_args: ssl arguments. See http://docs.python.org/library/ssl.html for more information.

Overrides: object.__init__

request(self, url, method='GET', body=None, headers=None)

source code 

make effective request

:param url: str, url string :param method: str, by default GET. http verbs :param body: the body, could be a string, an iterator or a file-like object :param headers: dict or list of tupple, http headers