Max retries exceeded with url: XXX NewConnectionError Failed to establish a new connection

Hi, I am getting the following error in my application to get data from a list of company numbers. Anyone knows how to solve this?

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.companieshouse.gov.uk', port=443): Max retries exceeded with url: 
/officers/8d_bnTiwfxh8JIr3YfuwkmkWkCg/appointments?items_per_page=50&start_index=76450 
(Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fd44506b6d8>: 
Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

Thanks

If has just started (from Thursday morning about 10am) check you aren’t communicating with TLS 1.0 - it was disabled last week. I got caught out and had to fix it.

Thanks!
I solved this by decorating my function with a backoff logic.

import requests
from requests import ConnectionError
from ratelimit import limits, sleep_and_retry
from backoff import on_exception, expo

FIVE_MINUTES = 300  # Number of seconds in five minutes.


@sleep_and_retry  # if we exceed the ratelimit imposed by @limits forces sleep until we can start again.
@on_exception(expo, ConnectionError, max_tries=10)
@limits(calls=500, period=FIVE_MINUTES)
def call_api(url, api_key):
	r = requests.get(url, auth=(api_key, ""))

	if not (r.status_code == 200 or r.status_code == 404):
		r.raise_for_status()

	elif r.status_code == 404:
		return dict({"error": "not found"})

	else:
		return r.json()