1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from requests.auth import AuthBase
class TastypieApiKeyAuth(AuthBase):
"""
Sets the appropriate authentication headers
for the Tastypie API key authentication.
"""
def __init__(self, username, api_key):
self.username = username
self.api_key = api_key
def __call__(self, r):
r.headers['Authorization'] = 'ApiKey %s:%s' % (self.username, self.api_key)
return r
|
More like this
- Debug middleware for displaying sql queries and template loading info when ?debug=true by SEJeff 2 years, 1 month ago
- Tastypie v0.9.11 LoginRequiredAuthorization by cotton 9 months, 1 week ago
- packjs templatetag by kyprizel 5 years, 5 months ago
- enani by andisthermal 2 years, 4 months ago
- Using descriptors for lazy attribute caching by djypsy 5 years, 9 months ago
Comments