Skip to content Skip to sidebar Skip to footer

Connect To Wifi Using Python On Raspberry Pi

I am using Python 2.7 and wifi library (https://wifi.readthedocs.org/en/latest/) on a Raspberry Pi. I have managed to install wifi library using: sudo pip install wifi on the ter

Solution 1:

After some research, I didn't find a way to connect easily to a wifi using Python on a Raspberry Pi. So I solved my problem by using the wifi command on the Terminal:

sudo wifi connect--ad-hoc SSID_Name

Which automatically asks me for an input: passkey> .Where you can actually type the password, press enter and after that it automatically connects to the wifi. After that I can run my Python script which needs a connection to the internet in order to run. The wifi command is preferable to other terminal commands when it comes to my problem cause it needs less time to connect to a wifi manually. For example it is preferable to the process which uses this terminal command:

sudo nano /etc/network/interfaces

I hope this helps everyone who has the same problem.

Post a Comment for "Connect To Wifi Using Python On Raspberry Pi"