Skip to content

viniciuschagas/djalf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

djalf

Djalf is an application built on top of alf. It implements a custom token manager that stores the access token in the django's cache backend. This is useful for applications running with more than one process (with gunicorn, for example).

Using the django's cache, the application can share the access token among Its process, reducing the number of transactions with the API.

Installation

First you should install alf

$ pip install -e git+https://github.com/globocom/alf#egg=alf

You can install from github:

$ pip install -e git+https://github.com/viniciuschagas/djalf#egg=djalf

or from source:

$ git clone https://github.com/viniciuschagas/djalf.git
$ cd djalf
$ python setup.py install

Usage

You should instantiate a django client object and use this object to perform your API calls.

>>> from djalf.client import ClientDjango
>>> from requests.packages.urllib3.util import Retry # only with alf >=0.6.0

>>> api_client = ClientDjango(
...    token_endpoint='http://your-token-end-point',
...    client_id='your-client-id',
...    client_secret='you-client-secret',
...    token_retry=Retry(total=5, status_forcelist=[500], backoff_factor=0.3) # only with alf >=0.6.0
...)

>>> api_client.get('http://your-api-resource')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •