Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viniciuschagas/djalf
https://github.com/viniciuschagas/djalf
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/viniciuschagas/djalf
- Owner: viniciuschagas
- Created: 2013-09-18T21:35:55.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-02T22:30:48.000Z (over 8 years ago)
- Last Synced: 2024-04-12T00:18:52.029Z (7 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- starred-awesome - djalf - (Python)
README
djalf
===Djalf is an application built on top of [alf](https://github.com/globocom/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](https://github.com/globocom/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 installUsage
===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')