473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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
Jul 18 '05 #1
2 2261
Josh Close <na****@gmail.com> wrote:
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 -- si***@chiark.greenend.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
Jul 18 '05 #2
Sion Arrowsmith <si***@chiark.greenend.org.uk> wrote:
Josh Close <na****@gmail.com> wrote:
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'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:
adns.status.timeout

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 -- si***@chiark.greenend.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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: george young | last post by:
I recently found myself writing something like: def get_connection(): if tcp_conn(): if server_allows_conn(): return 'good_conn' else: return 'bad_auth' else: return 'no_server'
6
by: Josh Mcfarlane | last post by:
I keep trying to get myself out of the return-code mindset, but it doesn't seem to work. They are suppose to get rid of if-then statements of return codes, but you still have to do an if statement...
16
by: Fao, Sean | last post by:
As far as I can tell, the standard has defined three portable return codes from function main() (0, EXIT_SUCCESS, EXIT_FAILURE). Personally, on all platforms I have worked with, EXIT_SUCCESS is,...
3
by: c# beginner | last post by:
we are trying to standardize return codes across our .NET applications (that are soon to be developed.) What is the best practice for standardizing return codes? I know of only the following...
4
by: Nikolay Petrov | last post by:
Does anyone know where I can find the Windows API's return codes? I know they are in platform SDK, but I wonder isn't there other place where I can find them, because I don't wish to download the...
1
by: Lars Netzel | last post by:
I need to use a few WIN API functions and get Return values as Long and Integers from those.. how do I convert these to the error codes so I get to know what error I really got? Example from...
1
by: Alex P | last post by:
Hi, i would like to check for a given query (insert, update, delete) if there is a key or constraint violation which prevents the query from being executed. Is such a feature implemented in the...
2
by: Rasika WIJAYARATNE | last post by:
Hello, I would like to know what the best way to return error codes to the caller from a webservice would be. Here are my situations for returning error codes: 1. Arguments to web method were...
3
by: RdS | last post by:
Where do I find return codes for MS methods. For instance the filesystemobject methods. I need to know what methods return (error codes, etc. and what they mean). I have searched MSDN and of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.