ptapi.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:ptauto 作者: IntegralDefense 项目源码 文件源码
def whois_search(self, query='', field=''):
        """
        Performs a WHOIS search with the given parameters

        :param query: the search term
        :type str:
        :param field: WHOIS field to execute the search on: domain, email,
                      name, organization, address, phone, nameserver
        :type str:
        :returns dict using json.loads()
        """
        log.debug('Permforming WHOIS search with query: {0} and field: '
                  '{1}'.format(query, field))
        params = {'query': query, 'field': field}
        r = requests.get('https://api.passivetotal.org/v2/whois/search',
                         auth=HTTPBasicAuth(self.username, self.apikey),
                         proxies=self.proxies, params=params)
        if r.status_code == 200:
            results = json.loads(r.text)
            return results
        else:
            log.error('HTTP code {0} returned during WHOIS search '
                      'request.'.format(r.status_code))
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号