Skip to content

Instantly share code, notes, and snippets.

@jeremiahmarks
Created December 14, 2014 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremiahmarks/dcf33161deb50f48ca9f to your computer and use it in GitHub Desktop.
Save jeremiahmarks/dcf33161deb50f48ca9f to your computer and use it in GitHub Desktop.
GetAllContactsThatHaveCCData
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