'leadStatus': [],
    'Lead_Status__c': [],
    'Lifecycle_Stage_Person__c': [],
    'unsubscribed': [],
    'MC_Account_Blocked__c': []
}

i = 4157
#all_loser_ids = []
total_count = 0
count = 0
update_leads = ['']
while i < 4700:
    total_count = total_count + count
    count = 0
    token = getToken()
    print(token)

    while count < 100:  #len(ids):

        stop = False
        field_dict = field_dict.fromkeys(field_dict, [])
        final_dict = final_dict.fromkeys(final_dict, [])

        try:
            id1 = json.loads(getLead(base_url, token, ids[i],
                                     field_names))["result"][0]
            appendDict(field_dict, id1)
        except:
            stop = True
コード例 #2
0
file_name = "/home/tyron/Downloads/" + file_name + " " + os.path.basename(
    __file__)
file_name = file_name.replace("py", "txt")

remaining = 0
limit = len(raw_list)

while i < limit:

    time.sleep(
        remaining
    )  # if the remaining time is less than 60 secs then wait for the token to expire before getting a new one

    count = 0
    start = time.time()
    temp = getToken()
    token = temp[0]
    expires = temp[1]
    print(token, expires)
    remaining = expires - (time.time() - start)

    while i < limit and remaining > 60:  #Marketo token expires after 3600secs and give 60 sec window so token does not expire mid execution of the loop below

        field_dict = field_dict.fromkeys(field_dict, [])
        final_dict = final_dict.fromkeys(final_dict, [])

        appendDict(field_dict, raw_list[i])

        j = i + 1
        while j < len(raw_list) and (raw_list[i]['email']
                                     == raw_list[j]['email']):