APIs & Integrations

GrahamQC
Participant

Is my IP address causing a very slow API response?

SOLVE

When I run a python script to collect Deals data through the HubSpot API it is consistently taking 8 minutes and 48 seconds to get a responses from a request that iterates over 5 pages. This happens when I run the script through VS Code and from Windows command prompt.

 

If I paste the request url in to a browser the response is instant. One of our developers tested my script on VS Code and it took him 4 seconds. I tried the script through Google Collab and it took 4 seconds. Lastly, I turned off my (very good) wifi and connected via a mobile data hotspot and the response was 4 seconds. Which is why I am suspecting something at the API end doesn't like my IP address?

 

I am well within all the api limits and I can't see anything in your documentation that would suggest why my response times appear to be getting throttled. Does anyone have any suggestions?

0 Upvotes
1 Accepted solution
taran42
Solution
Contributor

Is my IP address causing a very slow API response?

SOLVE

@dennisedson Upper echelon begginer. 😄

 

@GrahamQC I don't think your IP addres, per say, is causing the issue. It sounds more like a routing problem. When the problem happens again, you could run a trace route and see where all your connection goes. It might be getting hung up somewhere.  You system administrator would know more here. It's also possible that there's something else on the system interfering with your connection.

 

If the script works fine for others and even for yourself on occassion, then it's nothing to do with your code.

View solution in original post

taran42
Solution
Contributor

Is my IP address causing a very slow API response?

SOLVE

@dennisedson Upper echelon begginer. 😄

 

@GrahamQC I don't think your IP addres, per say, is causing the issue. It sounds more like a routing problem. When the problem happens again, you could run a trace route and see where all your connection goes. It might be getting hung up somewhere.  You system administrator would know more here. It's also possible that there's something else on the system interfering with your connection.

 

If the script works fine for others and even for yourself on occassion, then it's nothing to do with your code.

GrahamQC
Participant

Is my IP address causing a very slow API response?

SOLVE

Hi @taran42 your suggestion of the trace route was very helpful thank you. Apologies for what is probably something really basic that I didn't know to try. It looks like my laptop was failing to connect via IPv6 for some reason which was causing delays. This allowed me to confirm it was a laptop issue rather than a router, ISP, or API issue.

Coincidentally I have finally reached the top of the laptop replacement list and my new machine connects via IPv6 without issue. This also means that my python scripts are currently working instantly again - fingers crossed!

taran42
Contributor

Is my IP address causing a very slow API response?

SOLVE

I wouldn't say that's something basic as it has nothing to do with Python, Hubspot or the API; it's IT-related and you knew enough to think it might be your connection, which lead me to think of trace route (I spent many years as a systems/network administrator).

 

I'm glad to hear you got your issue fixed! Well done!

GrahamQC
Participant

Is my IP address causing a very slow API response?

SOLVE

Hi @dennisedson , thanks for following up. Yes I am still experiencing this. Interestingly it seems to be intermittent. On Tuesday and Wednesday my scripts worked instantly, but again this morning they have reverted to running really slow at 1 - 2 minutes per request. (Thursday was instant as well but they were made from our office so a different IP address so I've not counted that).

 

I request deals information which iterates through 5 requests for 100 results per page, then a single request for pipeline data and then a final single request for owners data.


I should highlight that I am a python beginner but I don't think I'm doing anything nefarious and I am certain that I am well within your published API calls. I have stopped working on my python scripts so these are the only calls being made to the API.

0 Upvotes
dennisedson
Community Manager
Community Manager

Is my IP address causing a very slow API response?

SOLVE

I should introduce you to @taran42  who also claims to be a python beginner 😜

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes
dennisedson
Community Manager
Community Manager

Is my IP address causing a very slow API response?

SOLVE

@GrahamQC 

Apologies for the delayed response.  Are you still experiencing this issue?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes