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]¶ -
-
__module__
= 'rcs'¶
-
endpoint
= 'docv09'¶
-
mediatypes
(resource_cls)¶
-
methods
= ['GET']¶
-
-
class
rcs.
DocV1
[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]¶ -
-
__module__
= 'rcs'¶
-
endpoint
= 'docsv09'¶
-
mediatypes
(resource_cls)¶
-
methods
= ['GET']¶
-
-
class
rcs.
DocsV1
[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
-
-
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
-
rcs.
make_id
(key, lang)[source]¶ Generates an RCS ID in the form rcs.a82d987e.en
Parameters: - key (str) – The key to use for generating the unique id (keys are shared amongst different languages)
- lang (str) – The two letter language code for generating the unique id
Returns: str – an id that should be unique amongst all RCS ids