Skip to main content

Nabto Client Wrapper for Python

Project description


Python Wrapper for Nabto Client


  • Python 3.6+
  • python3-dev package for Debian distributions


Install using pip...

pip install -i nabto-client


Let's take a look at a quick example of using nabto_client to open a session and a tunnel.

import nabto_client

NABTO_HOME_DIRECTORY = "/home/nabto/example"

USER = "user"
PASSWORD = "password"

REMOTE_HOST = "localhost"

# Initializes the Nabto client API

# Creates a Nabto self signed profile
nabto_client.createSelfSignedProfile(USER, PASSWORD)

with nabto_client.NabtoSession(USER, PASSWORD) as session:
    with nabto_client.NabtoTunnel(session, LOCAL_PORT, NABTO_HOST, REMOTE_HOST, REMOTE_PORT) as port:
        print(f'Opened tunnel on port {port}')
# Releases any resources held by the Nabto client API

Tunnel status

The example above doesn't allow to query the current status of the tunnel because the context manager returns the port not the tunnel object.

If you want to query the tunnel status, don't use the context manager, instead create and open a tunnel like this:

tunnel = nabto_client.NabtoTunnel(session, LOCAL_PORT, NABTO_HOST, REMOTE_HOST, REMOTE_PORT)
print(f'Tunnel status is {tunnel.status()}') # -1 or TunnelStatus.CLOSED
port = tunnel.openTcp()
print(f'Opened tunnel on port {port}')
print(f'Tunnel status is {tunnel.status()}') # 3 or TunnelStatus.LOCAL
# ... do something with the tunnel
if nabto_client.TunnelStatus.CLOSED == tunnel.status():
    print(f'Tunnel is closed')

You can also run example/ for an interactive example.

python example/ --device

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nabto_client-1.0.1.tar.gz (31.7 MB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page