Metadata-Version: 2.1
Name: djangorestframework-api-key-allowbynames
Version: 1.0.0
Summary: A djangorestframework-api-key decorator to allow access by key names
Home-page: https://github.com/mneitsabes/djangorestframework-api-key-allowbynames
Author: mneitsabes
Author-email: mneitsabes@nulloz.be
License: UNKNOWN
Keywords: django,djangorestframework-api-key
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: djangorestframework
Requires-Dist: djangorestframework-api-key

# 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 :

    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.



