0

I have a script which loops through a dataframe containing 110 rows. For each row, it creates a dictionary of data then I send a POST request via the Pipedrive API. After 57 successful POSTs, the script seems to be hung but hasnt failed. Any idea whats going on?

gist of my code:

token = {'api_token' : 'xxx'}

for i, row in df.iterrows():
    post_data = {"name" : row['name']}

    # API url and post request
    post_url = "https://madeupcompany.pipedrive.com/api/v1/persons"
    post_response = requests.post(post_url, params=token, json=post_data)

    # response from API.. post_content['success'] = TRUE if posted successfully
    post_content = json.loads(post_response.content)
    print('Success: ', post_content['success'])
  • Do you know what line it hangs on? – Nick ODell Sep 02 '21 at 02:34
  • @NickODell I'm not sure but im guessing the "post_response = " line – obi_wan_jabroni Sep 02 '21 at 02:42
  • Do you do any checks on what's being put into your dictionary to send to the API? APIs can hang on escape sequences, EOL/EOF indicators, etc. (It thinks it's done.) Check your response code in post_response. – garlic_rat Sep 02 '21 at 03:00
  • @garlic_rat, i checked and theres nothing out of the ordinary in the dictionary. The same record that cause the script to hang in one run, will post successfully in the next. – obi_wan_jabroni Sep 03 '21 at 02:08
  • @obi_wan_jabroni, check whether your api calls are being rate limited. See https://pipedrive.readme.io/docs/core-api-concepts-rate-limiting That would be symptomatic of a hang without error (which would hang at the point you were already looking at.) – garlic_rat Sep 03 '21 at 03:55

0 Answers0