Skip to content

Commit 9492b88

Browse files
committed
merge conflict
2 parents 1a6808f + 4dffa92 commit 9492b88

3 files changed

Lines changed: 30 additions & 19 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ docs/_build/
5454

5555
secrets.*sh
5656
.idea
57+
58+
.venv

‎README.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,24 @@ stream-python
33

44
[![Build Status](https://travis-ci.org/GetStream/stream-python.svg?branch=master)](https://travis-ci.org/GetStream/stream-python) [![Coverage Status](https://coveralls.io/repos/github/GetStream/stream-python/badge.svg?branch=master)](https://coveralls.io/r/GetStream/stream-python?branch=master) [![PyPI version](https://badge.fury.io/py/stream-python.svg)](http://badge.fury.io/py/stream-python)
55

6-
stream-python is the official Python client for [Stream](https://getstream.io/), a web service for building scalable newsfeeds and activity streams.
7-
The full documentation is available on [GetStream.io/docs](http://getstream.io/docs/?language=python). Note that there is also a [higher level Django integration](https://github.com/getstream/stream-django) which hooks into your ORM.
6+
[stream-python](https://github.com/GetStream/stream-python) is the official Python client for [Stream](https://getstream.io/), a web service for building scalable newsfeeds and activity streams.
7+
8+
Note there is also a higher level [Django - Stream integration](https://github.com/getstream/stream-django) library which hooks into the Django ORM.
9+
10+
You can sign up for a Stream account at https://getstream.io/get_started.
811

912
### Installation
1013

1114
#### Install from Pypi
1215

13-
1416
```bash
1517
pip install stream-python
1618
```
1719

20+
### Full documentation
21+
22+
Documentation for this Python client are available at the [Stream website](https://getstream.io/docs/?language=python) or on [Read the Docs](http://stream-python.readthedocs.org/en/latest/).
23+
1824
### Usage
1925

2026
```python
@@ -38,7 +44,7 @@ result = user_feed_1.get(limit=5, id_lt="e561de8f-00f1-11e4-b400-0cc47a024be0")
3844
activity_data = {'actor': 1, 'verb': 'tweet', 'object': 1, 'foreign_id': 'tweet:1'}
3945
activity_response = user_feed_1.add_activity(activity_data)
4046
# Create a bit more complex activity
41-
activity_data = {'actor': 1, 'verb': 'run', 'object': 1, 'foreign_id': 'run:1',
47+
activity_data = {'actor': 1, 'verb': 'run', 'object': 1, 'foreign_id': 'run:1',
4248
'course': {'name': 'Golden Gate park', 'distance': 10},
4349
'participants': ['Thierry', 'Tommaso'],
4450
'started_at': datetime.datetime.now()
@@ -97,19 +103,19 @@ readonly_token = user_feed_1.get_readonly_token()
97103
# Generate a redirect url for the Stream Analytics platform to track
98104
# events/impressions on url clicks
99105
impression = {
100-
'content_list': ['tweet:1', 'tweet:2', 'tweet:3'],
101-
'user_data': 'tommaso',
106+
'content_list': ['tweet:1', 'tweet:2', 'tweet:3'],
107+
'user_data': 'tommaso',
102108
'location': 'email',
103109
'feed_id': 'user:global'
104110
}
105111

106112
engagement = {
107-
'content': 'tweet:2',
113+
'content': 'tweet:2',
108114
'label': 'click',
109-
'position': 1,
110-
'user_data': 'tommaso',
115+
'position': 1,
116+
'user_data': 'tommaso',
111117
'location': 'email',
112-
'feed_id':
118+
'feed_id':
113119
'user:global'
114120
}
115121

@@ -118,12 +124,6 @@ events = [impression, engagement]
118124
redirect_url = client.create_redirect_url('http://google.com/', 'user_id', events)
119125
```
120126

121-
122-
123-
API docs are on [Read the
124-
docs](http://stream-python.readthedocs.org/en/latest/).
125-
126-
127127
[JS client](http://github.com/getstream/stream-js).
128128

129129
### Contributing

‎stream/tests.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,21 @@ def getfeed(feed_slug, user_id):
6565
return client.feed(feed_slug, user_id + get_unique_postfix())
6666

6767

68+
def api_request_parse_validator(test):
69+
def wrapper(meth):
70+
def _parse_response(*args, **kwargs):
71+
response = meth(*args, **kwargs)
72+
test.assertIn('duration', response)
73+
return response
74+
return _parse_response
75+
return wrapper
76+
77+
6878
class ClientTest(TestCase):
6979

7080
def setUp(self):
81+
client._parse_response = api_request_parse_validator(self)(client._parse_response)
82+
7183
# DEBUG account details
7284
user1 = getfeed('user', '1')
7385
user2 = getfeed('user', '2')
@@ -418,11 +430,8 @@ def test_follow_and_delete(self):
418430
actor_id = random.randint(10, 100000)
419431
activity_data = {'actor': actor_id, 'verb': 'tweet', 'object': 1}
420432
activity_id = user_feed.add_activity(activity_data)['id']
421-
422-
423433
agg_feed.follow(user_feed.slug, user_feed.user_id)
424434
user_feed.remove_activity(activity_id)
425-
426435
activities = agg_feed.get(limit=3)['results']
427436
activity = self._get_first_aggregated_activity(activities)
428437
activity_id_found = (activity['id'] if activity is not None

0 commit comments

Comments
 (0)