A Django api permission manager that helps you custom api url in regular expression and control access.
Project description
Django-API-Permission
1. Intro
A Django api permission manager that helps you custom api url in regular expression and control access.
2. Quick Start
2.1 Install
pip install django-api-permission
2.2 add to INSTALLED_APPS and MIDDLEWARE
INSTALLED_APPS = [
...
'api_permission',
...
]
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'api_permission.middleware.APIPermCheckMiddleware',
]
2.3 migrate
./manage.py migrate api_permission
2.4 settings
set API_PERMISSION_CONF
in your settings.py as a dict.
API_PERMISSION_CONF = {
'API_PREFIX': ['api/topic/'], # default is /
'PERMISSION_DENIED_CODE': 400, # default is 1
'AUTHORIZATION_HEADER': 'HTTP_AUTHORIZATION', # default is HTTP_AUTHORIZATION
'ADMIN_SITE_PATH': '/admin/' default is /admin/
}
You can custom API_PREFIX
as a str like '/'
or list like ['api/account', 'api/topic']
.
3. Demo
3.1 list
3.2 edit
3.3 result
Project details
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
Close
Hashes for django-api-permission-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8caf55fb67c8c3259e66a04230cc373df5a65eb95718c722ab4fee4bd5da1c2 |
|
MD5 | 45f4d59d9dfa19c0c418e65b584178e8 |
|
BLAKE2b-256 | 17c6df216e1d0a77f9a035039aaf929b81b69805f0681a40c617147787f1365a |