Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e3bce4

Browse files
authored
Merge pull request GetStream#60 from GetStream/feature/python26-support
Python 2.6.9 support
2 parents 4dffa92 + 9492b88 commit 9e3bce4

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

CHANGELOG

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Change history
33
================
44

5+
2.3.10
6+
======
7+
:release-date: 2017-05-22
8+
:by: Ian Douglas
9+
10+
* Added support for Python 2.6.9 and downgrade to requests 2.2.1
11+
12+
513
2.3.9
614
==========
715
:release-date: 2016-12-20
@@ -87,7 +95,7 @@
8795
:by: Thierry Schellenbach
8896

8997
* Breaking change: New style feed syntax, client.feed('user', '1') instead of client.feed('user:3')
90-
* Breaking change: New style follow syntax, feed.follow('user', 3)
98+
* Breaking change: New style follow syntax, feed.follow('user', 3)
9199
* API versioning support
92100
* Configurable timeouts
93101
* Python 3 support

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
install_requires = [
3030
'pyjwt==1.3.0',
31-
'requests>=2.3.0',
31+
'requests>=2.2.1',
3232
'six>=1.8.0',
3333
'httpsig==1.1.2'
3434
]
@@ -72,6 +72,7 @@ def run_tests(self):
7272
'Development Status :: 5 - Production/Stable',
7373
'License :: OSI Approved :: BSD License',
7474
'Natural Language :: English',
75+
'Programming Language :: Python :: 2.6',
7576
'Programming Language :: Python :: 2.7',
7677
'Programming Language :: Python :: 3',
7778
'Programming Language :: Python :: 3.3',

stream/exceptions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def get_exceptions():
8585

8686

8787
def get_exception_dict():
88-
classes = get_exceptions()
89-
exception_dict = {c.code: c for c in classes}
88+
exception_dict = {}
89+
for c in get_exceptions():
90+
exception_dict[c.code] = c
9091
return exception_dict

stream/tests.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
from stream.exceptions import ApiKeyException, InputException
55
import random
66
import jwt
7-
from unittest.case import TestCase
7+
try:
8+
from unittest.case import TestCase
9+
except ImportError:
10+
from unittest import TestCase
811
import json
912

1013
import os
@@ -42,6 +45,7 @@ def connect_debug():
4245
location='us-east',
4346
timeout=30,
4447
base_url='http://qa-api.getstream.io/api/',
48+
# base_url='http://localhost-api.getstream.io:8000/api/',
4549
)
4650

4751
client = connect_debug()
@@ -308,16 +312,14 @@ def test_add_activity_to(self):
308312
activities = team_follower_feed.get(limit=1)['results']
309313
self.assertFirstActivityIDNotEqual(activities, activity_id)
310314

311-
312315
def test_add_activity_to_type_error(self):
313316
user_feed = getfeed('user', '1')
314317
activity_data = {
315318
'actor': 1, 'verb': 'tweet', 'object': 1,
316319
'to': 'string'
317320
}
318321

319-
with self.assertRaises(TypeError):
320-
user_feed.add_activity(activity_data)
322+
self.assertRaises(TypeError, user_feed.add_activity, activity_data)
321323

322324
def assertFirstActivityIDEqual(self, activities, correct_activity_id):
323325
activity_id = None
@@ -610,7 +612,6 @@ def test_get_not_marked_seen(self):
610612
print(notification_feed.add_activity({'actor': 2, 'verb': 'tweet', 'object': 2})['id'])
611613
print(notification_feed.add_activity({'actor': 3, 'verb': 'tweet', 'object': 3})['id'])
612614

613-
614615
activities = notification_feed.get(limit=3)['results']
615616
from pprint import pprint
616617
print(len(activities))
@@ -658,7 +659,6 @@ def test_mark_read_by_id(self):
658659
print(notification_feed.add_activity({'actor': 2, 'verb': 'tweet', 'object': 2})['id']) # ['id']
659660
print(notification_feed.add_activity({'actor': 3, 'verb': 'tweet', 'object': 2})['id']) # ['id']
660661

661-
662662
activities = notification_feed.get(limit=3)['results']
663663
ids = []
664664
from pprint import pprint
@@ -822,6 +822,12 @@ def test_serialization(self):
822822
loaded = serializer.loads(serialized)
823823
self.assertEqual(data, loaded)
824824

825+
# def test_signed_request_post(self):
826+
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
827+
#
828+
# def test_signed_request_get(self):
829+
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
830+
825831
def test_follow_many(self):
826832
sources = [getfeed('user', str(i)).id for i in range(10)]
827833
targets = [getfeed('flat', str(i)).id for i in range(10)]
@@ -831,14 +837,14 @@ def test_follow_many(self):
831837
for target in targets:
832838
follows = self.c.feed(*target.split(':')).followers()['results']
833839
self.assertEqual(len(follows), 1)
834-
self.assertIn(follows[0]['feed_id'], sources)
840+
self.assertTrue(follows[0]['feed_id'] in sources)
835841
self.assertEqual(follows[0]['target_id'], target)
836842

837843
for source in sources:
838844
follows = self.c.feed(*source.split(':')).following()['results']
839845
self.assertEqual(len(follows), 1)
840846
self.assertEqual(follows[0]['feed_id'], source)
841-
self.assertIn(follows[0]['target_id'], targets)
847+
self.assertTrue(follows[0]['target_id'] in targets)
842848

843849
def test_follow_many_acl(self):
844850
sources = [getfeed('user', str(i)) for i in range(10)]
@@ -933,8 +939,6 @@ def test_create_email_redirect(self):
933939

934940
self.assertEqual(json.loads(qs['events'][0]), events)
935941

936-
937-
938942
def test_email_redirect_invalid_target(self):
939943
engagement = {'foreign_id': 'tweet:1', 'label': 'click', 'position': 3, 'user_id': 'tommaso', 'location': 'email', 'feed_id': 'user:global'}
940944
impression = {'foreign_ids': ['tweet:1', 'tweet:2', 'tweet:3', 'tweet:4', 'tweet:5'], 'user_id':

0 commit comments

Comments
 (0)