__init__¶
-
Api.
__init__
(nodes: Union[List[str], str] = None, **kwargs)[source]¶ Constructor for Privex’s GOLOS wrapper class. No arguments are required, unless you want to override defaults.
Basic Usage:
Use default nodes list and settings:
>>> golos = Api()
Use only this specific node:
>>> golos = Api(nodes='wss://golosd.privex.io')
Use a list of nodes, and enable more verbose logging from
WsClient
>>> nodes = ['wss://golosd.privex.io', 'wss://api.golos.blckchnd.com/ws'] >>> golos = Api(nodes=nodes, report=True)
Making basic API calls:
>>> acc = golos.get_accounts(['someguy123']) >>> acc[0]['owner'] 'someguy123' >>> wit = golos.get_witness_by_account('someguy123') >>> wit['url'] 'https://golos.io/ru--delegaty/@someguy123/delegat-someguy123'