Secret Views

Secret API views

class smarter.apps.secret.api.v1.views.SecretListView(*args, **kwargs)[source]

Bases: SmarterAdminListAPIView

class for secret list views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication checks and logging.

Parameters:

request (Request) – The incoming HTTP request.

Returns:

The HTTP response generated by the view.

Return type:

HttpResponse

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of SecretSerializer

setup(request, *args, **kwargs)[source]

Setup the view. This is called by Django before dispatch() and is used to set up the view for the request.

class smarter.apps.secret.api.v1.views.SecretView(*args, **kwargs)[source]

Bases: SmarterAdminAPIView

class for secret views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication check.

Parameters:

request (Request) – The incoming HTTP request.

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get_queryset()[source]
serializer_class

alias of SecretSerializer

smarter.apps.secret.api.v1.views.should_log(level)[source]

Check if logging should be done based on the waffle switch.