python - Why is dnspython giving me this error? -


here simple code:

    print host     rdata in dns.resolver.query(host, 'cname') :       prod_host = str(rdata.target) 

i'm pulling host out of file. when run this, following:

"www.maizena.es" traceback (most recent call last):   file "lexparse.py", line 488, in <module> dfs(rules_tree)   file "lexparse.py", line 486, in dfs dfs(child)   file "lexparse.py", line 486, in dfs dfs(child)   file "lexparse.py", line 471, in dfs rdata in dns.resolver.query(host, 'cname') :   file "build/bdist.macosx-10.11-intel/egg/dns/resolver.py", line 1132, in query   file "build/bdist.macosx-10.11-intel/egg/dns/resolver.py", line 1051, in query dns.resolver.nxdomain: none of dns query names exist: \"www.maizena.es\"., \"www.maizena.es\".masked.domain.com., \"www.maizena.es\".domain.com., \"www.maizena.es\".netarch.domain.com., \"www.maizena.es\".fr.adsvc., \"www.maizena.es\".domainlab.com. 

what's odd when run test in python repl seems work expected:

bos-mpqpu:config_parse rabdelaz$ python python 2.7.10 (default, oct 23 2015, 19:19:21)  [gcc 4.2.1 compatible apple llvm 7.0.0 (clang-700.0.59.5)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import dns.resolver >>> rdata in dns.resolver.query("www.maizena.es", 'cname') : ...     prod_host = str(rdata.target) ...  >>> prod_host 'sana.kona.unilever.com.edgekey.net.' 

furthermore, dns resolution command line works fine:

$ dig www.maizena.es  ; <<>> dig 9.8.3-p1 <<>> www.maizena.es ;; global options: +cmd ;; got answer: ;; ->>header<<- opcode: query, status: noerror, id: 15148 ;; flags: qr rd ra; query: 1, answer: 3, authority: 0, additional: 0  ;; question section: ;www.maizena.es.            in   ;; answer section: www.maizena.es.     138 in  cname   sana.kona.unilever.com.edgekey.net. sana.kona.unilever.com.edgekey.net. 154 in cname e10923.x.akamaiedge.net. e10923.x.akamaiedge.net. 20 in    96.6.167.93  ;; query time: 73 msec ;; server: 172.27.112.15#53(172.27.112.15) ;; when: tue jul 25 11:24:11 2017 ;; msg size  rcvd: 130 

any insight appreciated.

issue here string has double quotes embedded in it. need strip out.

notice: \"www.maizena.es\" in error message.

i modified script this:

    print repr(host)     rdata in dns.resolver.query(host[1:-1], 'cname') :       prod_host = str(rdata.target) 

using print repr() helped identify extraneous double quotes.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -