The Sonoma update got me too.
I found that in terminal
networksetup getairportnetwork en0
will display the SSID as
Current Network: SSID
and in Python
import subprocess
wifi = subprocess.check_output(['networksetup', 'getairportnetwork', 'en0']).decode('utf-8')
will return a string containing the SSID