| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
abstract_adapter.AbstractAdapter --+
|
RestfulHttpAdapter
Adapter for communicating with REST web services over HTTP
Required configuration keywords:
github.com or 192.0.0.1
The service will depend on what services the host server has
available, but it is typically the lowercase, plural version of your
model's class name. So if you have a model named Duck,
your service name will typically be ducks.
Optional configuration keywords:
'xml' or 'csv'. Default is
'json'
model.pk_attr()
For example, if you have a model m = Model({'id': 4, 'name':
'foo'}) with params_wrapper='mod', the data
encoded for the HTTP request will include
mod[id]=4&mod[name]=foo
These parameters will not be wrapped in the
params_wrapper if that option is also present. One thing
default_params are useful for is including an api key
with every request.
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Class Variables | |
|
Inherited from |
| Properties | |
|
Inherited from Inherited from |
| Method Details |
Performs an HTTP GET request and uses the relation dict to construct the query string parameters
|
Write object's attributes to the datastore
|
Delete the object from the datastore
|
Encodes the relation and any query modifiers into a query string suitable for use in a URL. Includes the '?' as part of the query string and returns None if there are no parameters. |
Returns the value of the configuration option named by option. If the option is not configured, this method will use the default value if given. Otherwise a ConfigurationError will be thrown. |
Recursively flattens nested dicts into a list of (key, value) tuples so they can be encoded as a query string that can be understood by our webservices. In particular, our webservices require nested dicts to be transformed to a format where the nesting is indiciated by a key naming syntax where there are no nested dicts. Instead, the nested dicts are 'flattened' by using a key naming syntax where the nested keys are enclosed in brackets and preceded by the non-nested key. The best way to understand this format is by example: Example input:
{
'key': 'value',
'foo': {
'list': [1, 2, 3],
'bar': {
'double-nested': 'value'
}
}
}
Example output:
[
('key', 'value'),
('foo[list][]', 1), ('foo[list][]', 2), ('foo[list][]', 3),
('foo[bar][double-nested]', 'value')
]
When calling the urlencode on the result of this method, you will generate a query string similar to the following. The order of the parameters may vary except that successive array elements will also be successive in the query string: 'key=value&foo[list][]=1&foo[list][]=2&foo[list][]=3&foo[bar][double-nested]=value' |
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Jun 30 17:41:50 2011 | http://epydoc.sourceforge.net |