ninja-api-key 1.0.2
pip install ninja-api-key
Latest version
Released:
Django Ninja API Key Authentication
Navigation
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Meta
- Author: Lucas Rangel Cezimbra
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License
- Tags django, rest, ninja, auth, apikey
- Requires: Python >=3.6.2
-
Provides-Extra:
test
Classifiers
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Project description
Ninja API Key
API Key authentication for Django Ninja.
This is a fork from django-ninja-apikey.
Key Features:
- Easy integration into your projects
- Well integrated with the Admin interface
- Secure API keys due to hashing
- Works with the standard user model
Installation
pip install ninja-api-key
How to use
- Add
ninja_apikey
to your installed apps in your Django project:
# settings.py
INSTALLED_APPS = [
# ...
"ninja_apikey",
]
- Apply migrations
python manage.py migrate
- Secure
a. the whole API
# api.py
from ninja import NinjaAPI
from ninja_apikey.security import APIKeyAuth
# ...
api = NinjaAPI(auth=APIKeyAuth())
# ...
@api.get("/secure_endpoint")
def secure_endpoint(request):
return f"Hello, {request.user}!"
b. an specific endpoint
# api.py
from ninja import NinjaAPI
from ninja_apikey.security import APIKeyAuth
# ...
auth = APIKeyAuth()
api = NinjaAPI()
# ...
@api.get("/secure_endpoint", auth=auth)
def secure_endpoint(request):
return f"Hello, {request.user}!"
Contributing
Contributions are welcome, feel free to open an Issue or Pull Request.
git clone https://github.com/lucasrcezimbra/ninja-api-key
cd ninja-api-key
python -m venv .venv
source .venv/bin/activate
pip install .[test]
pre-commit install
make test
Project details
Verified details
These details have been verified by PyPIProject links
GitHub Statistics
Maintainers
Meta
- Author: Lucas Rangel Cezimbra
Unverified details
These details have not been verified by PyPIMeta
- License: MIT License
- Tags django, rest, ninja, auth, apikey
- Requires: Python >=3.6.2
-
Provides-Extra:
test
Classifiers
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Release history Release notifications | RSS feed
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 ninja_api_key-1.0.2.tar.gz
.
File metadata
- Download URL: ninja_api_key-1.0.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc1a64f6b79cee5e84bf6bbd2d2a8a03e938044db77ca8855ab1d6f75682441d |
|
MD5 | 728ead477b6c79240eb05da3bf1da07e |
|
BLAKE2b-256 | eb21c125015bbb9a626c323a0908e3c997a255de043713553277b2eacf4b03f3 |
File details
Details for the file ninja_api_key-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: ninja_api_key-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 817076874cdc5f10afb941ecd45bceef4981feb23ad0a1fcdd070bc4f391a27e |
|
MD5 | b910bedb899ccafc36ffa26ccdcc0408 |
|
BLAKE2b-256 | 48b364019097ddd81737c953017c2d5ca5b781e73f512a65a57de145afe6fcb6 |