I am trying to set up antimalware email customization on trend v12 DSM SAAS and was trying the API calls example for python given below. https://automation.deepsecurity.trendmicro.com/article/dsaas/send-request?platform=dsaas
However i am not able to establish connection and was running into connection issues and getting below error.
2019-11-12 10:24:24,653 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /api/policies 2019-11-12 10:24:24,655 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /api/policies 2019-11-12 10:24:24,656 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /api/policies Traceback (most recent call last):
The url ".trendmicro.com" is whitelisted in the proxy that i am using. r = s.get('https://app.deepsecurity.trendmicro.com') also returns 200 code.
There is no option for me to bypass proxy as per the network restriction it is must to send the traffic over proxy.
import deepsecurity as api
from deepsecurity.rest import ApiException as api_exception
import requests
api.Configuration.verify_ssl = False
s = requests.Session()
s.proxies = {
"http": "http://myproxy:80",
"https": "http://myproxy:80",
}
r = s.get('https://app.deepsecurity.trendmicro.com')
def get_policies_list(api, configuration, api_version, api_exception):
""" Gets a list of policies on the Deep Security Manager
:return: A PoliciesApi object that contains a list of policies.
"""
try:
# Create a PoliciesApi object
policies_api = api.PoliciesApi(api.ApiClient(configuration))
print('getting policy api configuration')
# List policies using version v1 of the API
policies_list = policies_api.list_policies(api_version)
print('getting policy list')
# View the list of policies
return policies_list
except api_exception as e:
return "Exception: " + str(e)
if __name__ == '__main__':
# Add Deep Security Manager host information to the api client configuration
print ('first line')
configuration = api.Configuration()
configuration.host = 'https://app.deepsecurity.trendmicro.com/api'
# Authentication
configuration.api_key['api-secret-key'] = 'mysecretkey'
# Version
api_version = 'v1'
print ('executing the api call')
print(get_policies_list(api, configuration, api_version, api_exception))
Is there some other settings that i need to do to establish the connection. Please let me know.