Skip to content

Commit 8d2d3ac

Browse files
committed
Update README.md
1 parent 7c1e785 commit 8d2d3ac

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

README.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
11
#firebase-python
22
######A nice (working!) Python Firebase integration for hackers
33

4-
Quick and dirty but not crappy: this Python module will get you from 0 to Firebase in under 3 seconds.
5-
6-
Supports streaming API but not authentication.
4+
Quick and dirty, but not crappy. Supports streaming API but not authentication.
75

86
Requires `requests` and `sseclient`, which are on pip. If you don't know what that is, don't worry; just run `./setup.sh`.
97

108

119

1210
##get and put
1311

14-
`get` gets the value of a Firebase at some URL, and `put` sets the value of a Firebase at some URL to some data.
12+
`get` gets the value of a Firebase at some URL, and `put` sets the value of a Firebase at URL to some data.
1513

1614
```python
1715
>>> import firebase
18-
1916
>>> URL = 'lucid-lychee' # see note on URLs at the bottom of documentation
20-
2117
>>> firebase.get(URL) == None # this is an empty Firebase
2218
True
2319

2420
>>> firebase.put(URL, 'tell me everything') # can take a string
25-
2621
>>> firebase.get(URL)
2722
u'tell me everything'
2823

2924
>>> firebase.put(URL, {'lucidity': 9001}) # or a dictionary
30-
3125
>>> firebase.get(URL)
3226
{u'lucidity': 9001}
3327

3428
>>> firebase.put(URL, {'color': 'red'}) # replaces old value
35-
3629
>>> firebase.get(URL)
3730
{u'color': u'red'}
3831

@@ -44,23 +37,19 @@ u'red'
4437

4538
##patch
4639

47-
`patch` updates an existing key value store at some URL with new key value pairs, without deleting the old key value pairs.
40+
`patch` adds new key value pairs to an existing Firebase, without deleting the old key value pairs.
4841

4942
```python
5043
>>> import firebase
51-
5244
>>> URL = 'tibetan-tumbleweed'
53-
5445
>>> firebase.get(URL) == None
5546
True
5647

5748
>>> firebase.patch(URL, {'taste': 'tibetan'})
58-
5949
>>> firebase.get(URL)
6050
{u'taste': u'tibetan'}
6151

6252
>>> firebase.patch(URL, {'size': 'tumbly}) # patching does not overwrite
63-
6453
>>> firebase.get(URL)
6554
{u'taste': u'tibetan', u'size': u'tumbly'}
6655
```
@@ -69,35 +58,28 @@ True
6958

7059
##subscriber
7160

72-
`subscriber` takes a URL and callback function and calls that callback on every update of the Firebase at URL.
61+
`subscriber` takes a URL and callback function and calls the callback on every update of the Firebase at URL.
7362

7463
```python
7564
>>> import firebase
76-
7765
>>> from pprint import pprint # function which pretty prints objects
78-
7966
>>> URL = 'clumsy-clementine'
80-
8167
>>> S = firebase.subscriber(URL, pprint) # pprint will be called on all Firebase updates
82-
8368
>>> S.start() # will get called with initial value of URL, which is empty
8469
{u'data': None, u'path': u'/'}
8570

8671
>>> firebase.put(URL, ';-)') # will make S print something
8772
{u'data': u';-)', u'path': u'/'}
8873

89-
>>> firebase.put(URL, {'status': 'mortified'})
74+
>>> firebase.put(URL, {'status': 'mortified'}) # continuing from above
9075
{u'data': {u'status': u'mortified'}, u'path': u'/'}
91-
9276
>>> firebase.patch(URL, {'reason': 'blushing'}) # this one is scary
9377
{u'data': {u'reason': u'blushing'}, u'path': u'/'}
94-
95-
>>> firebase.get(URL) # notice the update only gave us the update without telling us
78+
>>> firebase.get(URL) # notice the update only gave us the new k,v without telling us
9679
{u'status': u'mortified', u'reason': u'blushing'}
9780

9881
>>> firebase.put(URL, {'color': 'orange-red'}) # expect change from S
9982
{u'data': {u'color': u'orange-red'}, u'path': u'/'}
100-
10183
>>> firebase.get(URL) # put overwrites, but S doesn't tell us!
10284
{u'color': u'orange-red'}
10385

0 commit comments

Comments
 (0)