django-apikey è un app Django che fornisce l'autenticazione chiave per Django. & Nbsp; Può essere utilizzato con django-pistone facilmente.
Sulla base di https://github.com/scoursen/django-apikey.
Installazione
Pip installare django-apikey
Configurazione
Aggiungi 'apikey' per il tuo settings.py:
INSTALLED_APPS = (
...
'Apikey',
....
)
È possibile modificare l'intestazione di autorizzazione impostando la APIKEY_AUTHORIZATION_HEADER in settings.py:
APIKEY_AUTHORIZATION_HEADER = 'App-Authorization'
Per aggiungere l'autenticazione api con pistone non thisin i gestori.
da apikey.auth importazione ApiKeyAuthentication
da piston.handler importazione BaseHandler
da piston.resource importazione Resource
da myapp.models importazione Articolo
Classe ItemHandler (BaseHandler):
& Nbsp; consentito = ('GET',)
& Nbsp; model = Articolo
& Nbsp; def leggere (auto):
& Nbsp; tornare Item.objects.all ()
handler = Risorsa (
& Nbsp; handler = ItemHandler, autenticazione = ApiKeyAuthentication ())
Grazie
Questo progetto è la base su uno dei Steve Corso https://github.com/scoursen/django-apikey ma con diverse semplificazioni
Requisiti .
- Python
- Django
I commenti non trovato