archivebox.api.models

Module Contents

Classes

APIToken

A secret key generated by a User that’s used to authenticate REST API requests to ArchiveBox.

OutboundWebhook

Model used in place of (extending) signals_webhooks.models.WebhookModel. Swapped using: settings.SIGNAL_WEBHOOKS_CUSTOM_MODEL = ‘api.models.OutboundWebhook’

Functions

generate_secret_token

API

archivebox.api.models.generate_secret_token() str[source]
class archivebox.api.models.APIToken(*args: Any, **kwargs: Any)[source]

Bases: archivebox.base_models.models.ABIDModel

A secret key generated by a User that’s used to authenticate REST API requests to ArchiveBox.

Initialization

Overriden init method ensures we have a stable creation timestamp that fields can use within initialization code pre-saving to DB.

abid_prefix[source]

‘apt_’

abid_ts_src[source]

‘self.created_at’

abid_uri_src[source]

‘self.created_by_id’

abid_subtype_src[source]

‘“01”’

abid_rand_src[source]

self.id

abid_drift_allowed[source]

True

id[source]

‘UUIDField(…)’

abid[source]

‘ABIDField(…)’

created_by[source]

‘ForeignKey(…)’

created_at[source]

‘AutoDateTimeField(…)’

modified_at[source]

‘DateTimeField(…)’

token[source]

‘CharField(…)’

expires[source]

‘DateTimeField(…)’

class Meta[source]

Bases: django_stubs_ext.db.models.TypedModelMeta

verbose_name[source]

‘API Key’

verbose_name_plural[source]

‘API Keys’

__str__() str[source]
__repr__() str[source]
__json__() dict[source]
property expires_as_iso8601[source]

Returns the expiry date of the token in ISO 8601 format or a date 100 years in the future if none.

property token_redacted[source]
is_valid(for_date=None)[source]
class archivebox.api.models.OutboundWebhook(*args: Any, **kwargs: Any)[source]

Bases: archivebox.base_models.models.ABIDModel, signal_webhooks.models.WebhookBase

Model used in place of (extending) signals_webhooks.models.WebhookModel. Swapped using: settings.SIGNAL_WEBHOOKS_CUSTOM_MODEL = ‘api.models.OutboundWebhook’

Initialization

Overriden init method ensures we have a stable creation timestamp that fields can use within initialization code pre-saving to DB.

abid_prefix[source]

‘whk_’

abid_ts_src[source]

‘self.created_at’

abid_uri_src[source]

‘self.endpoint’

abid_subtype_src[source]

‘self.ref’

abid_rand_src[source]

self.id

abid_drift_allowed[source]

True

id[source]

‘UUIDField(…)’

abid[source]

‘ABIDField(…)’

created_by[source]

‘ForeignKey(…)’

created_at[source]

‘AutoDateTimeField(…)’

modified_at[source]

‘DateTimeField(…)’

class Meta[source]

Bases: signal_webhooks.models.WebhookBase.Meta

verbose_name[source]

‘API Outbound Webhook’

__str__() str[source]