adns-python return codes

Discussion in 'Python' started by Josh Close, Sep 3, 2004.

  1. Josh Close

    Josh Close Guest

    Does anyone know what the return codes for an mx adns python lookup
    are? I know 0 means a valid domain, and anything else isn't, but there
    are "no nameservers found" and "timeout" and other things that would
    have to be retried again.

    I looked through the source and didn't find anything, and looked
    through the gnu adns C source and didn't find anything, but I really
    don't know C at all, so I could have missed something.


    Josh Close, Sep 3, 2004
    1. Advertisements

  2. I'd guess you want to be looking at adns.h, specifically the typedef'd
    enum adns_status (ll. 205--255 in the copy I'm looking at), although
    I've not looked at how the Python bindings to adns work. If you're
    not familiar with enums, what you need to know is that it's just a
    list of symbols defined to be integer values starting with 0 (eg
    adns_s_ok is 0) and incrementing by one for each new symbol unless a
    symbol is given an explicit value (adns_s_max_* in this case, used to
    block out different types of error) -- in which case subsequent
    symbols start incrementing from this value (so, eg, adns_s_timeout is
    Sion Arrowsmith, Sep 7, 2004
    1. Advertisements

  3. I now *have* looked at the Python bindings to adns -- if you're
    after "what error code corresponds to a given error?" then
    adns.status exposes the adns_status enum:

    although if what you're interested in is when to retry then you
    might be better off using adns.exception() and catching and
    handling the different classes of exception appropriately.

    If you want a human-readable description of a given status code,
    it looks like the best way would be:

    except adns.Error, e:
    description = e[1]
    Sion Arrowsmith, Sep 9, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.