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'}
construct()[source]

Construct a URL from its base parts

classmethod dereference(sondra, value)[source]
classmethod dereference_all(sondra, value)[source]
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.
get_document()[source]

Return the Document for a given URL.

get_document_method()[source]

Return everything you need to call an document method.

Returns:
  • document object
  • method name
  • method object
Return type:A three-tuple of
Raises:EndpointError if the method or document is not found or the method is not exposable.
get_subdocument()[source]

Return the fragment within the Document referred to by this URL.

is_application()[source]
is_application_method_call()[source]
is_collection()[source]
is_collection_method_call()[source]
is_document()[source]
is_document_method_call()[source]
is_subdocument()[source]
kind[source]
classmethod maybe_reference(sondra, value)[source]
schema[source]
value[source]