Skip to main content

A djangorestframework-api-key decorator to allow access by key names

Project description

Django RESTframework-api key - Allow by key names

Decorator working with djangorestframework-api-key allowing to restrict access to a method according to the key presented.

Usage

Use @allow_only_apikey() with a list of key names as the first parameter :

from rest_framework_api_key_allowbynames.decorator import allow_only_apikey

class TelegramMemberCheck(APIView):
    permission_classes = [HasAPIKey]

    @allow_only_apikey(['TelegramBot'])
    def get(self, request, format=None):
        pass

If the key does not match, an AuthenticationFailed is returned.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page