|
| 1 | +stream-python ========= |
| 2 | + |
| 3 | +[](https://circleci.com/gh/tschellenbach/stream-python/tree/master) |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +> target |
| 8 | +> : <https://coveralls.io/r/tschellenbach/stream-python> |
| 9 | +> |
| 10 | +stream-python is a Python client for [Stream](https://getstream.io/). |
| 11 | + |
| 12 | +~~~~ {.sourceCode .python} |
| 13 | +# Instantiate a new client |
| 14 | +import stream |
| 15 | +client = stream.connect('YOUR_API_KEY', 'API_KEY_SECRET') |
| 16 | +# Find your API keys here https://getstream.io/dashboard/ |
| 17 | +
|
| 18 | +# Instantiate a feed object |
| 19 | +user_feed_1 = client.feed('user:1') |
| 20 | +
|
| 21 | +# Get activities from 5 to 10 (slow pagination) |
| 22 | +result = user_feed_1.get(limit=5, offset=5) |
| 23 | +# (Recommended & faster) Filter on an id less than 112334 |
| 24 | +result = user_feed_1.get(limit=5, id_lt=112334) |
| 25 | +
|
| 26 | +# Create a new activity |
| 27 | +activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1} |
| 28 | +activity_response = user_feed_1.add_activity(activity_data) |
| 29 | +
|
| 30 | +# Remove an activity by its id |
| 31 | +user_feed_1.remove('12345678910') |
| 32 | +
|
| 33 | +# Follow another feed |
| 34 | +user_feed_1.follow('flat:42') |
| 35 | +
|
| 36 | +# Stop following another feed |
| 37 | +user_feed_1.unfollow('flat:42') |
| 38 | +~~~~ |
| 39 | + |
| 40 | +Docs are available on [GetStream.io](http://getstream.io/docs/). |
| 41 | + |
| 42 | +API docs are on [Read the |
| 43 | +docs](http://stream-python.readthedocs.org/en/latest/). |
| 44 | + |
| 45 | +Installation |
| 46 | +============ |
| 47 | + |
| 48 | +Install from Pypi |
| 49 | +----------------- |
| 50 | + |
| 51 | +~~~~ {.sourceCode .bash} |
| 52 | +pip install stream-python |
| 53 | +~~~~ |
| 54 | + |
| 55 | +Contributing |
| 56 | +============ |
| 57 | + |
| 58 | +First, make sure you can run the test suite. Tests are run via py.test |
| 59 | + |
| 60 | +~~~~ {.sourceCode .bash} |
| 61 | +py.test stream/tests.py |
| 62 | +# with coverage |
| 63 | +py.test stream/tests.py --cov stream --cov-report html |
| 64 | +# against a local API backend |
| 65 | +LOCAL=true py.test stream/tests.py |
| 66 | +~~~~ |
0 commit comments