ProtocolError

Hi @pmoccia :waving_hand:

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:

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.