Skip to main content

Python SDK for XPOS — instant public URLs via SSH tunnels

Project description

getxpos

PyPI Python License Downloads

Python SDK for XPOS — instant public URLs via SSH tunnels. Zero dependencies.

Features

  • Zero dependencies — uses only Python standard library
  • CLI + programmatic API — use from terminal or embed in your tooling
  • HTTP & TCP tunnels — expose web apps or any TCP service
  • Anonymous or authenticated — works instantly, tokens unlock more features
  • Reserved subdomains & custom domains — with Pro/Business plans

Quick Start

# Install and run
pip install getxpos
xpos --port 3000

# Or run without installing
pipx run getxpos --port 3000

Installation

# Global (recommended for CLI usage)
pip install getxpos

# Or with pipx (isolated environment)
pipx install getxpos

Authentication

Get a token from xpos.dev/dashboard/tokens, then either:

# Pass directly
xpos --port 3000 --token tk_xxx

# Or set environment variable
export XPOS_TOKEN=tk_xxx
xpos --port 3000

CLI Usage

# Anonymous tunnel (random subdomain, 3hr expiry)
xpos --port 3000

# Authenticated (random subdomain, 10hr expiry)
xpos --port 3000 --token tk_xxx

# Reserved subdomain (Pro+)
xpos --port 3000 --token tk_xxx --subdomain myapp

# Custom domain (Business)
xpos --port 8000 --token tk_xxx --domain tunnel.example.com

# Port-based TCP tunnel (Pro+)
xpos --port 5432 --token tk_xxx --mode tcp

CLI Options

Option Description Default
--port <port> Local port to expose (required)
--host <host> Local host to forward localhost
--token <token> Auth token (or XPOS_TOKEN env)
--subdomain <name> Reserved subdomain (requires token)
--domain <domain> Custom domain (requires token)
--mode <mode> http or tcp http
--server <host> SSH server hostname go.xpos.dev
-h, --help Show help
-v, --version Show version

Programmatic API

from getxpos import xpos

# HTTP tunnel
tunnel = xpos.connect(port=3000, token="tk_xxx")
print(tunnel.url)         # https://abc.xpos.to
print(tunnel.expires_at)  # 2026-03-28T10:30:45Z
tunnel.close()

# Port-based TCP tunnel
tcp = xpos.connect(port=5432, token="tk_xxx", mode="tcp")
print(tcp.url)            # 1.2.3.4:54321
tcp.close()

Named imports

from getxpos import connect, XposTunnel

tunnel = connect(port=3000)
print(tunnel.url)
tunnel.close()

Callbacks

from getxpos import XposTunnel

tunnel = XposTunnel(
    port=3000,
    on_connect=lambda data: print(f"Connected: {data['url']}"),
    on_output=lambda text: print(text, end=""),  # Raw SSH output
    on_close=lambda code: print("Tunnel closed"),
)

tunnel.start()

Options

Option Type Description
port int Local port to expose (required)
host str Local host (default: "localhost")
token str Auth token (or reads XPOS_TOKEN env)
subdomain str Reserved subdomain
domain str Custom domain
mode str "http" or "tcp" (default: "http")
server str SSH server (default: "go.xpos.dev")
on_connect callable Called with {"url", "expires_at"} on connect
on_output callable Called with raw SSH output text
on_close callable Called with exit code on disconnect

Requirements

  • Python >= 3.8
  • SSH client in PATH (ssh command — comes pre-installed on macOS, Linux, and Windows 10+)

Troubleshooting

"SSH not found" — Install OpenSSH. On Windows: Settings > Apps > Optional Features > OpenSSH Client.

Connection timeout — Check your firewall allows outbound connections on port 443.

"subdomain requires a token" — Reserved subdomains need a Pro plan. Get a token from your dashboard.

Links

License

MIT

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

getxpos-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getxpos-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file getxpos-0.1.1.tar.gz.

File metadata

  • Download URL: getxpos-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for getxpos-0.1.1.tar.gz
Algorithm Hash digest
SHA256 92e2572c1d6b9648975a2cdcc42dda3f2e24c644d8827db19c0e01869b6d69f4
MD5 7e2653def2bc2d700e35d2612a7ae700
BLAKE2b-256 3b4ee57ba98e4c17a2df3285a03a99aecdb2e8471fdf0aa351cd2b382b62629a

See more details on using hashes here.

File details

Details for the file getxpos-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: getxpos-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for getxpos-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f398e8984c95872352f49c3ec9c1a0c665950e2f62a1b7e754ee86e570e77e
MD5 baba2b9522089d7f7617c4bdbe3e56f2
BLAKE2b-256 7d2accbb22a4ccc1a65d6fa1d1e179c7e6e3bf3d7c4405f40c9cd2fef0ed3141

See more details on using hashes here.

Supported by

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