# Netlas.io Python SDK
This repository contains Netlas.io Python SDK package with CLI Tool.
**Netlas Python SDK**
The __Netlas Python SDK__ is a software development kit provided by the Netlas team to facilitate the integration of Netlas services into Python applications. The SDK provides a convenient way to interact with the API, performing tasks such as queries, routing and parsing the JSON responses from the Netlas API into Python objects, simplifying the process of integrating Netlas data into Python projects.
**Netlas CLI Tool**
To access Netlas using the command line interface, the Netlas team has developed the __Netlas CLI Tool__. With it, you can use Netlas just like any other command line application.
## Installation
Use the Python package installer to install the SDK and CLI Tool:
``` bash
pip install netlas
```
Or if you already have it installed and want to upgrade to the latest version:
``` bash
pip install --upgrade netlas
```
If you only need the CLI tool (without the SDK), use the Homebrew package manager:
``` bash
brew tap netlas-io/netlas
brew install netlas
```
To update homebrew installation to the latest version:
``` bash
brew update
brew upgrade netlas
```
## Checking the installation
Now you can interact with the Netlas platform using command line. Try to get information about your external IP address:
``` bash
netlas host -a "YOUR_API_KEY"
```
❓ [Where to find API key →](https://docs.netlas.io/faq/#api-key)
## Setting up API Key
There are two ways of API key usage when you work with Netlas CLI (command line interface). The first way is to enter the key each time you enter a command with the `-a` option. Another way is to save the key using `savekey` command.
``` bash
netlas savekey "YOUR_API_KEY"
```
## CLI Usage
Please refer to the built-in help for command and option information. To show help page:
```` bash
netlas --help
````
``` { class="no-copy" }
Usage: netlas [OPTIONS] COMMAND [ARGS]...
Options:
-h, --help Show this message and exit.
Commands:
count Calculate count of query results.
datastore Manage products in the datastore.
download Download data.
host Host (ip or domain) information.
indices Get available data indices.
profile Get user profile data.
savekey Save API key to the local system.
search (query) Search query.
stat Get statistics for query.
```
To view specific command help use `--help` key with `netlas command`, e.g.:
```` bash
netlas count --help
````
``` { class="no-copy" }
Usage: netlas count [OPTIONS] QUERYSTRING
Calculate count of query results.
Options:
-d, --datatype [response|cert|domain|whois-ip|whois-domain]
Query data type [default: response]
-a, --apikey TEXT User API key (can be saved to system using
command `netlas savekey`)
-f, --format [json|yaml] Output format [default: yaml]
--server TEXT Netlas API server [default:
https://app.netlas.io]
--indices TEXT Specify comma-separated data index
collections
-h, --help Show this message and exit.
```
Here are a few examples of CLI usage:
- Equivalent to [https://app.netlas.io/host/1.1.1.1/](https://app.netlas.io/host/1.1.1.1/)
``` bash
netlas host "1.1.1.1"
```
- Equivalent to [https://app.netlas.io/responses/?q=host%3A1.1.1.1](https://app.netlas.io/responses/?q=host%3A1.1.1.1)
``` bash
netlas search "host:1.1.1.1"
```
- Equivalent to [https://app.netlas.io/domains/?q=domain%3A%2A.netlas.io](https://app.netlas.io/domains/?q=domain%3A%2A.netlas.io)
``` bash
netlas search --datatype domain "domain:*.netlas.io"
```
You can find more bash examples on the [Netlas Docs →](https://docs.netlas.io/api-reference/).
## Python SDK Usage
The following code sample routes the request `port:7001` to the Netlas response search and prints search results to stdout.
``` python
import netlas
# you can access saved API key using this helper
apikey = netlas.helpers.get_api_key()
# create new connection to Netlas
netlas_connection = netlas.Netlas(api_key=apikey)
# retrieve data from responses by query `port:7001`
netlas_query = netlas_connection.query(query="port:7001")
# iterate over data and print: IP address, port, path and protocol
for response in netlas_query['items']:
print(f"{response['data']['ip']}:{response['data']['port']}{response['data']['path']} [{response['data']['protocol']}]")
pass
```
Please keep in mind that the example is simplified. When developing automation, it is necessary at least to provide procedures for exception handling. And it is also necessary to take into account that the API key may not be saved.
You can find more Python examples on the [Netlas Docs →](https://docs.netlas.io/api-reference/).
Raw data
{
"_id": null,
"home_page": "https://github.com/netlas-io/netlas-python",
"name": "netlas",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "security, network",
"author": "Netlas Team",
"author_email": "support@netlas.io",
"download_url": "https://files.pythonhosted.org/packages/42/77/f25793a2e1f2e38c47d5fddeb9e5422f1ebc7f81b3de33d5b9369754247b/netlas-0.7.3.tar.gz",
"platform": null,
"description": "# Netlas.io Python SDK\n\nThis repository contains Netlas.io Python SDK package with CLI Tool.\n\n**Netlas Python SDK**\n\nThe __Netlas Python SDK__ is a software development kit provided by the Netlas team to facilitate the integration of Netlas services into Python applications. The SDK provides a convenient way to interact with the API, performing tasks such as queries, routing and parsing the JSON responses from the Netlas API into Python objects, simplifying the process of integrating Netlas data into Python projects.\n\n**Netlas CLI Tool**\n\nTo access Netlas using the command line interface, the Netlas team has developed the __Netlas CLI Tool__. With it, you can use Netlas just like any other command line application.\n\n## Installation\n\nUse the Python package installer to install the SDK and CLI Tool:\n\n``` bash\npip install netlas\n```\n\nOr if you already have it installed and want to upgrade to the latest version:\n\n``` bash\npip install --upgrade netlas\n```\n\nIf you only need the CLI tool (without the SDK), use the Homebrew package manager:\n\n``` bash\nbrew tap netlas-io/netlas \nbrew install netlas\n```\n\nTo update homebrew installation to the latest version:\n\n``` bash\nbrew update \nbrew upgrade netlas\n```\n\n## Checking the installation\n\nNow you can interact with the Netlas platform using command line. Try to get information about your external IP address:\n\n``` bash\nnetlas host -a \"YOUR_API_KEY\"\n```\n\n\u2753 [Where to find API key →](https://docs.netlas.io/faq/#api-key)\n\n## Setting up API Key\n\nThere are two ways of API key usage when you work with Netlas CLI (command line interface). The first way is to enter the key each time you enter a command with the `-a` option. Another way is to save the key using `savekey` command.\n\n``` bash\nnetlas savekey \"YOUR_API_KEY\"\n```\n\n## CLI Usage\n\nPlease refer to the built-in help for command and option information. To show help page:\n\n```` bash\nnetlas --help\n````\n``` { class=\"no-copy\" }\nUsage: netlas [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n -h, --help Show this message and exit.\n\nCommands:\n count Calculate count of query results.\n datastore Manage products in the datastore.\n download Download data.\n host Host (ip or domain) information.\n indices Get available data indices.\n profile Get user profile data.\n savekey Save API key to the local system.\n search (query) Search query.\n stat Get statistics for query.\n```\n\nTo view specific command help use `--help` key with `netlas command`, e.g.:\n\n```` bash\nnetlas count --help\n````\n``` { class=\"no-copy\" }\nUsage: netlas count [OPTIONS] QUERYSTRING\n\n Calculate count of query results.\n\nOptions:\n -d, --datatype [response|cert|domain|whois-ip|whois-domain]\n Query data type [default: response]\n -a, --apikey TEXT User API key (can be saved to system using\n command `netlas savekey`)\n -f, --format [json|yaml] Output format [default: yaml]\n --server TEXT Netlas API server [default:\n https://app.netlas.io]\n --indices TEXT Specify comma-separated data index\n collections\n -h, --help Show this message and exit.\n```\n\nHere are a few examples of CLI usage:\n\n- Equivalent to [https://app.netlas.io/host/1.1.1.1/](https://app.netlas.io/host/1.1.1.1/)\n ``` bash\n netlas host \"1.1.1.1\"\t\t\t\n ```\n- Equivalent to [https://app.netlas.io/responses/?q=host%3A1.1.1.1](https://app.netlas.io/responses/?q=host%3A1.1.1.1)\n ``` bash\n netlas search \"host:1.1.1.1\"\n ```\n- Equivalent to [https://app.netlas.io/domains/?q=domain%3A%2A.netlas.io](https://app.netlas.io/domains/?q=domain%3A%2A.netlas.io)\n ``` bash\n netlas search --datatype domain \"domain:*.netlas.io\"\n ```\n\nYou can find more bash examples on the [Netlas Docs →](https://docs.netlas.io/api-reference/).\n\n## Python SDK Usage\n\nThe following code sample routes the request `port:7001` to the Netlas response search and prints search results to stdout.\n\n``` python\nimport netlas\n\n# you can access saved API key using this helper\napikey = netlas.helpers.get_api_key()\n\n# create new connection to Netlas\nnetlas_connection = netlas.Netlas(api_key=apikey)\n\n# retrieve data from responses by query `port:7001`\nnetlas_query = netlas_connection.query(query=\"port:7001\")\n\n# iterate over data and print: IP address, port, path and protocol\nfor response in netlas_query['items']:\n print(f\"{response['data']['ip']}:{response['data']['port']}{response['data']['path']} [{response['data']['protocol']}]\")\npass\n```\n\nPlease keep in mind that the example is simplified. When developing automation, it is necessary at least to provide procedures for exception handling. And it is also necessary to take into account that the API key may not be saved.\n\nYou can find more Python examples on the [Netlas Docs →](https://docs.netlas.io/api-reference/).\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Netlas.io API package",
"version": "0.7.3",
"project_urls": {
"Homepage": "https://github.com/netlas-io/netlas-python"
},
"split_keywords": [
"security",
" network"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "088992f3c1ce4b1ca107e2d7321189b826760f78e93a9e5b088128e3c16d52c8",
"md5": "f8200eb1c3dfd922a4900a19a603c574",
"sha256": "1b4e1652e038255d0b341771b25d779b7bd70cde7de4d180b2d4e0ef323c7c42"
},
"downloads": -1,
"filename": "netlas-0.7.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f8200eb1c3dfd922a4900a19a603c574",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17186,
"upload_time": "2025-11-06T10:53:41",
"upload_time_iso_8601": "2025-11-06T10:53:41.407835Z",
"url": "https://files.pythonhosted.org/packages/08/89/92f3c1ce4b1ca107e2d7321189b826760f78e93a9e5b088128e3c16d52c8/netlas-0.7.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4277f25793a2e1f2e38c47d5fddeb9e5422f1ebc7f81b3de33d5b9369754247b",
"md5": "260552b09b6e71769beed404411f5cac",
"sha256": "e7186d69f713938b2a4776d98ef08e7aa7f15d8c3c12e6a5c0c7f0fc49fdc9b6"
},
"downloads": -1,
"filename": "netlas-0.7.3.tar.gz",
"has_sig": false,
"md5_digest": "260552b09b6e71769beed404411f5cac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 20590,
"upload_time": "2025-11-06T10:53:42",
"upload_time_iso_8601": "2025-11-06T10:53:42.977270Z",
"url": "https://files.pythonhosted.org/packages/42/77/f25793a2e1f2e38c47d5fddeb9e5422f1ebc7f81b3de33d5b9369754247b/netlas-0.7.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-06 10:53:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "netlas-io",
"github_project": "netlas-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "requests",
"specs": [
[
">=",
"2.12.5"
]
]
},
{
"name": "click",
"specs": [
[
">=",
"7.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
">=",
"3.13"
]
]
},
{
"name": "pygments",
"specs": [
[
">=",
"2.5.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "appdirs",
"specs": [
[
">=",
"1.4.3"
]
]
},
{
"name": "rich",
"specs": [
[
">=",
"13.7.1"
]
]
}
],
"lcname": "netlas"
}