Perfect; Python should make it equally easy.
Failing that, you can use the API (with an admin account) to PUT /admin/site_settings/allowed_email_domains with a form encoded payload like this:
allowed_email_domains=zuyd.nl%7Czzgc.edu.cn%7Czzut.edu.cn