Exemple #1
0
# vs

headers = {'Content-Type': 'application/json'}
auth_info = dict(dsCredentials=dict(
    userName=username, password=password, tenantName=tenant))
auth_info_json = json.dumps(auth_info)
response = requests.post(
    url='https://app.deepsecurity.trendmicro.com/rest/authentication/login',
    data=auth_info_json,
    headers=headers,
    verify=False)
print(response.content)

type(dsm)

api_version = dsm.get_api_version()
type(api_version)

api_version == 99

type(api_version == 99)

# variables vs objects
a = 9
b = a
a = 10
print('b = %d' % b)

david = Person(first_name='David',
               last_name='Girard',
               favorite_product='DD',
* Simple to use for folks with litte or now programmig experience

Installation
pip install -i https://testpypi.python.org/pypi dsp3
'''
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))


from sejam_python_bootcamp import config
from dsp3.models.manager import Manager       #step one import base Manager class

dsm = Manager(username=config.DSAS_USER, password=config.DSAS_PASSWORD, tenant=config.DSAS_TENANT)

#lets check the api version
print(dsm.get_api_version())


#lets get Malware events over last 24 hours
events = dsm.antimalware_event_retreive(time_type="LAST_7_DAYS")

if events['antiMalwareEvents']:
	for event in events['antiMalwareEvents'][0]:
		print('Malware name:', event['malwareName'])    



#make sure to end connections as they are limited.	
dsm.end_session()