Package restkit :: Module resource :: Class Resource
[hide private]

Class Resource

source code

object --+
         |
        Resource

A class that can be instantiated for access to a RESTful resource, including authentication.

Nested Classes [hide private]
  response_class
Instance Methods [hide private]
 
__init__(self, uri, **client_opts)
Constructor for a `Resource` object.
source code
 
__repr__(self)
repr(x)
source code
 
clone(self)
if you want to add a path to resource uri, you can do:
source code
 
__call__(self, path)
if you want to add a path to resource uri, you can do:
source code
 
get(self, path=None, headers=None, params_dict=None, **params)
HTTP GET
source code
 
head(self, path=None, headers=None, params_dict=None, **params)
HTTP HEAD
source code
 
delete(self, path=None, headers=None, params_dict=None, **params)
HTTP DELETE
source code
 
post(self, path=None, payload=None, headers=None, params_dict=None, **params)
HTTP POST
source code
 
put(self, path=None, payload=None, headers=None, params_dict=None, **params)
HTTP PUT
source code
 
make_params(self, params) source code
 
make_headers(self, headers) source code
 
unauthorized(self, response) source code
 
request(self, method, path=None, payload=None, headers=None, params_dict=None, **params)
HTTP request
source code
 
update_uri(self, path)
to set a new uri absolute path
source code

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

Class Variables [hide private]
  charset = 'utf-8'
  encode_keys = True
  safe = '/:'
  basic_auth_url = True
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, uri, **client_opts)
(Constructor)

source code 

Constructor for a `Resource` object.

Resource represent an HTTP resource.

:param uri: str, full uri to the server. :param client_opts: `restkit.client.Client` Options

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

clone(self)

source code 
if you want to add a path to resource uri, you can do:

.. code-block:: python

    resr2 = res.clone()

__call__(self, path)
(Call operator)

source code 
if you want to add a path to resource uri, you can do:

.. code-block:: python

    Resource("/path").get()

get(self, path=None, headers=None, params_dict=None, **params)

source code 
HTTP GET         

:param path: string  additionnal path to the uri
:param headers: dict, optionnal headers that will
    be added to HTTP request.
:param params: Optionnal parameterss added to the request.

head(self, path=None, headers=None, params_dict=None, **params)

source code 

HTTP HEAD

see GET for params description.

delete(self, path=None, headers=None, params_dict=None, **params)

source code 

HTTP DELETE

see GET for params description.

post(self, path=None, payload=None, headers=None, params_dict=None, **params)

source code 
HTTP POST

:param payload: string passed to the body of the request
:param path: string  additionnal path to the uri
:param headers: dict, optionnal headers that will
    be added to HTTP request.
:param params: Optionnal parameterss added to the request

put(self, path=None, payload=None, headers=None, params_dict=None, **params)

source code 

HTTP PUT

see POST for params description.

request(self, method, path=None, payload=None, headers=None, params_dict=None, **params)

source code 
HTTP request

This method may be the only one you want to override when
subclassing `restkit.rest.Resource`.

:param payload: string or File object passed to the body of the request
:param path: string  additionnal path to the uri
:param headers: dict, optionnal headers that will
    be added to HTTP request.
:params_dict: Options parameters added to the request as a dict
:param params: Optionnal parameterss added to the request