On Tue, Apr 2, 2013 at 5:03 AM, <[email protected]> wrote: > Hi byrsa, > > The behavior you're describing does sound wrong. However, I wasn't able > to reproduce it locally. Running your example, I get [] for > megaupload.com, not an error. Perhaps there is a tricky DNS server > involved somewhere that is changing the response unexpectedly? I > suggest using something like tcpdump or wireshark to take a look at the > actual traffic and perhaps produce a more deterministic demonstration of > the problem. > > You are correct! I was running the code on a Linux machine and the 'dig' command on my Macbook. The answers were different. At least I know the code is working!
> Regarding how you should detect certain errors, though, Failure just > wraps normal exceptions, so you can use `isinstance` to check for them > instead of checking by name. Failure also provides some APIs that wrap > up isinstance to provide some more commonly useful behavior - see > Failure.check and Failure.trap. > > 'isinstance' was my initial thought, as well. I'll have to re-visit that. Thanks for the pointer. > And regarding determining error from a Message, you can use the rCode > attribute to get the raw server response code as an integer. The values > and their meanings are defined in the DNS RFC and there are symbolic > constants in twisted.names.dns - eg OK, ENAME, ESERVER, etc. > > That doesn't sound too bad. > Hope this helps, > Jean-Paul > > Your feedback has been immensely helpful, thanks a lot, Jean-Paul! byrsa
_______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
