(self, agent)
Requests the 'details' document from onionoo.torproject.org via
        the given `twisted.web.iweb.IAgent` -- you can get a suitable
        instance to pass here by calling either :meth:`txtorcon.Tor.web_agent` or
        :meth:`txtorcon.Circuit.web_agent`.
Requests the 'details' document from onionoo.torproject.org via
        the given `twisted.web.iweb.IAgent` -- you can get a suitable
        instance to pass here by calling either :meth:`txtorcon.Tor.web_agent` or
        :meth:`txtorcon.Circuit.web_agent`.
Requests the details document from onionoo . torproject . org via the given twisted . web . iweb . IAgent -- you can get a suitable instance to pass here by calling either : meth : txtorcon . Tor . web_agent or : meth : txtorcon . Circuit . web_agent .
def get_onionoo_details(self, agent):
        """
        Requests the 'details' document from onionoo.torproject.org via
        the given `twisted.web.iweb.IAgent` -- you can get a suitable
        instance to pass here by calling either :meth:`txtorcon.Tor.web_agent` or
        :meth:`txtorcon.Circuit.web_agent`.
        """

        # clearnet: 'https://onionoo.torproject.org/details?lookup={}'
        uri = 'http://tgel7v4rpcllsrk2.onion/details?lookup={}'.format(self.id_hex[1:]).encode('ascii')

        resp = yield agent.request(b'GET', uri)
        if resp.code != 200:
            raise RuntimeError(
                'Failed to lookup relay details for {}'.format(self.id_hex)
            )
        body = yield readBody(resp)
        data = json.loads(body.decode('ascii'))
        if len(data['relays']) != 1:
            raise RuntimeError(
                'Got multiple relays for {}'.format(self.id_hex)
            )
        relay_data = data['relays'][0]
        if relay_data['fingerprint'].lower() != self.id_hex[1:].lower():
            raise RuntimeError(
                'Expected "{}" but got data for "{}"'.format(self.id_hex, relay_data['fingerprint'])
            )
        returnValue(relay_data)
def get_onionoo_details ( self , agent ) : # clearnet: 'https://onionoo.torproject.org/details?lookup={}' uri = 'http://tgel7v4rpcllsrk2.onion/details?lookup={}' . format ( self . id_hex [ 1 : ] ) . encode ( 'ascii' ) resp = yield agent . request ( b'GET' , uri ) if resp . code != 200 : raise RuntimeError ( 'Failed to lookup relay details for {}' . format ( self . id_hex ) ) body = yield readBody ( resp ) data = json . loads ( body . decode ( 'ascii' ) ) if len ( data [ 'relays' ] ) != 1 : raise RuntimeError ( 'Got multiple relays for {}' . format ( self . id_hex ) ) relay_data = data [ 'relays' ] [ 0 ] if relay_data [ 'fingerprint' ] . lower ( ) != self . id_hex [ 1 : ] . lower ( ) : raise RuntimeError ( 'Expected "{}" but got data for "{}"' . format ( self . id_hex , relay_data [ 'fingerprint' ] ) ) returnValue ( relay_data )