Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions domaintools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,23 @@ def whois(self, query, **kwargs):
def whois_history(self, query, **kwargs):
"""Pass in a domain name."""
return self._results('whois-history', '/v1/{0}/whois/history'.format(query), items_path=('history', ), **kwargs)

def phisheye(self, query, days_back=None, **kwargs):
"""Returns domain results for the specified term for today or the specified number of days_back.
Terms must be setup for monitoring via the web interface: https://research.domaintools.com/phisheye.

NOTE: Properties of a domain are only provided if we have been able to obtain them.
Many domains will have incomplete data because that information isn't available in their Whois records,
or they don't have DNS results for a name server or IP address.
"""
return self._results('phisheye', '/v1/phisheye', query=query, days_back=days_back, items_path=('domains', ),
**kwargs)

def phisheye_term_list(self, **kwargs):
"""Provides a list of terms that are set up for this account.
This call is not charged against your API usage limit.

NOTE: The terms must be configured in the PhishEye web interface: https://research.domaintools.com/phisheye.
There is no API call to set up the terms.
"""
return self._results('phisheye_term_list', '/v1/phisheye/term-list', items_path=('terms', ), **kwargs)
2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiohttp==0.22.5
aiohttp==1.0.5
requests==2.11.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
packages = ['domaintools']
if sys.version_info[0] >= 3 and sys.version_info[1] >= 5:
packages.append('domaintools_async')
requires.append('aiohttp')
requires.append('aiohttp==1.0.5')
elif sys.version_info[0] == 2 and sys.version_info[1] <= 6:
requires.extend(['ordereddict', 'argparse'])

Expand Down Expand Up @@ -83,7 +83,7 @@ def run_tests(self):
]
},
packages=packages,
requires=requires,
requires=[package.split('==')[0] for package in requires],
install_requires=requires,
cmdclass=cmdclass,
ext_modules=ext_modules,
Expand Down
5,469 changes: 5,469 additions & 0 deletions tests/fixtures/vcr/test_no_https.yaml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions tests/fixtures/vcr/test_phisheye.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [python-requests/2.11.1]
method: GET
uri: https://api.domaintools.com/v1/phisheye?query=google
response:
body:
string: !!binary |
H4sIAAAAAAAAA6pWKkotLsjPK05VsqpWKkktylWyUkrPz0/PSVXSUUrJz03MzCtWsoqOra0FAAAA
//8DAJ1DiI8rAAAA
headers:
content-encoding: [gzip]
content-type: [application/json;charset=utf-8]
date: ['Tue, 08 Nov 2016 18:36:10 GMT']
vary: [Accept-Encoding]
status: {code: 200, message: OK}
version: 1
22 changes: 22 additions & 0 deletions tests/fixtures/vcr/test_phisheye_term_list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [python-requests/2.11.1]
method: GET
uri: https://api.domaintools.com/v1/phisheye/term-list
response:
body:
string: !!binary |
H4sIAAAAAAAAA6pWKkotLsjPK05VsqpWKkktyi1WsoqGsJSslNLz89NzUpV0lBKTSzLLgGpKikpT
a2NrawEAAAD//wMA2NOrkTgAAAA=
headers:
content-encoding: [gzip]
content-type: [application/json;charset=utf-8]
date: ['Tue, 08 Nov 2016 18:43:33 GMT']
vary: [Accept-Encoding]
status: {code: 200, message: OK}
version: 1
18 changes: 18 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,21 @@ def test_formats():
assert '<' in str(data.xml)
assert '<title>' in str(data.html)
assert '\n' in str(data.as_list())


@vcr.use_cassette
def test_phisheye():
with api.phisheye('google') as data:
assert data['term'] == 'google'
for result in data:
assert result['domain']
assert result['tld']


@vcr.use_cassette
def test_phisheye_term_list():
with api.phisheye_term_list() as data:
assert data
for term in data:
assert 'term' in term
assert type(term['active']) == bool