Esempio n. 1
0
 def get_ips(self, ips_id, uri):
     ips_url = api.get_resource_url(ID=ips_id, API=self.API)
     ips_url = uri + ips_url
     kwargs = {'headers': {}}
     kwargs['timeout'] = self.timeout
     content_type = 'application/json;charset=utf-8'
     kwargs['headers']['Content-Type'] = content_type
     http = requests.Session()
     resp = http.request('GET', ips_url, **kwargs).json()
     if resp.get('result') == False:
         raise Exception(resp.get('errmsg', 'unknown error'))
     return resp['ips']
Esempio n. 2
0
 def get_ips(self, ips_id, uri):
     ips_url = api.get_resource_url(ID=ips_id, API=self.API)
     ips_url = uri + ips_url
     kwargs = {'headers': {}}
     kwargs['timeout'] = self.timeout
     content_type = 'application/json;charset=utf-8'
     kwargs['headers']['Content-Type'] = content_type
     http = requests.Session()
     resp = http.request('GET', ips_url, **kwargs).json()
     if resp.get('result') == False:
         raise Exception(resp.get('errmsg', 'unknown error'))
     return resp['ips']
Esempio n. 3
0
 def get_virus_by_id(self, virus_id, uri):
     virus_url = api.get_resource_url(ID=virus_id, API=self.API + '/')
     virus_url = uri + virus_url
     kwargs = {'headers': {}}
     kwargs['timeout'] = self.timeout
     content_type = 'application/json;charset=utf-8'
     kwargs['headers']['Content-Type'] = content_type
     https = requests.Session()
     https.verify = False
     resp = https.request('GET', virus_url, **kwargs).json()
     if resp.get('result') == False:
         raise Exception(resp.get('errmsg', 'unknown error'))
     return resp['virus']
Esempio n. 4
0
 def get_virus_by_id(self, virus_id, uri):
     virus_url = api.get_resource_url(ID=virus_id, API=self.API + '/')
     virus_url = uri + virus_url
     kwargs = {'headers': {}}
     kwargs['timeout'] = self.timeout
     content_type = 'application/json;charset=utf-8'
     kwargs['headers']['Content-Type'] = content_type
     https = requests.Session()
     https.verify = False
     resp = https.request('GET', virus_url, **kwargs).json()
     if resp.get('result') == False:
         raise Exception(resp.get('errmsg', 'unknown error'))
     return resp['virus']