import pkg_resources


def status(request):
    """This is used to 'ping' the web service to check if its running.

    :returns: a status dict which the configured view will return as JSON.

    The dict has the form::

        dict(
            status="ok",
            name="<project name>",
            version="<egg version of nozama.cloudsearch.service>"
        )

    """
    pkg = pkg_resources.get_distribution('nozama-cloudsearch')

    return dict(
        status="ok",
        name="nozama-cloudsearch",
        version=pkg.version,
    )