Privex Golos Python documentation¶
Welcome to the documentation for Privex’s Golos Python Library - an open source Python 3 library designed for interacting with the GOLOS Classic and potentially the GOLOS network.
This documentation is automatically kept up to date by ReadTheDocs, as it is automatically re-built each time a new commit is pushed to the Github Project
QuickStart¶
To install golos-python
- simply download it using pip
, just like any other package :)
pip3 install golos-python
For alternative installation methods, see Installation
Below are some common examples for using the library:
from golos import Api
# The ``nodes`` parameter is optional. By default it will use the node list specified in ``golos.storage.nodes``
golos = Api(nodes=['wss://golosd.privex.io', 'wss://api.golos.blckchnd.com/ws'])
###
# Get account information + balances
###
accounts = golos.get_accounts(['someguy123'])
acc = accounts[0]
print(acc['owner'])
# 'someguy123'
print('GOLOS:', acc['GOLOS'], 'GBG:', acc['GBG'])
# GOLOS: 157560.231 GBG: 6420.916
###
# Get witness information
###
witness = golos.get_witness_by_account(account='someguy123')
print(witness['url'])
# 'https://golos.io/ru--delegaty/@someguy123/delegat-someguy123'
###
# Get account history
###
history = golos.get_account_history(account='someguy123')
print(history[0])
# {'account': 'huso', 'witness': 'someguy123', 'approve': False, 'number': 127286, 'block': 30494335,
# 'timestamp': '2019-09-17T14:20:21', 'type_op': 'account_witness_vote'}
###
# Transfer GOLOS / GBG to another account
#
# WARNING: To reduce the risk of rounding errors, pass the amount as either a string or a Decimal() - avoid float's!
###
tf = golos.transfer(
to='ksantoprotein', amount='0.1', asset='GOLOS', from_account='someguy123',
wif='5Jq19TeeVmGrBFnu32oxfxQMiipnSCKmwW7fZGUVLAoqsKJ9JwP', memo='this is an example transfer'
)
print('TXID:', tf['id'], 'Block:', tf['block_num'])
# TXID: c901c52daf57b60242d9d7be67f790e023cf2780 Block: 30895436
Contents¶
- Code / API Documentation
- Module “golos”
- golos.api
- resolve_body_ru
- Api
- __init__
- account_create
- account_create_with_delegation
- account_metadata
- account_update
- account_update_password
- account_witness_proxy
- change_recovery_account
- check_login
- convert_golos_to_vests
- delegate_vesting_shares
- delegate_vesting_shares_with_interest
- find_op_transaction
- follow
- get_account_count
- get_account_history
- get_account_reputations
- get_accounts
- get_active_witnesses
- get_all_accounts
- get_balances
- get_block
- get_chain_properties
- get_config
- get_content
- get_curation_percent
- get_current_median_history_price
- get_database_info
- get_dynamic_global_properties
- get_feed_history
- get_follow
- get_key_references
- get_market_history_buckets
- get_median_price
- get_open_orders
- get_ops_in_block
- get_order_book
- get_order_book_extended
- get_order_price
- get_recent_trades
- get_ticker
- get_tickers
- get_transaction
- get_transaction_hex
- get_transaction_id
- get_volume
- get_witness_by_account
- get_witness_count
- get_witness_schedule
- is_login
- lookup_witness_accounts
- post
- replace
- repost
- resolve_url
- transfer
- transfer_to_vesting
- transfers
- vests_to_power
- vote
- withdraw_vesting
- chain_properties
- dynamic_global_properties
- golos.base58
- golos.broadcast
- golos.exceptions
- golos.extras
- golos.key
- golos.operations
- golos.storage
- golos.types
- golos.ws_client
- Unit Tests