Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

No project description provided

Project description


Network switching. Make sure you're connecting with the priority that you want.

Works on Linux (relies on wpa_supplicant)


pip install netswitch


Network Switching

import time
import netswitch


switch = netswitch.NetSwitch([
    {'interface': 'wlan*', 'ssids': 'lifeline'},
    'eth*',  # equivalent to {'interface': 'eth*'}
    {'interface': 'wlan*'},  # implied - 'ssids': '*'

while True:
    connected = switch.check()
# or equivalently

For example, assume your setup is:

  • ifaces: wlan0 (built-in Pi 4 wifi), wlan1 (usb wifi dongle), ppp0 (cellular)
  • trusted ssids: nyu, nyu-legacy

Procedure - at any point in these steps, if we connect, we're finished:

  • check wlan1 for s0nycL1f3l1ne, if yes, connect
  • check wlan0 for s0nycL1f3l1ne, if yes, connect
  • check for eth0 and internet connected thru interface
  • check for ppp0 and internet connected thru interface
    • should we control wvdial or whatevs in this ???
  • check wlan1 for [nyu, nyu-legacy], if yes, connect
  • check wlan0 for [nyu, nyu-legacy], if yes, connect
  • check if internet is already connected thru any interface


  • tests - .travis.yml
  • eth0 connection, ppp0 connection
  • /etc/network/interfaces setup? / instructions?
  • restart interface if it's missing / not connected? maybe only 0, or if it showed up once?
  • time since connected - restart after a certain amount of time.

Project details

Download files

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

Files for netswitch, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size netswitch-0.0.3.tar.gz (6.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page