コード例 #1
0
def instance():
    import sys
    try:
        import wifi  # pylint: disable=unused-variable
        return LinuxWifi()
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")

    return Wifi()
コード例 #2
0
def instance():
    import sys
    try:
        import wifi
        return LinuxWifi()
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")

    return Wifi()
コード例 #3
0
ファイル: wifi.py プロジェクト: Dmac500/Instabot
def instance():
    import sys

    if whereis_exe('nmcli'):
        return NMCLIWifi()

    try:
        import wifi  # pylint: disable=unused-variable,unused-import
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")
        return Wifi()
    return LinuxWifi()
コード例 #4
0
ファイル: wifi.py プロジェクト: hector12free/plyer
from plyer.facades import Wifi
from subprocess import Popen, PIPE, call, STDOUT

try:
    import wifi
except ImportError:
    sys.stderr.write("python-wifi not installed. try:"
                     "`sudo pip install wifi`.")
    return Wifi()


class LinuxWifi(Wifi):
    names = {}

    def _is_enabled():
        '''
        TODO: Implement this in future.
        '''
        return

    def _start_scanning(self):
        '''
        Returns all the network information.
        '''
        list_ = wifi.Cell.all('wlan0')
        for i in range(len(list_)):
            self.names[list_[i].ssid] = list_[i]

    def _get_network_info(self, name):
        '''
        Starts scanning for available Wi-Fi networks and returns the available,