adns-python return codes

J

Josh Close

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
 
S

Sion Arrowsmith

Josh Close said:
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.

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

Sion Arrowsmith

Sion Arrowsmith said:
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.

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:
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]
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,124
Latest member
JuniorPell
Top