Created
December 14, 2014 23:24
-
-
Save jeremiahmarks/dcf33161deb50f48ca9f to your computer and use it in GitHub Desktop.
GetAllContactsThatHaveCCData
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getContactsWithCards(self): | |
records=[] | |
p=0 | |
while True: | |
listOfDicts = self.connection.DataService.query(self.infusionsoftAPIKey, 'CreditCard', 1000,p,{},['Id', 'ContactId', 'Email','FirstName', 'LastName', 'Last4'], 'Id', True) | |
for each in listOfDicts: | |
interestingData=["Id", 'ContactId', 'Email','FirstName', 'LastName', 'Last4'] | |
for eachbit in interestingData: | |
if not each.has_key(eachbit): | |
each[eachbit]=None | |
records.append(ContactWithCreditCard(each['ContactId'], each['FirstName'], each['LastName'], each['Email'], each['Id'], each['Last4'])) | |
if not(len(listOfDicts)==1000): | |
break | |
p+=1 | |
return records |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment