Dominions 4 server status query implemented in python. Should be easy enough to understand, and can be used with Django or python bots or anything.
Huge thanks to https://github.com/ssheafer for help with the protocol!
See also http://www.cs.helsinki.fi/u/aitakang/dom3_serverformat_notes for notes on the old Dominions 3 protocol.