Netlas Python SDK Specification
Below is documentation on the main classes and their methods included in Netlas SDK.
Netlas
__init__(api_key='', apibase='https://app.netlas.io', debug=False)
Netlas class constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
Personal API key |
''
|
apibase |
str
|
Netlas API server address |
'https://app.netlas.io'
|
debug |
bool
|
Debug flag |
False
|
count(query, datatype='response', indices='')
Calculate total count of query string results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Search query string |
required |
datatype |
str
|
Data type (choises: response, cert, domain, whois-ip, whois-domain) |
'response'
|
indices |
str
|
Comma-separated IDs of selected data indices (can be retrieved by |
''
|
Returns:
Type | Description |
---|---|
dict
|
JSON object with total count of query string results |
datasets()
Get available datasets
Returns:
Type | Description |
---|---|
list
|
List of available datasets with full information |
download(query, fields=None, exclude_fields=False, datatype='response', size=10, indices='')
Download data from Netlas
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Search query string |
required |
fields |
str
|
Comma-separated list of fields to include/exclude |
None
|
exclude_fields |
bool
|
Exclude fields from output (instead include) |
False
|
datatype |
str
|
Data type (choices: response, cert, domain, whois-ip, whois-domain) |
'response'
|
size |
int
|
Download documents count |
10
|
indices |
str
|
Comma-separated IDs of selected data indices (can be retrieved by |
''
|
Returns:
Type | Description |
---|---|
bytes
|
Iterator of raw data |
download_all(query, fields=None, exclude_fields=False, datatype='response', indices='')
Download all available data for given query
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Search query string |
required |
fields |
str
|
Comma-separated list of fields to include/exclude |
None
|
exclude_fields |
bool
|
Exclude fields from output (instead include) |
False
|
datatype |
str
|
Data type (choices: response, cert, domain, whois-ip, whois-domain) |
'response'
|
indices |
str
|
Comma-separated IDs of selected data indices (can be retrieved by |
''
|
Returns:
Type | Description |
---|---|
bytes
|
Iterator of raw data |
get_dataset_link(id)
Get link of 'id' dataset
Returns:
Type | Description |
---|---|
list
|
JSON-object that contains link and name of dataset |
host(host, fields=None, exclude_fields=False)
Get full information about host (ip or domain)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
IP or domain string |
required |
fields |
str
|
Comma-separated output fields. If empty it will output all data |
None
|
Returns:
Type | Description |
---|---|
dict
|
JSON object with full information about host |
indices()
Get available data indices
Returns:
Type | Description |
---|---|
list
|
List of available indices |
profile()
Get user profile data
Returns:
Type | Description |
---|---|
dict
|
JSON object with user profile data |
search(query, datatype='response', page=0, indices='', fields=None, exclude_fields=False)
Send search query to Netlas API
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Search query string |
required |
datatype |
str
|
Data type (choises: response, cert, domain, whois-ip, whois-domain) |
'response'
|
page |
int
|
Page number of data |
0
|
indices |
str
|
Comma-separated IDs of selected data indices (can be retrieved by |
''
|
fields |
str
|
Comma-separated list of fields to include/exclude |
None
|
exclude_fields |
bool
|
Exclude fields from output (instead include) |
False
|
Returns:
Type | Description |
---|---|
dict
|
search query result |
stat(query, group_fields, indices='', size=100, index_type='responses')
Get statistics of responses query string results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Search query string |
required |
group_fields |
str
|
Comma-separated fields using for aggregate data |
required |
indices |
str
|
Comma-separated IDs of selected data indices (can be retrieved by |
''
|
size |
int
|
Aggregation size |
100
|
index_type |
str
|
Index type (choises: responses, certificates, domains) |
'responses'
|
Returns:
Type | Description |
---|---|
dict
|
JSON object with statistics of responses query string results |
APIError
Bases: Exception
Basic Netlas.io Exception class