# pywifi
![](https://img.shields.io/pypi/pyversions/pywifi.svg)
[![Build Status](https://travis-ci.com/awkman/pywifi.svg?branch=master)](https://travis-ci.com/awkman/pywifi)
[![PyPI version](https://badge.fury.io/py/pywifi.svg)](https://badge.fury.io/py/pywifi)
pywifi provides a cross-platform Python module for manipulating wireless
interfaces.
* Easy to use
* Supports Windows and Linux
## Prerequisites
On Linux, you will need to run wpa_supplicant to manipulate the wifi devices,
and then pywifi can communicate with wpa_supplicant through socket.
On Windows, the [Native Wifi] component comes with Windows versions greater
than Windows XP SP2.
## Installation
After installing the prerequisites listed above for your platform, you can
use pip to install from source:
cd pywifi/
pip install .
## Documentation
For the details of pywifi, please refer to [Documentation].
## Example
import pywifi
wifi = pywifi.PyWiFi()
iface = wifi.interfaces()[0]
iface.disconnect()
time.sleep(1)
assert iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
profile = pywifi.Profile()
profile.ssid = 'testap'
profile.auth = const.AUTH_ALG_OPEN
profile.akm.append(const.AKM_TYPE_WPA2PSK)
profile.cipher = const.CIPHER_TYPE_CCMP
profile.key = '12345678'
iface.remove_all_network_profiles()
tmp_profile = iface.add_network_profile(profile)
iface.connect(tmp_profile)
time.sleep(30)
assert iface.status() == const.IFACE_CONNECTED
iface.disconnect()
time.sleep(1)
assert iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
(C) Jiang Sheng-Jhih 2019, [MIT License].
[Native Wifi]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms706556.aspx
[MIT License]: https://opensource.org/licenses/MIT
[Documentation]: https://github.com/awkman/pywifi/blob/master/DOC.md
Raw data
{
"_id": null,
"home_page": "https://github.com/awkman/pywifi",
"name": "pywifi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"maintainer_email": "",
"keywords": "wifi,wireless,Linux,Windows",
"author": "Jiang Sheng-Jhih",
"author_email": "shengjhih@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b4/83/af4c284db4a9c87af92525f1d755426e9dc04aef80be8c54b0ae6628105d/pywifi-1.1.12.tar.gz",
"platform": "",
"description": "# pywifi\n\n![](https://img.shields.io/pypi/pyversions/pywifi.svg)\n[![Build Status](https://travis-ci.com/awkman/pywifi.svg?branch=master)](https://travis-ci.com/awkman/pywifi)\n[![PyPI version](https://badge.fury.io/py/pywifi.svg)](https://badge.fury.io/py/pywifi)\n\npywifi provides a cross-platform Python module for manipulating wireless\ninterfaces.\n\n* Easy to use\n* Supports Windows and Linux\n\n## Prerequisites\n\nOn Linux, you will need to run wpa_supplicant to manipulate the wifi devices,\nand then pywifi can communicate with wpa_supplicant through socket.\n\nOn Windows, the [Native Wifi] component comes with Windows versions greater\nthan Windows XP SP2.\n\n## Installation\n\nAfter installing the prerequisites listed above for your platform, you can\nuse pip to install from source:\n\n cd pywifi/\n pip install .\n\n## Documentation\n\nFor the details of pywifi, please refer to [Documentation].\n\n## Example\n\n import pywifi\n\n wifi = pywifi.PyWiFi()\n\n iface = wifi.interfaces()[0]\n\n iface.disconnect()\n time.sleep(1)\n assert iface.status() in\\\n [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]\n\n profile = pywifi.Profile()\n profile.ssid = 'testap'\n profile.auth = const.AUTH_ALG_OPEN\n profile.akm.append(const.AKM_TYPE_WPA2PSK)\n profile.cipher = const.CIPHER_TYPE_CCMP\n profile.key = '12345678'\n\n iface.remove_all_network_profiles()\n tmp_profile = iface.add_network_profile(profile)\n\n iface.connect(tmp_profile)\n time.sleep(30)\n assert iface.status() == const.IFACE_CONNECTED\n\n iface.disconnect()\n time.sleep(1)\n assert iface.status() in\\\n [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]\n\n(C) Jiang Sheng-Jhih 2019, [MIT License].\n\n[Native Wifi]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms706556.aspx\n[MIT License]: https://opensource.org/licenses/MIT\n[Documentation]: https://github.com/awkman/pywifi/blob/master/DOC.md\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A cross-platform module for manipulating WiFi devices.",
"version": "1.1.12",
"split_keywords": [
"wifi",
"wireless",
"linux",
"windows"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8955170a52685eeefeab36bfaf26bdca629263a0a28efffc3b556b2cc86ab966",
"md5": "13bbf88378f1628a88e7fc5619df90e7",
"sha256": "d1b79d9ff054eef1aca4ab97f2641650d001d6740bfa7666a7d9506bcfb8459b"
},
"downloads": -1,
"filename": "pywifi-1.1.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13bbf88378f1628a88e7fc5619df90e7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 15693,
"upload_time": "2019-01-26T15:10:04",
"upload_time_iso_8601": "2019-01-26T15:10:04.169382Z",
"url": "https://files.pythonhosted.org/packages/89/55/170a52685eeefeab36bfaf26bdca629263a0a28efffc3b556b2cc86ab966/pywifi-1.1.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b483af4c284db4a9c87af92525f1d755426e9dc04aef80be8c54b0ae6628105d",
"md5": "81d53b68a7150608d4fd968233a2f867",
"sha256": "6da15de5d573635a461a95919920788b6f61748e1bd93a5e3504f456cf2e8bcc"
},
"downloads": -1,
"filename": "pywifi-1.1.12.tar.gz",
"has_sig": false,
"md5_digest": "81d53b68a7150608d4fd968233a2f867",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
"size": 13071,
"upload_time": "2019-01-26T15:10:05",
"upload_time_iso_8601": "2019-01-26T15:10:05.492170Z",
"url": "https://files.pythonhosted.org/packages/b4/83/af4c284db4a9c87af92525f1d755426e9dc04aef80be8c54b0ae6628105d/pywifi-1.1.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-01-26 15:10:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "awkman",
"github_project": "pywifi",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "pywifi"
}