registry-json.py 543 B

1234567891011121314151617
  1. #!/usr/bin/env python
  2. import os
  3. from registry import Registry
  4. OUTDIR = '/srv/http/dn42/registry'
  5. if __name__ == '__main__':
  6. dn42 = Registry("/home/zorun/net.dn42.registry")
  7. for attr in ["dns", "inetnum", "inet6num", "route", "route6", "person",
  8. "organisation", "mntner", "asblock", "asset", "autnum"]:
  9. d = dn42.__getattribute__(attr)
  10. outfile = os.path.join(OUTDIR, attr + '.json')
  11. with open(outfile, "w") as f:
  12. print("Writing {}...".format(outfile))
  13. d.write_json(f)