Skip to main content

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:

pip install netlas

Or if you already have it installed and want to upgrade to the latest version:

pip install --upgrade netlas

If you only need the CLI tool (without the SDK), use the Homebrew package manager:

brew tap netlas-io/netlas 
brew install netlas

To update homebrew installation to the latest version:

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:

netlas host -a "YOUR_API_KEY"

❓ Where to find 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.

netlas savekey "YOUR_API_KEY"

CLI Usage

Please refer to the built-in help for command and option information. To show help page:

netlas --help
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.:

netlas count --help
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:

You can find more bash examples on the Netlas Docs →.

Python SDK Usage

The following code sample routes the request port:7001 to the Netlas response search and prints search results to stdout.

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 →.

Metadata

Release files for netlas 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netlas 0.8.2
File Size Uploaded Provenance Actions
netlas-0.8.2.tar.gz 23.0 kB Without provenance Details for netlas-0.8.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for netlas 0.8.2
File Interpreter ABI Platform Actions
netlas-0.8.2-py3-none-any.whl Python 3 none any Details for netlas-0.8.2-py3-none-any.whl

Total release size: 42.5 kB

Release files / netlas-0.8.2.tar.gz

Download URL netlas-0.8.2.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8a45b46962ec7e418117ec57db9d662a44731d5183cf23b582e540dc7b5a0db5
BLAKE2b-256 checksum
How to use checksums
d0281c137adb5d302b1bff945ea06f598a62116bc23f8901abadb788bbf57db6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / netlas-0.8.2-py3-none-any.whl

Download URL netlas-0.8.2-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee29a2b2d6c5de5ae9e882a0f98d479d6128499d66e22eaca759622f33da1f57
BLAKE2b-256 checksum
How to use checksums
c1ceb878edc73e1ab540ea580b9b1c2063402c9bcb185c2b6526dbce58f23ae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for netlas 0.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page