API

Client

Python

class simpleapi.client.Client(ns, access_key=None, version='default', transport_type='json', wrapper_type='default', timeout=None)

simpleapi’s client library.

Parameters:
  • ns – URL of your Route‘s endpoint
  • access_key – string key used for authentication
  • version – Namespace version to be used (default is highest)
  • transport_type – encoding/decoding type for request/response (default is json)
  • wrapper_type – wrapper used for formatting the response
  • timeout – connection timeout in secs (default is system parameter)
set_ns(ns)

changes the URL for the Route’s endpoint

set_version(version)

uses a different version for further requests

Server

Route

class simpleapi.server.route.Route

Namespace

class simpleapi.server.namespace.Namespace(request)
error(*errors)
introspect(framework='default', provider='Ext.app', namespace=None)
exception simpleapi.server.namespace.NamespaceException(msg=None)

Features

class simpleapi.server.feature.Feature(ns_config)
error(errmsg)
get_config(request)
get_config_scope(request)
handle_request(request)
handle_response(response)
has_config()
is_triggered(request)
setup()
exception simpleapi.server.feature.FeatureException(msg=None)
exception simpleapi.server.feature.FeatureContentResponse(msg=None)

Request

class simpleapi.server.request.Request(sapi_request, namespace, input_formatter, output_formatter, wrapper, callback, mimetype, restful, debug, route, ignore_unused_args)
process_request(request_items)
exception simpleapi.server.request.RequestException(msg=None)

Response

class simpleapi.server.response.Response(sapi_request, namespace=None, output_formatter=None, wrapper=None, errors=None, result=None, mimetype=None, callback=None, function=None)
add_error(errmsg)
build(skip_features=False, managed=False)
has_errors()
class simpleapi.server.response.ResponseMerger(sapi_request, responses)
build()
class simpleapi.server.response.ResponseException
class simpleapi.server.response.UnformattedResponse(content, mimetype='text/html')

Session

class simpleapi.server.session.Session
clear()

Utils

class simpleapi.server.utils.glob_list

A list which is Unix shell-style wildcards searchable

Message

Formatter

class simpleapi.message.formatter.FormattersSingleton

This singleton takes care of all registered formatters. You can easily register your own formatter for use in both the Namespace and python client.

register(name, formatter, override=False)

Register the given formatter. If there’s already an formatter with the given name, you can override by setting override to True.

class simpleapi.message.formatter.Formatter(sapi_request, callback)

Baseclass for Formatter-implementations

build(value)

Takes care of the building process and returns the encoded data.

kwargs(value, action='build')

Is called within simpleapi. This method invokes both the parse and build function when needed.

parse(value)

Takes care of the parsing proccess and returns the decoded data.

class simpleapi.message.formatter.JSONFormatter(sapi_request, callback)

Formatter for the JSON-format. Used by default by the python client and by many Javascript-Frameworks.

class simpleapi.message.formatter.JSONPFormatter(sapi_request, callback)

Formatter for JSONP-format. Used for cross-domain requests. If callback isn’t provided, simpleapiCallback is used.

class simpleapi.message.formatter.ValueFormatter(sapi_request, callback)

Basic formatter for simple, fast and tiny transports (it has a lot of limitations, though).

class simpleapi.message.formatter.PickleFormatter(sapi_request, callback)

Formatter for use the cPickle python module which supports python object serialization. It has the fewest limitations (ie. it can also serialize datetime objects), but is a security risk and should only be used in a trusted environment. It’s strongly recommended that you use authentication mechanismen to protect your namespace. The formatter is not activated by default and can be enabled by putting ‘pickle’ into Namespace’s __input__ and __output__ configuration.

Wrapper

class simpleapi.message.wrapper.WrappersSingleton

This singleton takes care of all registered wrappers. You can easily register your own wrapper for use in both the Namespace and python client.

register(name, wrapper, override=False)

Register the given wrapper

class simpleapi.message.wrapper.Wrapper(sapi_request)

The baseclass wrapper you can use as a basis for your own wrapper

class simpleapi.message.wrapper.DefaultWrapper(sapi_request)
class simpleapi.message.wrapper.ExtJSFormWrapper(sapi_request)

Table Of Contents

Previous topic

Limitations and work-arounds

Next topic

Request objects

This Page