CapiTainS Nautilus API Documentation¶
Resolvers¶
Resolver provides a system to retrieve a text file and an inventory from local resources for example.
CapiTainS formatted repository¶
-
class
capitains_nautilus.cts.resolver.NautilusCTSResolver(resource, name=None, logger=None, cache=None, dispatcher=None)[source]¶ XML Folder Based resolver.
Parameters: - resource ([str]) – Resource should be a list of folders retaining data as Capitains Guidelines Repositories
- name – Key used to make cache key
- cache (BaseCache) – Cache object to be used for the inventory
- logger (logging.logger) – Logging object
Variables: - inventory_cache_key – Werkzeug Cache key to get or set cache for the TextInventory
- texts_cache_key – Werkzeug Cache key to get or set cache for lists of metadata texts objects
- texts_parsed – Werkzeug Cache key to get or set cache for lists of parsed texts objects
- texts – List of Text Metadata objects
- source – Original resource parameter
Warning
This resolver does not support inventories
Errors¶
-
exception
capitains_nautilus.errors.CTSError[source]¶ Bases:
capitains_nautilus.errors.NautilusError-
CODE= None¶
-
-
exception
capitains_nautilus.errors.InvalidContext[source]¶ Bases:
capitains_nautilus.errors.CTSErrorInvalid value for context parameter in GetPassage or GetPassagePlus request
-
CODE= 5¶
-
-
exception
capitains_nautilus.errors.InvalidLevel[source]¶ Bases:
capitains_nautilus.errors.CTSErrorInvalid value for level parameter in GetValidReff request
-
CODE= 4¶
-
-
exception
capitains_nautilus.errors.InvalidURN[source]¶ Bases:
capitains_nautilus.errors.CTSError,MyCapytain.errors.InvalidURNSyntactically valid URN refers in invalid value
-
CODE= 3¶
-
-
exception
capitains_nautilus.errors.InvalidURNSyntax[source]¶ Bases:
capitains_nautilus.errors.CTSErrorInvalid URN syntax
-
CODE= 2¶
-
-
exception
capitains_nautilus.errors.MissingParameter[source]¶ Bases:
capitains_nautilus.errors.CTSErrorRequest missing one or more required parameters
-
CODE= 1¶
-
-
exception
capitains_nautilus.errors.NautilusError[source]¶ Bases:
BaseExceptionAn error has occurence
-
CODE= None¶
-
-
exception
capitains_nautilus.errors.UndispatchedTextError[source]¶ Bases:
capitains_nautilus.errors.CTSError,MyCapytain.errors.UndispatchedTextErrorA Text has not been dispatched
-
CODE= 7¶
-
-
exception
capitains_nautilus.errors.UnknownCollection[source]¶ Bases:
MyCapytain.errors.UnknownCollection,capitains_nautilus.errors.CTSErrorResource requested is not found
-
CODE= 6¶
-
Flask Extension¶
-
class
capitains_nautilus.flask_ext.FlaskNautilus(prefix='', app=None, name=None, resolver=None, flask_caching=None, access_Control_Allow_Origin=None, access_Control_Allow_Methods=None, logger=None)[source]¶ Bases:
objectHTTP API Interfaces for MyCapytains resolvers
Parameters: - prefix – Prefix on which to install the extension
- app – Application on which to register
- name – Name to use for the blueprint
- resolver (Resolver) – Resolver
- flask_caching (Cache) – HTTP Cache should be a FlaskCaching Cache object
- logger (logging.Logger) – Logging handler.
Variables: - access_Control_Allow_Methods – Dictionary with route name and allowed methods over CORS
- access_Control_Allow_Origin – Dictionary with route name and allowed host over CORS or “*”
- ROUTES – List of triple length tuples
- Access_Control_Allow_Methods – Dictionary with route name and allowed methods over CORS
- Access_Control_Allow_Origin – Dictionary with route name and allowed host over CORS or “*”
- LoggingHandler – Logging handler to be set for the blueprint
- logger – Logging handler
- resolver – CapiTainS resolver
-
Access_Control_Allow_Methods= {'r_cts': 'OPTIONS, GET', 'r_dts_collection': 'OPTIONS, GET', 'r_dts_collections': 'OPTIONS, GET'}¶
-
Access_Control_Allow_Origin= '*'¶
-
CACHED= ['_r_GetCapabilities', '_r_GetPassage', '_r_GetPassagePlus', '_r_GetValidReff', '_r_GetPrevNext', '_r_GetFirstUrn', '_r_GetLabel', 'cts_error', 'r_dts_collections', 'r_dts_collection', 'dts_error']¶
-
LoggingHandler¶ alias of
logging.StreamHandler
-
ROUTES= [('/cts', 'r_cts', ['GET']), ('/dts/collections', 'r_dts_collection', ['GET', 'OPTIONS']), ('/dts/collections/<objectId>', 'r_dts_collections', ['GET', 'OPTIONS'])]¶
-
cts_error(error_name, message=None)[source]¶ Create a CTS Error reply
Parameters: - error_name – Name of the error
- message – Message of the Error
Returns: CTS Error Response with information (XML)
-
dts_error(error_name, message=None)[source]¶ Create a DTS Error reply
Parameters: - error_name – Name of the error
- message – Message of the Error
Returns: DTS Error Response with information (JSON)
-
flaskcache¶
-
init_app(app)[source]¶ Initiate the extension on the application
Parameters: app – Flask Application Returns: Blueprint for Flask Nautilus registered in app Return type: Blueprint
-
init_blueprint()[source]¶ Properly generates the blueprint, registering routes and filters and connecting the app and the blueprint
Returns: Blueprint of the extension Return type: Blueprint
-
r_cts()[source]¶ Actual main route of CTS APIs. Transfer typical requests through the ?request=REQUESTNAME route
Returns: Response
-
r_dts_collection(objectId=None)[source]¶ DTS Collection Metadata reply for given objectId
Parameters: objectId – Collection Identifier Returns: JSON Format of DTS Collection
-
r_dts_collections(objectId)[source]¶ DTS Collection Metadata reply for given objectId
Parameters: objectId – Collection Identifier Returns: JSON Format of DTS Collection
Cache Manager¶
-
capitains_nautilus.manager.FlaskNautilusManager(resolver, flask_nautilus)[source]¶ Provides a manager for flask scripts to perform specific maintenance operations
Parameters: - resolver (NautilusCTSResolver) – Nautilus Extension Instance
- flask_nautilus (FlaskNautilus) – Flask Application
Returns: CLI
Return type: click.group
Import with