tfchain/TFChainClient.py
def record_get(self, identifier):
        """
        Get a 3Bot record registered on a TFchain network
        @param identifier: unique 3Bot id, public key or (bot) name to search a 3Bot record for
        """
        endpoint = "/explorer/3bot"
        if isinstance(identifier, int):
            identifier = str(identifier)
        elif isinstance(identifier, BotName):
            endpoint = "/explorer/whois/3bot"
            identifier = str(identifier)
        elif isinstance(identifier, PublicKey):
            identifier = str(identifier)
        elif isinstance(identifier, str):
            if BotName.REGEXP.match(identifier) is not None:
                endpoint = "/explorer/whois/3bot"
            else:
                try:
                    PublicKey.from_json(identifier)
                except ValueError as exc:
                    raise ValueError("a 3Bot identifier in string format has to be either a valid BotName or PublicKey, '{}' is neither".format(identifier)) from exc
        else:
            raise TypeError("identifier of type {} is invalid".format(type(identifier)))
        # identifier is a str at this point
        # and endpoint is configured

        # fetch the data
        endpoint += "/{}".format(identifier)
        try:
            resp = self._client.explorer_get(endpoint=endpoint)
        except tfchain.errors.ExplorerNoContent as exc:
            raise tfchain.errors.ThreeBotNotFound(identifier) from exc
        resp = json_loads(resp)
        try:
            # return the fetched record as a named tuple, for easy semi-typed access
            record = resp['record']
            return ThreeBotRecord(
                identifier=int(record['id']),
                names=[BotName.from_json(name) for name in record.get('names', []) or []],
                addresses=[NetworkAddress.from_json(address) for address in record.get('addresses', []) or []],
                public_key=PublicKey.from_json(record['publickey']),
                expiration=int(record['expiration']),
            )
        except KeyError as exc:
            # return a KeyError as an invalid Explorer Response
            raise tfchain.errors.ExplorerInvalidResponse(str(exc), endpoint, resp) from exc

        Get a 3Bot record registered on a TFchain network
        @param identifier: unique 3Bot id, public key or (bot) name to search a 3Bot record for
        
Get a 3Bot record registered on a TFchain network
Get a 3Bot record registered on a TFchain network
def record_get(self, identifier):
        endpoint = "/explorer/3bot"
        if isinstance(identifier, int):
            identifier = str(identifier)
        elif isinstance(identifier, BotName):
            endpoint = "/explorer/whois/3bot"
            identifier = str(identifier)
        elif isinstance(identifier, PublicKey):
            identifier = str(identifier)
        elif isinstance(identifier, str):
            if BotName.REGEXP.match(identifier) is not None:
                endpoint = "/explorer/whois/3bot"
            else:
                try:
                    PublicKey.from_json(identifier)
                except ValueError as exc:
                    raise ValueError("a 3Bot identifier in string format has to be either a valid BotName or PublicKey, '{}' is neither".format(identifier)) from exc
        else:
            raise TypeError("identifier of type {} is invalid".format(type(identifier)))
        endpoint += "/{}".format(identifier)
        try:
            resp = self._client.explorer_get(endpoint=endpoint)
        except tfchain.errors.ExplorerNoContent as exc:
            raise tfchain.errors.ThreeBotNotFound(identifier) from exc
        resp = json_loads(resp)
        try:
            record = resp['record']
            return ThreeBotRecord(
                identifier=int(record['id']),
                names=[BotName.from_json(name) for name in record.get('names', []) or []],
                addresses=[NetworkAddress.from_json(address) for address in record.get('addresses', []) or []],
                public_key=PublicKey.from_json(record['publickey']),
                expiration=int(record['expiration']),
            )
        except KeyError as exc:
            raise tfchain.errors.ExplorerInvalidResponse(str(exc), endpoint, resp) from exc
def record_get ( self , identifier ) : endpoint = "/explorer/3bot" if isinstance ( identifier , int ) : identifier = str ( identifier ) elif isinstance ( identifier , BotName ) : endpoint = "/explorer/whois/3bot" identifier = str ( identifier ) elif isinstance ( identifier , PublicKey ) : identifier = str ( identifier ) elif isinstance ( identifier , str ) : if BotName . REGEXP . match ( identifier ) is not None : endpoint = "/explorer/whois/3bot" else : try : PublicKey . from_json ( identifier ) except ValueError as exc : raise ValueError ( "a 3Bot identifier in string format has to be either a valid BotName or PublicKey, '{}' is neither" . format ( identifier ) ) from exc else : raise TypeError ( "identifier of type {} is invalid" . format ( type ( identifier ) ) ) endpoint += "/{}" . format ( identifier ) try : resp = self . _client . explorer_get ( endpoint = endpoint ) except tfchain . errors . ExplorerNoContent as exc : raise tfchain . errors . ThreeBotNotFound ( identifier ) from exc resp = json_loads ( resp ) try : record = resp [ 'record' ] return ThreeBotRecord ( identifier = int ( record [ 'id' ] ) , names = [ BotName . from_json ( name ) for name in record . get ( 'names' , [ ] ) or [ ] ] , addresses = [ NetworkAddress . from_json ( address ) for address in record . get ( 'addresses' , [ ] ) or [ ] ] , public_key = PublicKey . from_json ( record [ 'publickey' ] ) , expiration = int ( record [ 'expiration' ] ) , ) except KeyError as exc : raise tfchain . errors . ExplorerInvalidResponse ( str ( exc ) , endpoint , resp ) from exc
Get a 3Bot record registered on a TFchain network
Get a 3Bot record registered on a TFchain network
"""
        Get a 3Bot record registered on a TFchain network
        @param identifier: unique 3Bot id, public key or (bot) name to search a 3Bot record for
        """ # identifier is a str at this point # and endpoint is configured # fetch the data # return the fetched record as a named tuple, for easy semi-typed access # return a KeyError as an invalid Explorer Response
self
identifier
unique 3Bot id, public key or (bot) name to search a 3Bot record for
unique 3Bot id public key or ( bot ) name to search a 3Bot record for