# Connection reset by Peer

**URL:** <https://community.hubspot.com/t/connection-reset-by-peer/126469>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [February 20, 2025, 2:08pm UTC](https://community.hubspot.com/t/connection-reset-by-peer/126469 "2025-02-20T14:08:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidM3](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@DavidM3](https://community.hubspot.com/u/DavidM3)\
**Post date:** [February 20, 2025, 2:08pm UTC](https://community.hubspot.com/t/connection-reset-by-peer/126469/1 "2025-02-20T14:08:24Z")

</div>

I had opened a ticket about this issue and the support told me to post on this forum.  
We’ve been having an issue in one of our development environment, and it is not possible to reproduce it locally  
Below is the issue

HTTPSConnectionPool(host=‘[api.hubapi.com](http://api.hubapi.com)’, port=443): Max retries exceeded with url: /oauth/v1/access-tokens/[REDACTED] (Caused by ProtocolError(‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)))

And we are using the official python library  
Here is a sample code causing the issue  
We added a retry policy as suggested by another post

```lia-code-sample
from hubspot import Hubspot

hubspot_client = HubSpot(access_token=access_token)
raw_token_info= hubspot_client.oauth.access_tokens_api.get(
 token=self.hubspot_client.access_token,
 _request_timeout=(5, 10),
 )

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [February 21, 2025, 3:45pm UTC](https://community.hubspot.com/t/connection-reset-by-peer/126469/2 "2025-02-21T15:45:43Z")

</div>

Hi, @DavidM3 👋 Thanks for your post! Please note that the Developer Support Community is peer-to-peer based, and all replies are from our community members.

Have you tried using the `requests` library directly? As shown by [@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811) in this [**post**](https://community.hubspot.com/t5/APIs-Integrations/ProtocolError/m-p/914368/highlight/true#M70714)? I feel like I’ve seen @SteveHTM offer similar suggestions as well.

Other thoughts:

- have you tried adding an exponential backoff in your retry strategy?
- Can you check if this occurs during high-volume API requests that might trigger a rate limit?
- Have you set up monitoring for network stability when connecting to [api.hubspot.com](http://api.hubspot.com)?

Talk soon! — Jaycee

---

<div class="post-metadata">

**Author:** ![DavidM3](https://avatars.discourse-cdn.com/v4/letter/d/ce73a5/32.png) [@DavidM3](https://community.hubspot.com/u/DavidM3)\
**Post date:** [March 19, 2025, 3:48pm UTC](https://community.hubspot.com/t/connection-reset-by-peer/126469/3 "2025-03-19T15:48:36Z")

</div>

Thanks for your reply, we finally used requests directly. It seems the policy of the official hubspot python to get the token is a little off
