A dead simple, cross-platform Python library to connect to wireless networks.
This library can control a computer's wireless adapter to connect to a network. Environments currently supported include (in order of preference):
Network Manager | Operating Systems | Tested Adapters |
---|---|---|
nmcli | Ubuntu 12.04, 14.04 | Linksys AE3000, Intel Centrino 6250 |
wpa_supplicant | Ubuntu 12.04, 14.04 | Intel Centrino 6250 |
networksetup | Mac OS 10.10 | Macbook Pro |
sudo pip install wireless
A typical usage looks like this:
from wireless import Wireless
wireless = Wireless()
wireless.connect(ssid='ssid', password='password')
Note: To use nmcli
on Ubuntu 14.04, the right permissions must be in place. A few options are listed here.
Note: To use wpa_supplicant
, network-manager
(the backend for nmcli
) must not be running. This is because network-manager
runs an instance of wpa_supplicant
behind the scenes which will conflict with the wpa_supplicant
instance that this library would create. If you have a network-manager
on your machine but would prefer to use wpa_supplicant
(not recommended), run sudo service network-manager stop
before using wireless
.
Wireless([interface])
- initialize the wireless driverconnect(ssid, password)
- attempts to connect to a network and returns True on successcurrent()
- returns the name of the current network or None otherwiseinterfaces()
- list the available interfacesinterface([interface])
- get or set the current interfacepower([True||False])
- get or set the power status of the adapterdriver()
- return the name of driver being used for wireless control
This project uses semantic versioning.
- Added a few tests and fixed a py34 bug (XayOn)
- Added version check for nmcli (Silarn)
- Added support for
wpa_supplicant
- Added the
driver()
method
- remove dependency on
pandoc
- Added support for multiple network adapters with
interface()
andinterfaces()
methods - The
current()
method actually asks the wireless driver for the current SSID instead of returning the name of the most recently connected network - Added the
power()
method
- Better documentation formatting for PyPI
- Initial release
Pull requests to the develop
branch are welcomed!
First, install pandoc
so that setup.py can auto-convert Markdown syntax into reStructuredText:
sudo apt-get install pandoc
sudo pip install pypandoc
Then, following this guide, push the project to PyPI:
sudo python setup.py sdist upload -r pypi