Thanks for porting this to CircuitPython and sharing your work. It actually works! The only problem is that after using the code to configure Wifi, the HTTP server I use as a control GUI stops working on my MatrixPortal S3 :-(.
My working theory is the the HTTP server that was used to configure the SSID and password is still running in the background, but I haven't figure out how to disable it after the configuration process.