Skip to content

Commit

Permalink
FIX Issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
daamien committed Mar 28, 2015
1 parent a16c089 commit 0e0eea9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion mailchimpfdw/__init__.py
Expand Up @@ -3,6 +3,7 @@
"""

from multicorn import ForeignDataWrapper
from multicorn.utils import log_to_postgres
import mailchimp


Expand All @@ -24,6 +25,9 @@ def __init__(self,options,columns):
self.list_id = the_list['data'][0]['id']

self.columns=columns

# DEBUG
#log_to_postgres("Mailchimp FDW loaded : %s" % __file__)


def execute(self, quals, columns):
Expand All @@ -34,7 +38,9 @@ def execute(self, quals, columns):
# Fetch the members, page by page
while start_page * self.page_size <= total :
filters = {'start' : start_page, 'limit': self.page_size}
page=self.chimp.lists.members(self.list_id,'',filters)['data']
page =self.chimp.lists.members(self.list_id,'subscribed',filters)['data']
page+=self.chimp.lists.members(self.list_id,'cleaned',filters)['data']
page+=self.chimp.lists.members(self.list_id,'unsubscribed',filters)['data']
for member in page:
line = {}
for column_name in self.columns:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -2,7 +2,7 @@

setup(
name='mailchimpfdw',
version='0.1.0',
version='0.2.0',
author='Damien Clochard',
license='Postgresql',
packages=['mailchimpfdw']
Expand Down

0 comments on commit 0e0eea9

Please sign in to comment.