# ProtocolError

**URL:** <https://community.hubspot.com/t/protocolerror/98924>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [January 29, 2024, 8:01pm UTC](https://community.hubspot.com/t/protocolerror/98924 "2024-01-29T20:01:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![zach\_threadint](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zach_threadint/32/46318_2.png) [@zach\_threadint](https://community.hubspot.com/u/zach_threadint)\
**Post date:** [January 30, 2024, 10:42pm UTC](https://community.hubspot.com/t/protocolerror/98924/4 "2024-01-30T22:42:33Z")

</div>

Hi @pmoccia 👋

I’m not familiar with the method in which you’re making HTTP requests there. If you haven’t already, you might like to consider using the “requests” module. For example:

```lia-code-sample
import json
import requests

def get_contact_list_by_search(limit, regions):
 url = "https://api.hubapi.com/crm/v3/objects/contacts/search"
 headers = {
 "Content-Type": "application/json",
 "Authorization": f"Bearer {husbpot_token}"
 }
 filters = [
 {
 "values": [1,2,3],
 "propertyName": "autodialer_status",
 "operator": "IN"
 }
 ]
 # Only use the filter if regions array has entries
 if len(regions) != 0:
 filters.append({"values": regions,"propertyName": "region","operator": "IN"})
 payload = {
 "filterGroups": [
 {
 "filters": filters
 }
 ],
 "limit": limit,
 "properties":["id","firstname","lastname","email","phone","lead_source", "region","autodialer_status"],
 "sorts": ["autodialer_status"]
 }
 response = requests.request("POST", url, headers=headers, data=json.dumps(payload).encode("UTF-8"))
 return response.text

print(get_contact_list_by_search(100, []))

```

Would you mind trying that to see if you’re still getting the same connection error?

I hope this proves useful. Please let me know if you have any follow-up questions.

---

_[View the full topic](https://community.hubspot.com/t/protocolerror/98924)._
