API Refuse connection to localhost

I added this code inside sales_invoices.py and when I test it gives me this error

@frappe.whitelist()
def getERPNextInvoice(url): 
	header = dict()
	header['Authorization'] =  '<MY ACCESS TOKEN>'
	# header['Cookie'] =  'full_name=Guest; sid=Guest; system_user=yes; user_id=Guest; user_image='
	url = http://localhost:8080/api/resource/Sales%20Invoice/ACC-SINV-2021-00005
	response = requests.request("GET", url, headers=header, verify=False)
	return response.json()
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /api/resource/Sales%20Invoice/ACC-SINV-2021-00005 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f84c7063208>: Failed to establish a new connection: [Errno 111] Connection refused',))