How to use the investigate.investigate.Investigate function in investigate

To help you get started, we’ve selected a few investigate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opendns / pyinvestigate / investigate / investigate.py View on Github external
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
        )
github opendns / pyinvestigate / investigate / investigate.py View on Github external
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)