# Netlas.io Python SDK
This is a Netlas.io Python package with CLI tool.
Please, refer to the documentation to learn where to get an API key and what technical limits exist.
[Documentation →](https://docs.netlas.io/automation/)
[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)
## Installation
Installation:
```
$ pip install netlas
```
Or if you already have it installed and want to upgrade to the latest version:
```
$ pip install --upgrade netlas
```
## API usage
The following code sample routes the request `port:7001` to the Netlas response search and prints search results to stdout.
```
import netlas
apikey = "YOUR_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
```
## CLI usage
Show global help:
```
user@pc:~$ netlas --help
Usage: netlas [OPTIONS] COMMAND [ARGS]...
Options:
-h, --help Show this message and exit.
Commands:
count Calculate count of query results.
download Download data.
host Host (ip or domain) information.
indices Get available data indices.
profile Get user profile data.
query Search query.
savekey Save API key to the local system.
stat Get statistics for query.
```
Show specific command help:
```
user@pc:~$ netlas query --help
Usage: python -m netlas query [OPTIONS] QUERYSTRING
Search query.
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
-i, --include TEXT Specify comma-separated fields that will be
in the output NOTE: This argument is
mutually exclusive with arguments: [-e,
exclude].
-e, --exclude TEXT Specify comma-separated fields that will be
excluded from the output NOTE: This argument
is mutually exclusive with arguments:
[include, -i].
-p, --page INTEGER Specify data page [default: 0]
-h, --help Show this message and exit.
```
## Bootstraping
You may want to registry your API key.
```
netlas query savekey YOUR_API_KEY
```
netlas as now saved your key, you can now use the CLI as such:
```
netlas query 'THE_QUERY'
```
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/95/ba/49cf980b7ccf1155b9a35e7da4a870d1ef94e74fab1cf1bed7fe6365fd16/netlas-0.5.0.tar.gz",
"platform": null,
"description": "# Netlas.io Python SDK\n\nThis is a Netlas.io Python package with CLI tool.\n\nPlease, refer to the documentation to learn where to get an API key and what technical limits exist.\n\n[Documentation →](https://docs.netlas.io/automation/)\n\n[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)\n\n## Installation\n\nInstallation:\n\n```\n$ pip install netlas\n```\n\nOr if you already have it installed and want to upgrade to the latest version:\n\n```\n$ pip install --upgrade netlas\n```\n\n## API usage\n\nThe following code sample routes the request `port:7001` to the Netlas response search and prints search results to stdout.\n\n```\nimport netlas\n\napikey = \"YOUR_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\n## CLI usage\n\nShow global help:\n```\nuser@pc:~$ netlas --help\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 download Download data.\n host Host (ip or domain) information.\n indices Get available data indices.\n profile Get user profile data.\n query Search query.\n savekey Save API key to the local system.\n stat Get statistics for query.\n```\n\nShow specific command help:\n```\nuser@pc:~$ netlas query --help\nUsage: python -m netlas query [OPTIONS] QUERYSTRING\n\nSearch query.\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-i, --include TEXT Specify comma-separated fields that will be\n in the output NOTE: This argument is\n mutually exclusive with arguments: [-e,\n exclude].\n-e, --exclude TEXT Specify comma-separated fields that will be\n excluded from the output NOTE: This argument\n is mutually exclusive with arguments:\n [include, -i].\n-p, --page INTEGER Specify data page [default: 0]\n-h, --help Show this message and exit.\n```\n\n## Bootstraping\n\nYou may want to registry your API key.\n\n```\nnetlas query savekey YOUR_API_KEY\n```\nnetlas as now saved your key, you can now use the CLI as such:\n```\nnetlas query 'THE_QUERY'\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Netlas.io API package",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/netlas-io/netlas-python"
},
"split_keywords": [
"security",
" network"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "db731f085edda1b640c79179202b1bf768952033b8bf9f4a010092bc9be373f2",
"md5": "ae19391c4b5f966eaca7f840a98e8c25",
"sha256": "6f64b58beb1ecf5828fa209214c0208e4c73625aa482744d70fe0addd2a29bd0"
},
"downloads": -1,
"filename": "netlas-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ae19391c4b5f966eaca7f840a98e8c25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 14710,
"upload_time": "2024-05-17T12:22:06",
"upload_time_iso_8601": "2024-05-17T12:22:06.654569Z",
"url": "https://files.pythonhosted.org/packages/db/73/1f085edda1b640c79179202b1bf768952033b8bf9f4a010092bc9be373f2/netlas-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "95ba49cf980b7ccf1155b9a35e7da4a870d1ef94e74fab1cf1bed7fe6365fd16",
"md5": "f0ea30cc4dbd2c6e131fa416f3febe10",
"sha256": "cf47de1ae033562649d59a1a8fdd5426fe626daa468ed9a25e30d03497c1ee45"
},
"downloads": -1,
"filename": "netlas-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "f0ea30cc4dbd2c6e131fa416f3febe10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 17741,
"upload_time": "2024-05-17T12:22:09",
"upload_time_iso_8601": "2024-05-17T12:22:09.211746Z",
"url": "https://files.pythonhosted.org/packages/95/ba/49cf980b7ccf1155b9a35e7da4a870d1ef94e74fab1cf1bed7fe6365fd16/netlas-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 12:22:09",
"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": [],
"lcname": "netlas"
}