def lookup(self, name, host_override=None):
        """
        Looks up a name from the DNSChain server. Throws exception if the
        data is not valid JSON or if the namecoin entry does not exist in the
        blockchain.

        @param name: The name to lookup, e.g. 'id/dionyziz', note this $NAMESPACE/$NAME
        format is not guaranteed.  Additionally the caller must perform appropriate url
        encoding _before_ the name is passed to urllib2.urlopen
        """
        if host_override is not None:
            self.headers['Host'] = host_override
        full_url = "http://%s/%s" % (self.addr, name)
        request = urllib2.Request(full_url, None, self.headers)
        try:
            response = urllib2.urlopen(request)
        except urllib2.HTTPError, e:
            if e.code == 404:
                e = DataNotFound(e, name, self.headers['Host'])
            if e.code < 200 or e.code > 299:
                self._log.debug("%s" % (e.msg,), exc_info=True)
                raise e

        namecoin_string = response.read()
        try:
            data = json.loads(namecoin_string)
        except ValueError:
            raise MalformedJSON("%s\n%s" % (ValueError, namecoin_string))
        return data
def lookup ( self , name , host_override = None ) : if host_override is not None : self . headers [ 'Host' ] = host_override full_url = "http://%s/%s" % ( self . addr , name ) request = urllib2 . Request ( full_url , None , self . headers ) try : response = urllib2 . urlopen ( request ) except urllib2 . HTTPError , e : if e . code == 404 : e = DataNotFound ( e , name , self . headers [ 'Host' ] ) if e . code < 200 or e . code > 299 : self . _log . debug ( "%s" % ( e . msg , ) , exc_info = True ) raise e namecoin_string = response . read ( ) try : data = json . loads ( namecoin_string ) except ValueError : raise MalformedJSON ( "%s\n%s" % ( ValueError , namecoin_string ) ) return data
Looks up a name from the DNSChain server. Throws exception if the
        data is not valid JSON or if the namecoin entry does not exist in the
        blockchain.

        @param name: The name to lookup, e.g. 'id/dionyziz', note this $NAMESPACE/$NAME
        format is not guaranteed.  Additionally the caller must perform appropriate url
        encoding _before_ the name is passed to urllib2.urlopen