Skip to content

Commit

Permalink
adding refresh_rate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathon Morgan committed Mar 9, 2016
1 parent 9f88228 commit cc095d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions popily_api/__init__.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -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',
Expand Down
18 changes: 10 additions & 8 deletions tests.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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']}],
Expand All @@ -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']}],
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit cc095d9

Please sign in to comment.