It'll work, but there's a problem with that script that won't allow it to be universal for everyone. The author is using a specific naming convention on their networks and unless you're following that it'll make a call against non-MX networks.
Here, in the main() function it goes:
# Get list of networks and ID's
net_data = get_net_id()
for i in net_data:
net_name = i["name"]
net_id = i["id"]
# Ignore the MDM Network
if net_name == 'MDM':
continue
else:
It's looking for "MDM" in the name of the network. A better way to do this IMO is to check the network type.
If type != appliance or if type != combined
continue
Of course you could hit a combined network without an MX... But there seems to be enough error checking in the requests return status that it should be OK either way way you go.
It doesn't make any write calls so it shouldn't be able to do any harm.