contrib Package

console Module

restkit.contrib.console.as_bool(value)
restkit.contrib.console.external(cmd, data)
restkit.contrib.console.indent(mimetype, data)
restkit.contrib.console.indent_json(data)
restkit.contrib.console.indent_xml(data)
restkit.contrib.console.main()

function to manage restkit command line

restkit.contrib.console.options()

build command lines options

restkit.contrib.console.prettify(response, cli=True)
restkit.contrib.console.update_defaults(defaults)

ipython_shell Module

class restkit.contrib.ipython_shell.ContentTypes

Bases: object

class restkit.contrib.ipython_shell.JSON(value)

Bases: restkit.contrib.ipython_shell.Stream

class restkit.contrib.ipython_shell.Request(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw)

Bases: restkit.contrib.webob_api.Request

ResponseClass

alias of Response

get_response(*args, **kwargs)
class restkit.contrib.ipython_shell.Response(body=None, status=None, headerlist=None, app_iter=None, content_type=None, conditional_response=None, **kw)

Bases: webob.response.Response

class restkit.contrib.ipython_shell.RestShell(user_ns={})

Bases: IPython.terminal.embed.InteractiveShellEmbed

class restkit.contrib.ipython_shell.ShellClient(url='/', options=None, **kwargs)

Bases: object

help()
methods = {'put': '[req|url|path_info], stream', 'head': '[req|url|path_info], **query_string', 'delete': '[req|url|path_info]', 'post': '[req|url|path_info], [Stream()|**query_string_body]', 'get': '[req|url|path_info], **query_string'}
request(meth, *args, **kwargs)

forward to restkit.request

request_meth(k)
update_ns(ns)
class restkit.contrib.ipython_shell.Stream(buf='')

Bases: StringIO.StringIO

restkit.contrib.ipython_shell.main(*args, **kwargs)

webob_api Module

Subclasses of webob.Request who use restkit to get a webob.Response via restkit.ext.wsgi_proxy.Proxy.

Example:

>>> req = Request.blank('http://pypi.python.org/pypi/restkit')
>>> resp = req.get_response()
>>> print resp 
200 OK
Date: ...
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Server: Apache/2...

<?xml version="1.0" encoding="UTF-8"?>
...
class restkit.contrib.webob_api.Method(name)

Bases: property

class restkit.contrib.webob_api.Request(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw)

Bases: webob.request.Request

delete
get
get_response()
head
post
put
set_url(url)

webob_helper Module

exception restkit.contrib.webob_helper.WebobResourceError(msg=None, http_code=None, response=None)

Bases: webob.exc.WSGIHTTPException

Wrapper to return webob exceptions instead of restkit errors. Usefull for those who want to build WSGI applications speaking directly to others via HTTP.

To do it place somewhere in your application the function wrap_exceptions:

wrap_exceptions()

It will automatically replace restkit errors by webob exceptions.

message
status_int

The status as an integer

restkit.contrib.webob_helper.wrap_exceptions()

wrap restkit exception to return WebBob exceptions

wsgi_proxy Module

class restkit.contrib.wsgi_proxy.HostProxy(uri, **kwargs)

Bases: restkit.contrib.wsgi_proxy.Proxy

A proxy to redirect all request to a specific uri

extract_uri(environ)
class restkit.contrib.wsgi_proxy.Proxy(manager=None, allowed_methods=['GET', 'HEAD', 'POST', 'PUT', 'DELETE'], strip_script_name=True, **kwargs)

Bases: object

A proxy wich redirect the request to SERVER_NAME:SERVER_PORT and send HTTP_HOST header

extract_uri(environ)
class restkit.contrib.wsgi_proxy.TransparentProxy(manager=None, allowed_methods=['GET', 'HEAD', 'POST', 'PUT', 'DELETE'], strip_script_name=True, **kwargs)

Bases: restkit.contrib.wsgi_proxy.Proxy

A proxy based on HTTP_HOST environ variable

extract_uri(environ)
restkit.contrib.wsgi_proxy.get_config(local_config)

parse paste config

restkit.contrib.wsgi_proxy.make_host_proxy(global_config, uri=None, **local_config)

HostProxy entry_point

restkit.contrib.wsgi_proxy.make_proxy(global_config, **local_config)

TransparentProxy entry_point