Issue #2 resolved

hosts attribute of a zone is missing if zone has more than a certian amount of hosts

Simon Josi
created an issue



zerigo_api.find_by_domain('').hosts [<zerigodns.api.NSHost object at 0x3458ad0>, <zerigodns.api.NSHost object at 0x3458b90>, <zerigodns.api.NSHost object at 0x3458c10>, <zerigodns.api.NSHost object at 0x3458c90>, <zerigodns.api.NSHost object at 0x3458d10>, <zerigodns.api.NSHost object at 0x3458d90>, <zerigodns.api.NSHost object at 0x3458e10>, <zerigodns.api.NSHost object at 0x3458e90>, <zerigodns.api.NSHost object at 0x3458f10>, <zerigodns.api.NSHost object at 0x3458f90>, <zerigodns.api.NSHost object at 0x345c050>, <zerigodns.api.NSHost object at 0x345c0d0>, <zerigodns.api.NSHost object at 0x345c150>, <zerigodns.api.NSHost object at 0x345c1d0>] zerigo_api.find_by_domain('').hosts Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/simu/workspace/atizo-platform-env/lib/python2.7/site-packages/zerigodns/", line 68, in getattribute return super(ZerigoDNS, self).getattribute(name) AttributeError: 'NSZone' object has no attribute 'hosts'


If a domain contains a certian amount of hosts, the hosts attribute won't be populated. has 14 configured domains has over 400 configured domains

Comments (5)

  1. Peter Sanchez repo owner

    Man it's been a while since I worked with the API. According to the zone docs it will only return up to 300 hosts. If there are more than 300, it won't return hosts at all.

    I'm looking at the best way to do this. I don't think we want to automatically fetch ALL hosts, but there should be a way to easily page through them all within the client.

  2. Peter Sanchez repo owner


    Please see this commit:

    If you can test with that branch (branch name: issue2) and let me know your results. I don't have any domains with more than 300 hosts so I can't test it specifically with that. I have tested this with every option I can locally though.

    Now, when you do:

    a = zerigo_api.find_by_domain('') a.hosts # Should contain the first 100 hosts. To load the next 100, you just...

    a.hosts.load() # Loads the next 100. To load ALL hosts, just:

    a.hosts.load_all() # Loads all hosts

    At any time, you can reference a.hosts. So for instance, it starts with the first 100, then you call a.hosts.load(), now a.hosts should have the first 200 hosts.

    Please let me know how it's working. I'll merge in the code if you give me the OK.

    Thanks again for reporting this!


  3. Log in to comment