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

Skip to content

Python 2.6.9 support #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Change history
================

2.3.10
======
:release-date: 2017-05-22
:by: Ian Douglas

* Added support for Python 2.6.9 and downgrade to requests 2.2.1


2.3.9
==========
:release-date: 2016-12-20
Expand Down Expand Up @@ -87,7 +95,7 @@
:by: Thierry Schellenbach

* Breaking change: New style feed syntax, client.feed('user', '1') instead of client.feed('user:3')
* Breaking change: New style follow syntax, feed.follow('user', 3)
* Breaking change: New style follow syntax, feed.follow('user', 3)
* API versioning support
* Configurable timeouts
* Python 3 support
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

install_requires = [
'pyjwt==1.3.0',
'requests>=2.3.0',
'requests>=2.2.1',
'six>=1.8.0',
'httpsig==1.1.2'
]
Expand Down Expand Up @@ -72,6 +72,7 @@ def run_tests(self):
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
Expand Down
5 changes: 3 additions & 2 deletions stream/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def get_exceptions():


def get_exception_dict():
classes = get_exceptions()
exception_dict = {c.code: c for c in classes}
exception_dict = {}
for c in get_exceptions():
exception_dict[c.code] = c
return exception_dict
24 changes: 14 additions & 10 deletions stream/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from stream.exceptions import ApiKeyException, InputException
import random
import jwt
from unittest.case import TestCase
try:
from unittest.case import TestCase
except ImportError:
from unittest import TestCase
import json

import os
Expand Down Expand Up @@ -42,6 +45,7 @@ def connect_debug():
location='us-east',
timeout=30,
base_url='http://qa-api.getstream.io/api/',
# base_url='http://localhost-api.getstream.io:8000/api/',
)

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


def test_add_activity_to_type_error(self):
user_feed = getfeed('user', '1')
activity_data = {
'actor': 1, 'verb': 'tweet', 'object': 1,
'to': 'string'
}

with self.assertRaises(TypeError):
user_feed.add_activity(activity_data)
self.assertRaises(TypeError, user_feed.add_activity, activity_data)

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


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


activities = notification_feed.get(limit=3)['results']
ids = []
from pprint import pprint
Expand Down Expand Up @@ -822,6 +822,12 @@ def test_serialization(self):
loaded = serializer.loads(serialized)
self.assertEqual(data, loaded)

# def test_signed_request_post(self):
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})
#
# def test_signed_request_get(self):
# self.c._make_signed_request('post', 'test/auth/digest/', {}, {})

def test_follow_many(self):
sources = [getfeed('user', str(i)).id for i in range(10)]
targets = [getfeed('flat', str(i)).id for i in range(10)]
Expand All @@ -831,14 +837,14 @@ def test_follow_many(self):
for target in targets:
follows = self.c.feed(*target.split(':')).followers()['results']
self.assertEqual(len(follows), 1)
self.assertIn(follows[0]['feed_id'], sources)
self.assertTrue(follows[0]['feed_id'] in sources)
self.assertEqual(follows[0]['target_id'], target)

for source in sources:
follows = self.c.feed(*source.split(':')).following()['results']
self.assertEqual(len(follows), 1)
self.assertEqual(follows[0]['feed_id'], source)
self.assertIn(follows[0]['target_id'], targets)
self.assertTrue(follows[0]['target_id'] in targets)

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

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



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