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

File details

Details for the file djangorestframework-api-key-allowbynames-1.0.2.tar.gz.

File metadata

  • Download URL: djangorestframework-api-key-allowbynames-1.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for djangorestframework-api-key-allowbynames-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6f4e2895bd81b588fa1292bf6647638c46d14978b68bb64903d47e242c116978
MD5 194798cb3d8087741f69863eb2533965
BLAKE2b-256 16d4a5947f56f6509589f77e37696ddb368fc9bfa7e7377992b93a567bb061ef

See more details on using hashes here.

File details

Details for the file djangorestframework_api_key_allowbynames-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for djangorestframework_api_key_allowbynames-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89faef90a6d4c9de7308937204680d2dd2b2f3962bcc2ecd875f6b6abd3320e5
MD5 688e34ab9131a0500f2f8e4e5c68a86e
BLAKE2b-256 68a46e950658ca04c112f15dcff5e2a992baf5f0e18c21fc206df827bf25923a

See more details on using hashes here.

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