Hi Am trying to run one script and receiving the following error
A request error occurred: HTTPConnectionPool(host='10.88.64.79', port=8080):nError('<urllib3.connection.HTTPConnection object at 0x7f1d653b65b0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
But when I try to run this request through postman, am getting the output for this url. Not sure why it is not working on the linux server. PFB my code. Could you please any one help me on this issue? Thanks in advance.
import requests
def findip_ip_api(subnet_ip, subnet_mask):
try:
findip_url = "http://x.x.x.x:8080/findip/ip/{}?len={}".format(subnet_ip, subnet_mask)
findip_response = requests.request("GET", findip_url, verify=False)
ip_api_data = findip_response.json()['data']
except requests.exceptions.HTTPError as e:
raise SystemExit("An HTTP error occurred: {}".format(e))
except requests.exceptions.RequestException as e:
raise SystemExit("A request error occurred: {}".format(e))
else:
print(ip_api_data)
findip_ip_api('1.1.1.4','29')
Am trying to get the IP allocation details from the server, so that I could play with them. The response should like following (The below output received from Postman request)
"data": [
{
"address": "x.x.x.x",
"description": "interface \"Vlanxx\" (VRF <vrf name>) standby 75",
"host": "<hostname>",
"isDecommed": 1,
"length": 29
},
],
"metadata": {
"datasize": 55363258,
"lastRefresh": 1702771027,
"lastRefreshTime": "Sat 16 Dec 2023 23:57:07 GMT",
"lastUpdate": 1674721862,
"lastUpdateTime": "Thu 26 Jan 2023 08:31:02 GMT",
"lookup": "1.1.1.4/29",
"recordCount": 720907,
"resultCount": 8
}
}