Skip to content
Script to update GeoIP in Dynect
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


An example script which will add a newly created web server into a specified region of our GeoIP setup. First the script will check if the service exists, if not it builds it from scratch (and names it "MyGeoIPService, 
the name is arbitrary so feel free to change it) if it does exists and are just updating it, it will check if the region exists (in this whatever the region parameter is). If it doesn't exist it will create it, if it does it will simply add 
the new ip address in as an A record for that region. Also add the zone and fqdn as a GeoIP node if they aren't already there (whats the point of having GeoIP set up if there is nothing taking advantage of it :-p )

The credentials are read out of a configuration file in the same directory named credentials.cfg in the format:

user : user_name
customer : customer_name
password: password

The script has the following usage: "python zone fqdn region ip countries"

zone - zone to add GeoIP to if it isn't already (ie:
fqdn - the fully qualified domain name to add GeoIP to if it isn't already (ie:
region - the region to add the ip address to, this is an arbitrary unique name, if the region exists already it will be updated
countries - comma seperated list (no spaces) of the 2 letter ISO-3166 country codes of the countries for the region (remember that countries cannot exist in multiple regions)
ip - the ip address of the server (ie:

The library is available at:
Something went wrong with that request. Please try again.