Jump to >

djblets.webapi.models

class BaseWebAPIToken(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Base class for an access token used for authenticating with the API.

Each token can be used to authenticate the token’s owner with the API, without requiring a username or password to be provided. Tokens can be revoked, and new tokens added.

Tokens can store policy information, which will later be used for restricting access to the API.

user[source]
is_accessible_by(user)[source]
is_mutable_by(user)[source]
is_deletable_by(user)[source]
__str__()[source]
save(*args, **kwargs)[source]

Save the token.

If the token is being updated, the webapi_token_updated signal will be emitted.

Parameters:
  • *args (tuple) – Positional arguments to pass to the superclass.
  • **kwargs (dict) – Keyword arguments to pass to the superclass.
classmethod get_root_resource()[source]
classmethod validate_policy(policy)[source]

Validate an API policy.

This will check to ensure that the policy is in a suitable format and contains the information required in a format that can be parsed.

If a failure is found, a ValidationError will be raised describing the error and where it was found.

class Meta[source]
abstract = False[source]
verbose_name = _(u'Web API token')[source]
verbose_name_plural = _(u'Web API tokens')[source]
__unicode__()[source]
get_extra_data_json()[source]
get_next_by_last_updated(**morekwargs)[source]
get_next_by_time_added(**morekwargs)[source]
get_policy_json()[source]
get_previous_by_last_updated(**morekwargs)[source]
get_previous_by_time_added(**morekwargs)[source]
set_extra_data_json(json)[source]
set_policy_json(json)[source]