RCS

The main rcs.py module.

The starter module for RCS. Currently it contains most of the functional code for RCS and this should eventually end up in separate modules or packages.

class rcs.Doc[source]

Container class for all web requests for single documents

__module__ = 'rcs'
get(*args, **kwargs)[source]

A REST endpoint for fetching a single document from the doc store.

Parameters:
  • lang – A two letter language code for the response
  • smallkey (str) – A short key which uniquely identifies the dataset
Returns:

Response – a JSON response object; None with a 404 code if the key was not matched

methods = ['GET']
class rcs.DocV09[source]
__init__()[source]
__module__ = 'rcs'
endpoint = 'docv09'
mediatypes(resource_cls)
methods = ['GET']
class rcs.DocV1[source]
__init__()[source]
__module__ = 'rcs'
endpoint = 'docv1'
mediatypes(resource_cls)
methods = ['GET']
class rcs.Docs[source]

Container class for all web requests for sets of documents

__module__ = 'rcs'
get(*args, **kwargs)[source]

A REST endpoint for fetching a single document from the doc store.

Parameters:
  • lang (str) – A two letter language code for the response
  • smallkeylist (str) – A comma separated string of short keys each of which identifies a single dataset
Returns:

list – an array of JSON configuration fragments (empty error objects are added where keys do not match)

methods = ['GET']
class rcs.DocsV09[source]
__init__()[source]
__module__ = 'rcs'
endpoint = 'docsv09'
mediatypes(resource_cls)
methods = ['GET']
class rcs.DocsV1[source]
__init__()[source]
__module__ = 'rcs'
endpoint = 'docsv1'
mediatypes(resource_cls)
methods = ['GET']
class rcs.Register[source]

Container class for all catalog requests for registering new features

__module__ = 'rcs'
delete(*args, **kwargs)[source]

A REST endpoint for removing a layer.

Parameters:smallkey (str) – A unique identifier for the dataset
Returns:JSON Response – 204 on success; 500 on failure
endpoint = 'register'
mediatypes(resource_cls)
methods = ['DELETE', 'PUT']
put(*args, **kwargs)[source]

A REST endpoint for adding or editing a single layer. All registration requests must contain entries for all languages and will be validated against a JSON schema.

Parameters:smallkey (str) – A unique identifier for the dataset (can be any unique string, but preferably should be short)
Returns:JSON Response – 201 on success; 400 with JSON payload of an errors array on failure
class rcs.Simplification[source]

Handles updates to simplification factor of a feature layer

__module__ = 'rcs'
endpoint = 'simplification'
mediatypes(resource_cls)
methods = ['PUT']
put(*args, **kwargs)[source]

A REST endpoint for updating a simplification factor on a registered feature service.

Parameters:smallkey (str) – A unique identifier for the dataset (can be any unique string, but preferably should be short)
Returns:JSON Response – 200 on success; 400 with JSON payload of an errors array on failure
class rcs.Update[source]

Handles cache maintenance requests

__module__ = 'rcs'
endpoint = 'update'
mediatypes(resource_cls)
methods = ['POST']
post(*args, **kwargs)[source]

A REST endpoint for triggering cache updates. Walks through the database and updates cached data.

Parameters:arg – Either ‘all’ or a positive integer indicating the minimum

age in days of a record before it should be updated :type arg: str :returns: JSON Response – 200 on success; 400 on malformed URL

rcs.jsonp(func)[source]

A decorator function that wraps JSONified output for JSONP requests.

rcs.log_exception(sender, exception)[source]

Detailed error logging function. Designed to attach to Flask exception events and logs a bit of extra infomration about the request that triggered the exception.

Parameters:
  • sender – The sender for the exception (we don’t use this and log everyhing against app right now)
  • exception (Exception) – The exception that was triggered