thorn.generic.models

Generic base model mixins.

class thorn.generic.models.AbstractSubscriber[source]

Abstract class for Subscriber identity.

as_dict()[source]

Dictionary representation of Subscriber.

content_type

MIME-type to use for web requests made to the subscriber url.

event

Event pattern this subscriber is subscribed to (e.g. article.*).

from_dict(*args, **kwargs)[source]

Create subscriber from dictionary representation.

Note

Accepts the same arguments as dict.

hmac_digest

HMAC digest type (e.g. "sha512").

The value used must be a member of hashlib.algorithms_available.

hmac_secret

HMAC secret key, of arbitrary length.

classmethod register(other)[source]
sign(message)[source]

Sign message using HMAC.

Note

hmac_secret and the current hmac_digest type must be set.

url

Destination URL to dispatch this event.

user

User filter – when set only dispatch if the event sender matches.

user_ident()[source]

Return user identity.

Note

Value must be json serializable like a database primary key.

uuid

Unique identifier.

class thorn.generic.models.SubscriberModelMixin[source]

Mixin for subscriber models.

as_dict()[source]
classmethod from_dict(*args, **kwargs)[source]
sign(message)[source]