Local Sessions

Sometimes, you might want to access your site's API without going through the HTTP interface via api_api. This might be because you want API access when it is unavailable through HTTP (your site is starting up or shutting down), for efficiency reasons, or you want to have a shared codebase for external users and within your site's servers. The SVNPlace process runner uses local sessions for all these reasons.

Class LocalSession

This class constructs a local API session. It can almost be used anywhere a normal api_api API session is used. The key difference is models are actual model.Models - string references to them (IDs or urns) won't work.

from api import LocalSession
from api_api import API

localsession = LocalSession(key, secret)
remotesession = API('https://mysite.com/api')(key, secret)

Constructor

LocalSession(role)
Construct a local API session with this role.
LocalSession(key, secret)
A local API session using the key and secret to define the role.