|
| 1 | +python-firebase |
| 2 | +=============== |
| 3 | +http://github.com/mikexstudios/python-firebase |
| 4 | +by Michael Huynh (mike@mikexstudios.com) |
| 5 | + |
| 6 | +Purpose: |
| 7 | +------- |
| 8 | + |
| 9 | +A very simple wrapper for Firebase's REST API. |
| 10 | + |
| 11 | +How to use |
| 12 | +---------- |
| 13 | + |
| 14 | +1. Install python-firebase using pip: |
| 15 | + |
| 16 | + pip install -e git://github.com/mikexstudios/python-firebase.git#egg=python-firebase |
| 17 | + |
| 18 | + or with easy_install (not recommended): |
| 19 | + |
| 20 | + easy_install http://github.com/mikexstudios/python-firebase/tarball/master |
| 21 | + |
| 22 | + Note that python-firebase depends on requests (http://python-requests.org), |
| 23 | + a REST/http client for python. If you used pip or easy_install, the |
| 24 | + dependency should automatically be installed. |
| 25 | + |
| 26 | +2. Then simply import firebase at the top of your python script: |
| 27 | + |
| 28 | + from firebase import Firebase |
| 29 | + |
| 30 | + and then instantiate Firebase, passing in your root url: |
| 31 | + |
| 32 | + f = Firebase('http://demo.firebase.com/SampleChat') |
| 33 | + |
| 34 | + Now call the different methods of the Firebase class (see the Firebase |
| 35 | + REST API page: http://www.firebase.com/docs/rest-api.html and the source of |
| 36 | + `firebase/__init__.py` for what methods are available and how to call |
| 37 | + them). For example, to push a list of data: |
| 38 | + |
| 39 | + r = f.push('message_list', {'user_id': 'wilma', 'text': 'Hello'}) |
| 40 | + |
| 41 | + The response `r` is a dictionary containing Firebase's REST response: |
| 42 | + |
| 43 | + {"name":"-INOQPH-aV_psbk3ZXEX"} |
| 44 | + |
| 45 | + |
| 46 | +License |
| 47 | +------- |
| 48 | + |
| 49 | +django-firebase is BSD licensed. |
| 50 | + |
0 commit comments