Smartbear SecureTunnel Python
A Python package for automating the Smartbear SecureTunnel
Installation
pip install smartbear-tunnel-python
API
SmartbearTunnel constructor:
SmartbearTunnel()
(type: SmartbearTunnel): returns an instance of the SmartbearTunnel class
Arguments:
- username (type: str) (optional): the email address/username you use to authenticate with Smartbear products, see authentication for details
- authkey (type: str) (optional): the authkey/api key you use to authenticate with Smartbear products, see authentication for details
- options (optional): dictionary of options to use when running the tunnel, supported options:
name
(type: str): for naming your tunnel, this enables you to run multiple tunnels in parallel
directory
(type: str): path to files that should be statically hosted by the tunnel
proxyIp
(type: str): the ip/host of a proxy server to use with the tunnel
proxyPort
(type: int): the port of a proxy server to use with the tunnel
bypass
(type: bool): whether to bypass the tunnel for public traffic - defaults to True, may speed up traffic when used
verbose
(type: bool): for debugging the tunnel client, enables verbose logging to stdout
SmartbearTunnel Attributes:
SmartbearTunnel.tunnel_id
(type: str): the tunnel ID corresponding with your active tunnel
SmartbearTunnel.tunnel_type
(type: str): the type of tunnel generated by the client
SmartbearTunnel methods:
SmartbearTunnel.run()
: starts an active tunnel, must be called to start
SmartbearTunnel.is_active()
(type: bool): queries whether the current tunnel is still active
SmartbearTunnel.stop()
: stops the active tunnel
Authorization
You can authenticate by passing your username and authorization key when creating the SmartbearTunnel:
tunnel = SmartbearTunnel(username='myusername', authkey='myauthkey')
You can also use the environment variables:
from bash...
export SMARTBEAR_USERNAME=myusername
export SMARTBEAR_AUTHKEY=myauthkey
python test.py
from test.py...
tunnel = SmartbearTunnel()
This package currently only works for CrossBrowserTesting but will work for Bitbar in the future.
Testing
SMARTBEAR_USERNAME=<TESTING_USERNAME> SMARTBEAR_AUTHKEY=<TESTING_AUTHKEY> python -m unittest tests/test_smartbear_tunnel.py