adns-python return codes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Josh Close

    #1

    adns-python return codes

    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.

    Thanks.

    -Josh
  • Sion Arrowsmith

    #2
    Re: adns-python return codes

    Josh Close <narshe@gmail.c om> wrote:[color=blue]
    >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.[/color]

    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
    30).

    --
    \S -- siona@chiark.gr eenend.org.uk -- http://www.chaos.org.uk/~sion/
    ___ | "Frankly I have no feelings towards penguins one way or the other"
    \X/ | -- Arthur C. Clarke
    her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

    Comment

    • Sion Arrowsmith

      #3
      Re: adns-python return codes

      Sion Arrowsmith <siona@chiark.g reenend.org.uk> wrote:[color=blue]
      >Josh Close <narshe@gmail.c om> wrote:[color=green]
      >>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.[/color]
      >
      >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.[/color]

      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:
      [color=blue][color=green][color=darkred]
      >>> adns.status.tim eout[/color][/color][/color]
      30

      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:

      try:
      adns.exception( result[0])
      except adns.Error, e:
      description = e[1]

      --
      \S -- siona@chiark.gr eenend.org.uk -- http://www.chaos.org.uk/~sion/
      ___ | "Frankly I have no feelings towards penguins one way or the other"
      \X/ | -- Arthur C. Clarke
      her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

      Comment

      Working...