# Python: unable to request API

**URL:** <https://community.hubspot.com/t/python-unable-to-request-api/57479>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [May 23, 2022, 9:08am UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479 "2022-05-23T09:08:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CGuillo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@CGuillo](https://community.hubspot.com/u/CGuillo)\
**Post date:** [May 23, 2022, 9:08am UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/1 "2022-05-23T09:08:01Z")

</div>

Hi there!

I managed to connect to the API via Python by making a private app on a test account and using the token I got, but I can’t make requests.

When I try to call, for example:

`api_client.crm.contacts.get_all()`

I get an error message

![coneos_0-1681707915436.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/0/a/0a2d8fb18b193d4e87a95ad4820eb3609aa3350a.png)

`MaxRetryError: HTTPSConnectionPool(host='api.hubapi.com', port=443): Max retries exceeded with url: /crm/v3/objects/contacts?limit=100 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))`

**Any idea on what I am doing wrong here?**

Thanks a lot!

![iAluko_1-1709027535425.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/a/a88571ef042eff4c162d6f45add48daad16cfebd.png)

Corentin

---

<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:** [May 23, 2022, 9:34pm UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/2 "2022-05-23T21:34:11Z")

</div>

Hi, @CGuillo👋 Thanks for reaching out. Can you provide any additional details, code snippets, or screenshots to help provide our community with more info, please?

Hey, @taran42 do you have any thoughts on the next steps for @CGuillo? Or suggestions on specific additional info they can provide so the community can better understand the root issue?

Thank you! – Jaycee

---

<div class="post-metadata">

**Author:** ![CGuillo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@CGuillo](https://community.hubspot.com/u/CGuillo)\
**Post date:** [May 24, 2022, 11:16am UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/3 "2022-05-24T11:16:13Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) 🙂 thanks for your answer!

Here is the code and the error. And below is the private app in my app test account. I have tried with a token, I have tried with the API key. I don’t understand how to correct the error ☹

 ![error Python.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/c/cc11a8f9e8621dc50efccfbf77cbe3bcd78aa9e7.jpeg)

 ![private app.JPG](https://d2qpr2jzcazej7.cloudfront.net/original/2X/4/47f9d6b1ec06466df022097c8ef5d1babbc8cd32.jpeg)

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [May 24, 2022, 1:30pm UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/4 "2022-05-24T13:30:17Z")

</div>

It seems like there is a problem with the URL you are trying to reach. According to the error message, the SSL certificate associated with that URL is no longer valid. It looks like the API is calling to that URL, failing because of the invalid SSL, then trying again, failing again for the same reason, and so on until it’s hitting that max limit of 100 calls, then erroring out.

`MaxRetryError: HTTPSConnectionPool(host='api.hubapi.com', port=443): Max retries exceeded with url: /crm/v3/objects/contacts?limit=100 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))`

You’ll need to contact your, or the site’s, administrator and get the SSL certificate resolved first. Then you should be able to make the calls via the API.

---

<div class="post-metadata">

**Author:** ![CGuillo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@CGuillo](https://community.hubspot.com/u/CGuillo)\
**Post date:** [June 20, 2022, 9:11am UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/5 "2022-06-20T09:11:28Z")

</div>

hi @taran42 🙂 Thanks for your answer and sorry for the delay! I felt a bit discouraged and stopped coming.

Well, the people who could have helped in my firm are gone. Nobody knows what to do including me. **Could you explain how to do this safely please?** 🙂

Also, I managed to get a little something (like 10 contacts maybe) by simply writing this in the url bar of my browser: [https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=)…

**I wonder why it works with the browser but not in a jupyter notebook?**

Thanks a lot, have a nice day,

Corentin

---

<div class="post-metadata">

**Author:** ![CGuillo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@CGuillo](https://community.hubspot.com/u/CGuillo)\
**Post date:** [June 20, 2022, 12:00pm UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/6 "2022-06-20T12:00:13Z")

</div>

Hi 🙂

It works with PyCurl so I’ll be using this instead of requests. Just searching how to get more than 20 items per call now 🙂

 ![CGuillo_0-1655726294241.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/e/7ea9feaa0d0d6e36fc928f5296d36a1ed589fe62.png)

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [June 21, 2022, 3:27pm UTC](https://community.hubspot.com/t/python-unable-to-request-api/57479/7 "2022-06-21T15:27:27Z")

</div>

@CGuillo I’m glad you got it working! To you earlier point, yes, you can pull contacts in JSON format via a URL.

Also, if you want to get multiple contacts, try looking at the parameters you have set. Take a look here for more information: [Get All Contacts](https://legacydocs.hubspot.com/docs/methods/contacts/get_contacts)
