API

class lookout.PackageVersion[source]

Bases: object

Attempts to determine the package’s version.

static from_distribution() → typing.Union[str, NoneType][source]

Gets the package version from its installed distribution using pkg_resources.

static from_file() → typing.Union[str, NoneType][source]

Gets the package version from the VERSION.txt file created by setuptools-scm.

classmethod get() → str[source]

Attempts each method to get the package version in turn until one succeeds.

lookout.exceptions

exception lookout.exceptions.UnknownSchemaError[source]

Bases: Exception

Raised when a report doesn’t match any of the known schemas.

msg = "The supplied JSON data doesn't match any known report schema."
exception lookout.exceptions.JSONDecodeError(msg, doc, pos)[source]

Bases: ValueError

Subclass of ValueError with the following additional properties:

msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos

lookout.logging

class lookout.logging.ReportMessage(msg=None, report=None)[source]

Bases: object

Log message that can contain unserialized report data to be passed to specialized log handlers.

msg = 'Django-Lookout'
report = None

lookout.models

class lookout.models.Report(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A report filed through the HTTP Reporting API.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=True, **kwargs)
get_next_by_incident_time(*, field=<django.db.models.fields.DateTimeField: incident_time>, is_next=True, **kwargs)
get_previous_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=False, **kwargs)
get_previous_by_incident_time(*, field=<django.db.models.fields.DateTimeField: incident_time>, is_next=False, **kwargs)
get_type_display(*, field=<django.db.models.fields.CharField: type>)
incident_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <lookout.models.ReportManager object>
pretty_body() → str[source]

Displays a nicely-formatted version of a the report’s body.

schema
type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

uuid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

lookout.urls

URL patterns for the API endpoint.

Add the endpoint to your urls.py like so:

urlpatterns = [
  ...
  # Django Lookout
  url(r'^reporting', include('lookout.urls')),
  ...
]

lookout.utils

lookout.views

class lookout.views.ReportView(**kwargs)[source]

Bases: django.views.generic.base.View

Logs the report and returns an empty response.

dispatch(request, *args, **kwargs)
http_method_names = ['post']
static post(request: django.http.request.HttpRequest) → django.http.response.HttpResponse[source]

Handles the POST request.