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

Skip to content

Feat/update dot com domain #63

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 2 commits into from
Oct 17, 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
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,9 @@ python:
- 3.4
- 3.5
- 3.6
# These are allowed to fail
- '3.5-dev' # 3.5 development branch
- '3.6-dev' # 3.6 development branch
- 'nightly' # currently points to 3.7-dev
- 'pypy'
- 'pypy3.3-5.2-alpha1'

matrix:
fast_finish: true
allow_failures:
- python: '3.5-dev' # 3.5 development branch
- python: '3.6-dev' # 3.6 development branch
- python: 'nightly'
- python: 'pypy'
- python: 'pypy3.3-5.2-alpha1'

cache: pip
notifications:
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
.. _`Github`: https://github.com/GetStream/stream-python
'''

requests = 'requests>=2.3.0,<3'

if sys.version_info < (2, 7, 9):
requests = 'requests[security]>=2.4.1,<3'

install_requires = [
'pyjwt==1.3.0',
'requests>=2.2.1',
requests,
'six>=1.8.0',
'httpsig==1.1.2'
]


class PyTest(TestCommand):

def finalize_options(self):
Expand Down
2 changes: 1 addition & 1 deletion stream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def connect(api_key=None, api_secret=None, app_id=None, version='v1.0',
result = pattern.match(stream_url)
if result and len(result.groups()) == 4:
api_key, api_secret, location, app_id = result.groups()
location = None if location == 'getstream' else location
location = None if location in ('getstream', 'stream-io-api') else location
else:
raise ValueError('Invalid api key or heroku url')

Expand Down
6 changes: 3 additions & 3 deletions stream/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class StreamClient(object):
base_url = 'https://api.getstream.io/api/'
base_url = 'https://api.stream-io-api.com/api/'

def __init__(self, api_key, api_secret, app_id, version='v1.0', timeout=6.0, base_url=None, location=None):
'''
Expand Down Expand Up @@ -57,9 +57,9 @@ def __init__(self, api_key, api_secret, app_id, version='v1.0', timeout=6.0, bas
elif base_url is not None:
self.base_url = base_url
elif location is not None:
self.base_url = 'https://%s-api.getstream.io/api/' % location
self.base_url = 'https://%s-api.stream-io-api.com/api/' % location

self.base_analytics_url = 'https://analytics.getstream.io/analytics/'
self.base_analytics_url = 'https://analytics.stream-io-api.com/analytics/'

self.session = requests.Session()
# TODO: turn this back on after we verify it doesnt retry on slower requests
Expand Down
28 changes: 22 additions & 6 deletions stream/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def connect_debug():
secret,
location='us-east',
timeout=30,
base_url='http://qa-api.getstream.io/api/',
base_url='https://qa.stream-io-api.com/api/',
# base_url='http://localhost-api.getstream.io:8000/api/',
)

Expand Down Expand Up @@ -174,7 +174,7 @@ def test_heroku(self):
self.assertEqual(client.app_id, '1')

def test_heroku_no_location(self):
url = 'https://bvt88g4kvc63:twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd@getstream.io/?app_id=669'
url = 'https://bvt88g4kvc63:twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd@stream-io-api.com/?app_id=669'
os.environ['STREAM_URL'] = url
client = stream.connect()
self.assertEqual(client.api_key, 'bvt88g4kvc63')
Expand All @@ -187,9 +187,9 @@ def test_heroku_no_location(self):
client.base_url, 'http://localhost:8000/api/')
else:
self.assertEqual(
client.base_url, 'https://api.getstream.io/api/')
client.base_url, 'https://api.stream-io-api.com/api/')

def test_heroku_location(self):
def test_heroku_location_compat(self):
url = 'https://ahj2ndz7gsan:gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy@us-east.getstream.io/?app_id=1'
os.environ['STREAM_URL'] = url
client = stream.connect()
Expand All @@ -202,7 +202,23 @@ def test_heroku_location(self):
client.base_url, 'http://localhost:8000/api/')
else:
self.assertEqual(
client.base_url, 'https://us-east-api.getstream.io/api/')
client.base_url, 'https://us-east-api.stream-io-api.com/api/')
self.assertEqual(client.app_id, '1')

def test_heroku_location(self):
url = 'https://ahj2ndz7gsan:gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy@us-east.stream-io-api.com/?app_id=1'
os.environ['STREAM_URL'] = url
client = stream.connect()
self.assertEqual(client.api_key, 'ahj2ndz7gsan')
self.assertEqual(
client.api_secret, 'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy')

if self.local_tests:
self.assertEqual(
client.base_url, 'http://localhost:8000/api/')
else:
self.assertEqual(
client.base_url, 'https://us-east-api.stream-io-api.com/api/')
self.assertEqual(client.app_id, '1')

def test_heroku_overwrite(self):
Expand All @@ -216,7 +232,7 @@ def test_heroku_overwrite(self):
def test_location_support(self):
client = stream.connect('a', 'b', 'c', location='us-east')

full_location = 'https://us-east-api.getstream.io/api/'
full_location = 'https://us-east-api.stream-io-api.com/api/'
if self.local_tests:
full_location = 'http://localhost:8000/api/'

Expand Down