Get current wifi ssid in python

indsæt subtitle

Linux
CLI
Python
Author

Christian Knudsen

Published

April 6, 2020

Just a quick note. How do we get the name of the current ssid name of the wifi-connection a computer running some Linux-variant (like a Raspberry Pi running Raspbian) is connected to. In Python:

import subprocess 
ssid = subprocess.check_output("iwgetid -r", shell=True) 
print(ssid)