From cc095d9b3f3940e831538391697427c35c57bf53 Mon Sep 17 00:00:00 2001 From: Jonathon Morgan Date: Wed, 9 Mar 2016 01:54:05 -0600 Subject: [PATCH] adding refresh_rate --- popily_api/__init__.py | 4 ++-- setup.py | 4 ++-- tests.py | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/popily_api/__init__.py b/popily_api/__init__.py index 9608ade..4a4a1b6 100644 --- a/popily_api/__init__.py +++ b/popily_api/__init__.py @@ -32,7 +32,8 @@ def _assign_editables(self, data_dict, kwargs): 'y_label', 'z_label', 'category_order', - 'time_interval' + 'time_interval', + 'refresh_rate' ] for key in editables: @@ -110,7 +111,6 @@ def get_insights(self, source_id, **kwargs): if key in kwargs: payload[key] = kwargs[key] - print dict(kwargs) payload = self._assign_editables(payload, kwargs) r = requests.get(endpoint, headers=self.auth_header,params=payload) diff --git a/setup.py b/setup.py index 0455c72..60c9004 100644 --- a/setup.py +++ b/setup.py @@ -13,11 +13,11 @@ long_description = 'Official Popily API client' setup(name='popily-api', - version='0.0.7', + version='0.0.8', description='Official Python client for the Popily API', long_description=long_description, url='https://github.com/popily/popily-api', - download_url ='https://github.com/ushahidi/geograpy/tarball/0.0.7', + download_url ='https://github.com/ushahidi/geograpy/tarball/0.0.8', author='Jonathon Morgan', author_email='jonathon@popily.com', license='MIT', diff --git a/tests.py b/tests.py index 9445273..0d68906 100644 --- a/tests.py +++ b/tests.py @@ -2,9 +2,11 @@ from popily_api import * from settings import API_KEY, CONNECTION_STRING +URL = 'https://staging.popily.com' + class APITest(unittest.TestCase): def test_add_source(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) source_data = { 'connection_string': CONNECTION_STRING, @@ -42,27 +44,27 @@ def test_add_source(self): def test_get_sources(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) sources = popily.get_sources() self.assertTrue('results' in sources) self.assertTrue(len(sources['results']) > 0) def test_get_source(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) source = popily.get_source('employees-limit-100-1') self.assertTrue('id' in source) def test_get_insights(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) insights = popily.get_insights('employees-limit-100-1') self.assertTrue('results' in insights) self.assertTrue(len(insights['results']) > 0) def test_get_insights_columns(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) insights = popily.get_insights('employees-limit-100-1',columns=['gender']) all_insights = popily.get_insights('employees-limit-100-1') self.assertTrue('results' in insights) @@ -71,7 +73,7 @@ def test_get_insights_columns(self): def test_get_insights_filters(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) insights = popily.get_insights('employees-limit-100-1', columns=['gender','hire_date'], filters=[{'column':'gender','values': ['F']}], @@ -84,7 +86,7 @@ def test_get_insights_filters(self): def test_get_insights_single(self): - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) insight = popily.get_insights('employees-limit-100-1', columns=['gender','hire_date'], filters=[{'column':'gender','values': ['F']}], @@ -115,7 +117,7 @@ def test_get_insights_single(self): def test_customize_insight(self): import uuid - popily = Popily(API_KEY, url='https://staging.popily.com') + popily = Popily(API_KEY, url=URL) random_title = str(uuid.uuid4().get_hex().upper()[0:6]) insight = popily.get_insights('employees-limit-100-1', columns=['gender','hire_date'],