Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def post(self, uri, params={}, data={}):
'''A generic method to make POST requests to the OpenDNS Investigate API
on the given URI.
'''
return self._session.post(
urljoin(Investigate.BASE_URL, uri),
params=self.params_with_utm_source(params) if self._utm_source else params,
data=data,
headers=self._auth_header,
proxies=self.proxies
)
params['start'] = int(time.mktime(start.timetuple()) * 1000)
elif isinstance(start, int) and (datetime.datetime.now()-datetime.datetime.fromtimestamp(start/1000)).days < 30:
params['start'] = int(start)
else:
raise Investigate.SEARCH_ERR
if stop is None:
stop = datetime.datetime.now()
if isinstance(stop, datetime.timedelta):
params['stop'] = int(time.mktime((datetime.datetime.utcnow() - stop).timetuple()) * 1000)
elif isinstance(stop, datetime.datetime):
params['stop'] = int(time.mktime(stop.timetuple()) * 1000)
elif isinstance(stop, int) and (datetime.datetime.now() - datetime.datetime.fromtimestamp(stop/1000)).days < 30:
params['stop'] = int(stop)
else:
raise Investigate.SEARCH_ERR
if match is not None and match in ('all' or 'component' or 'exact'):
params['match'] = match
uri = self._uris['domain_volume'].format(domain)
return self.get_parse(uri, params)