sondra.ref module¶
- exception sondra.ref.EndpointError[source]¶
Bases: builtins.Exception
Raised when an API request is parsed correctly, but the endpoint isn’t found
- exception sondra.ref.ParseError[source]¶
Bases: builtins.Exception
Called when an API request is not parsed as valid
- class sondra.ref.Reference(env, url=None, **kw)[source]¶
Bases: builtins.object
Contains the application, collection, document, methods, and fragment the URL refers to
- FORMATS = {'json', 'geojson', 'schema', 'help'}¶
- get_application()[source]¶
Return an Application instance for the given URL.
Parameters: url (str) – The URL to a collection or a document. Returns: An Application object
- get_application_method()[source]¶
Return everything you need to call an application method.
Returns: - application object
- method name
- method object
Return type: A three-tuple of Raises: EndpointError if the method or application is not found or the method is not exposable.
- get_collection()[source]¶
Return a DocumentCollection instance for the given URL.
Parameters: url (str) – The URL to a collection or a document. Returns: A DocumentCollection object
- get_collection_method()[source]¶
Return everything you need to call an collection method.
Returns: - collection object
- method name
- method object
Return type: A three-tuple of Raises: EndpointError if the method or collection is not found or the method is not exposable.