I have created a function with http trigger. Inside function, i have written python code which hits rest api and return json data as response.
request_headers = {"Authorization":"Api-Token {}".format(api_token)}
url = "https://<<host>>/e/54d139b9-23ee-466d-ad7a-f98e0bd8bdf4/{}?includeData=true&aggregationType=COUNT&relativeTime={}&entity={}".format(api_endpoint,relativeTime,entity)
response = requests.get(url, headers = request_headers)
return func.HttpResponse(json.dumps(response.json()))
It is running successfully in local.However the same code from function app giving below error
HTTPSConnectionPool(host='<<host>>', port=443): Max retries exceeded with url: /e/54d139b9-23ee-466d-ad7a-f98e0bd8bdf4/<<api_endpoint>>?includeData=true&aggregationType=COUNT&relativeTime=6hours&entity=<<entity>> (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fbe44681ac0>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))
Can anyone help with this error?