client
Module¶
-
class
restkit.client.
Client
(follow_redirect=False, force_follow_redirect=False, max_follow_redirect=5, filters=None, decompress=True, max_status_line_garbage=None, max_header_count=0, pool=None, response_class=None, timeout=None, use_proxy=False, max_tries=3, wait_tries=0.3, pool_size=10, backend='thread', **ssl_args)¶ Bases:
object
A client handle a connection at a time. A client is threadsafe, but an handled shouldn’t be shared between threads. All connections are shared between threads via a pool.
>>> from restkit import * >>> c = Client() >>> r = c.request("http://google.com") >>> r.status '301 Moved Permanently' >>> r.body_string() '<HTML><HEAD><meta http-equiv="content-type [...]' >>> c.follow_redirect = True >>> r = c.request("http://google.com") >>> r.status '200 OK'
-
get_connection
(request)¶ get a connection from the pool or create new one.
-
get_response
(request, connection)¶ return final respons, it is only accessible via peform method
-
load_filters
()¶ Populate filters from self.filters. Must be called each time self.filters is updated.
-
make_headers_string
(request, extra_headers=None)¶ create final header string
-
perform
(request)¶ perform the request. If an error happen it will first try to restart it
-
proxy_connection
(request, req_addr, is_ssl)¶ do the proxy connection
-
redirect
(location, request)¶ reset request, set new url of request and perform it
-
request
(url, method='GET', body=None, headers=None)¶ perform immediatly a new request
-
response_class
¶ alias of
Response
-
version
= (1, 1)¶
-