sondra.suite package

Module contents

class sondra.suite.Suite[source]

Bases: collections.abc.Mapping

This is the “environment” for Sondra. Similar to a settings.py file in Django, it defines the environment in which all :class:`Application`s exist.

The Suite is also a mapping type, and it should be used to access or enumerate all the Application objects that are registered.

always_allowed_formats

set – A set of formats where a

applications

dict – A mapping from application name to Application objects. Suite itself implements a mapping protocol and this is its backend.

base_url

str – The base URL for the API. The Suite will be mounted off of here.

base_url_scheme

str – http or https, automatically set.

base_url_netloc

str – automatically set hostname of the suite.

connection_config

dict – For each key in connections setup keyword args to be passed to rethinkdb.connect()

connections

dict – RethinkDB connections for each key in connection_config

docstring_processor_name

str – Any member of DOCSTRING_PROCESSORS: preformatted, rst, markdown, google, or numpy.

docstring_processor

callable – A lambda (str) that returns HTML for a docstring.

logging

dict – A dict-config for logging.

log

logging.Logger – A logger object configured with the above dictconfig.

cross_origin

bool=False – Allow cross origin API requests from the browser.

schema[source]

dict – The schema of a suite is a dict where the keys are the names of Application objects registered to the suite. The values are the schemas of the named app. See Application for more details on application schemas.

__getitem__(item)[source]

Application objects are indexed by “slug.” Every Application object registered has its name slugified.

This means that if your app was called MyCoolApp, its registered name would be my-cool-app. This key is used whether you are accessing the application via URL or locally via Python. For example, the following both produce the same result:

URL (yields schema as application/json):

    http://localhost:5000/api/my-cool-app;schema

Python (yields schema as a dict):

    suite = Suite()
    suite['my-cool-app'].schema
allow_anonymous_formats = {'help', 'schema'}
api_request_processors = ()
applications = None
base_url_netloc = 'localhost:5000'
base_url_path = '/api'
base_url_scheme = 'http'
clear_databases()[source]
connection_config = {'default': {}}
cross_origin = False
debug = False
definitions = {'pointCoordinates': {'minLength': 2, 'items': {'type': 'number'}, 'maxLength': 3, 'type': 'array'}, 'point': {'properties': {'coordinates': {'$ref': '#/definitions/pointCoordinates'}, 'type': {'enum': ['Point']}}, 'type': 'object'}, 'lineString': {'properties': {'coordinates': {'$ref': '#/definitions/lineStringCoordinates'}, 'type': {'enum': ['Point']}}, 'type': 'object'}, 'geojsonGeometry': {'oneOf': [{'$ref': '#/definitions/point'}, {'$ref': '#/definitions/lineString'}, {'$ref': '#/definitions/polygon'}], 'type': 'object'}, 'filterOps': {'enum': ['with_fields', 'count', 'max', 'min', 'avg', 'sample', 'sum', 'distinct', 'contains', 'pluck', 'without', 'has_fields', 'order_by', 'between']}, 'timedelta': {'required': ['start', 'end'], 'properties': {'hours': {'type': 'integer'}, 'minutes': {'type': 'integer'}, 'days': {'type': 'integer'}, 'seconds': {'type': 'number'}}, 'type': 'object'}, 'polygon': {'properties': {'coordinates': {'$ref': '#/definitions/polygonCoordinates'}, 'type': {'enum': ['Point']}}, 'type': 'object'}, 'geojsonFeatureCollection': {'properties': {'features': {'items': {'$ref': '#/definitions/geojsonFeature'}, 'type': 'array'}, 'type': {'enum': ['FeatureCollection']}}, 'type': 'object'}, 'spatialOps': {'enum': ['distance', 'get_intersecting', 'get_nearest']}, 'geojsonFeature': {'properties': {'geometry': {'$ref': '#/definitions/geojsonGeometry'}, 'properties': {'type': 'object'}, 'type': {'enum': ['Feature']}}, 'type': 'object'}, 'lineStringCoordinates': {'minLength': 2, 'items': {'items': {'$ref': '#/definitions/pointCoordinates'}, 'type': 'array'}, 'type': 'array'}, 'polygonCoordinates': {'minLength': 4, 'items': {'items': {'$ref': '#/definitions/lineStringCoordinates'}, 'type': 'array'}, 'type': 'array'}}
docstring_processor_name = 'preformatted'
drop_database_objects()[source]
ensure_database_objects()[source]
file_storage = 'sondra.files.storage.FileSystemStorage'
file_upload_directory_permissions = 493
file_upload_handlers = 'sondra.files.uploadhandler.MemoryFileUploadHandlersondra.files.uploadhandler.TemporaryFileUploadHandler'
file_upload_max_memory_size = 104857600
file_upload_permissions = 420
file_upload_temp_dir = None
full_schema[source]
help(out=None, initial_heading_level=0)[source]

Return full reStructuredText help for this class

logging = None
lookup(url)[source]
lookup_document(url)[source]
media_root = 'media'
media_url = '/media'
name = None
register_application(app)[source]

This is called automatically whenever an Application object is constructed.

schema[source]
schema_url[source]
slug = 'api'
title = 'Sondra-Based API'
url = 'http://localhost:5000/api'
working_directory = '/home/docs/checkouts/readthedocs.org/user_builds/sondra/checkouts/latest/docs'
exception sondra.suite.SuiteException[source]

Bases: builtins.Exception

Represents a misconfiguration in a Suite class

class sondra.suite.SuiteMetaclass(name, bases, attrs)[source]

Bases: abc.ABCMeta

sondra.suite.google_processor(s)[source]
sondra.suite.numpy_processor(s)[source]