Skip to main content

No project description provided

Project description

Wi-Fi Connection

This package provides commands to interact with Wi-Fi connections on Windows.

Installation

Install the wifi_connection package using pip:

pip install wifi_connection

Usage

  1. Python code
    import wifi_connection
    
  2. Command
    https://www.youtube.com/watch?v=20PbKNIRKfo

Example

import wifi_connection

# Get the list of available network interfaces
interfaces = wifi_connection.get_interfaces()
print("Available interfaces:", interfaces)

# Get the list of available networks for a specific interface
interface_name = "wlan0"  # Example interface name
networks = wifi_connection.get_network_list(interface_name)
print("Available networks for", interface_name + ":", networks)

# Set a network profile
ssid = "MyWiFiNetwork"  # Example SSID
password = "password123"  # Example password
band = "5"  # the ssid's band that you want to connect(2, 5 or 6)
success = wifi_connection.set_profile(interface_name, band, ssid, password)
print("Profile set successfully:", success)

# Connect to a network
success = wifi_connection.connect(interface_name, ssid)
print("Connection successful:", success)

# Get the SSID of the connected network
connected_ssid = wifi_connection.get_ssid(interface_name)
print("Connected SSID:", connected_ssid)

# Refresh the list of available networks
refresh_success = wifi_connection.refresh(interface_name)
print("Refresh successful:", refresh_success)

# Get the profile of a specific SSID network
profile_name = "MyWiFiNetwork"  # Example profile name
profile_content = wifi_connection.get_profile(interface_name, profile_name)
print("Profile content for", profile_name + ":", profile_content)

# Get connection information for a specified interface
connection_info = wifi_connection.get_connection_info(interface_name)
print("Connection information for", interface_name + ":", connection_info)

Functions

settings

Enable or disable printing of results.

  • Parameters:
    • set_print: Flag to enable/disable printing. (Optional, Default: True)

get_interfaces

Get the list of available network interfaces.

  • Return Value:
    • List of available network interfaces.

get_network_list

Get the list of available networks for the specified interface.

  • Parameters:

    • iface_name: Interface name. (Required)
  • Return Value:

    • List of available networks. [{"SSID": ssid1, "RSSI": rssi1, "Freq": freq1}, {"SSID": ssid2, "RSSI": rssi2, "Freq": freq2}]

set_profile

Set a network profile for the specified interface.

  • Parameters:

    • iface_name: Interface name. (Required)
    • band: Wireless band. (Required)
    • ssid: SSID of the network. (Required)
    • pwd: Password of the network. (Optional, ignore if the network does not require a password)
    • auto: Enable or disable automatic connection to the network. (Optional, Default: True)
  • Return Value:

    • True if the profile is set successfully, False otherwise.

connect

Connect to a network with the specified SSID using the specified interface.
If a profile for the network does not exist, make sure to first set the profile using set_profile.

  • Parameters:

    • iface_name: Interface name. (Required)
    • ssid: SSID of the network. (Required)
  • Return Value:

    • True if the connection is successful, False otherwise.

refresh

Refresh the list of available networks for the specified interface.

  • Parameters:

    • iface_name: Interface name. (Required)
  • Return Value:

    • True if the refresh is successful, False otherwise.

get_ssid

Get the SSID of the connected network for the specified interface.

  • Parameters:

    • iface_name: Interface name. (Required)
  • Return Value:

    • SSID of the connected network, or an error if the interface is not connected to any network.

get_profile

Get the Profile of the SSID network for the specified interface.

  • Parameters:

    • iface_name: Interface name. (Required)
    • profile_name: Profile name. (Required)
  • Return Value:

    • Profile content

get_connection_info

Retrieve connection information for a specified network interface.

  • Parameters:

    • iface_name: Interface name. (Required)
  • Return Value:

    • JSON string containing connection information for the specified interface.
      Example:
      {
        "RxSpeed": 574000,
        "TxSpeed": 117000,
        "Channel": 3,
        "Frequency": 2422000,
        "RSSI": -33,
        "Protocol": "dot11_phy_type_he"
      }
      

get_computer_info

Retrieve information about the computer.

  • Parameters:

    • iface_name: Interface name. (Required)
  • Return Value:

    • JSON string containing information about the computer for the specified interface.
      Example:
      {
        "WiFiDriverVersion": "22.220.0.4", 
        "WiFiDriverDate": "20230329", 
        "WiFiDriverProviderName": "Intel", 
        "OS": "Microsoft Windows 11 專業版", 
        "OSBuild": "22631", 
        "OSVersion": "23H2", 
        "CPU": "13th Gen Intel(R) Core(TM) i7-13700HX"
      }
      

get_tput_name

Retrieves the name for the second argument (tput_name) of the graph function.

  • Parameters:

    • None
  • Return Value:

    • List of available throughput name.

graph (only in version 0.1.7)

Generates a real-time graph showing throughput and RSSI (Received Signal Strength Indication).

  • Parameters:

    • iface_name (str): Interface name. (Required)
    • tput_name (str): The name for getting throughput, obtained from the get_tput_name function. (Required)
    • data (str): Specifies the type of data to graph. Options are rx, tx, rssi, trx, txrssi, rxrssi. Default is rxrssi. (Optional)
    • Note: First two arguments may be the same.
  • Return Value:

    • None

Project details


Download files

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

Source Distribution

wifi_connection-0.1.14.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wifi_connection-0.1.14-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file wifi_connection-0.1.14.tar.gz.

File metadata

  • Download URL: wifi_connection-0.1.14.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.9 Windows/10

File hashes

Hashes for wifi_connection-0.1.14.tar.gz
Algorithm Hash digest
SHA256 837e11a97a63bee8309f9cce1bfbb152d11661ab222404fb4a53d3ff7fc9c547
MD5 feeecf904a316d66d4d5f09f7d5fc70f
BLAKE2b-256 3c41e0dcf54313e58c2f5abea4b62866563f1a2ebbbf72f262901f8e8079484b

See more details on using hashes here.

File details

Details for the file wifi_connection-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: wifi_connection-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.9 Windows/10

File hashes

Hashes for wifi_connection-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 1987b344fd07a85a0156c38ab1f264e1af2f58d669de5f757bc2efd1ab5730c5
MD5 90aee44940130fc7a23d71ce51e6ac85
BLAKE2b-256 237cafaeeb5600cd28d044bc0a832a3c48c6315379fb77148a6765365678f9b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page