Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools

Words
202
Reading
1 min
Listen
Play
10y

In this post we would like to announce a major refactor of python-steem, a library written in Python 3 that allows developers to build full-featured tools on top of the Steem Blockchain such as streemian.com or piston.

Distinct Domain with documentation

Since a couple of days, the major resource for this library can be accessed using our new domain called

pysteem.com

For now, it only holds the current in-code documentation using a rather standard-ish design. We would love to see more python and web-developer join our team of voluntaries to improve the library, documentation and presentation.

Cooperation with steem-tools/steemsports

We are happy to announce a fruitful ongoing cooperation with furion@furion (the author of steemtools) and are happy to have him integrate his library into python-steem!
The new version of the python-steem has been in part battle tested by powering SteemSports and Streemian.com.

Additional Modules

  • Amount: For the sake of easier handling of Assets on the blockchain

    from steem.amount import Amount
    Amount("1 SBD") + Amount("20 SBD")
    
  • Account: Obtaining and accounts

    from steem.account import Account
    account = Account("xeroc")
    print(account.reputation())
    print(account.balances)
    
  • Block: Easily read data in a Block

    from steem.block import Block
    from pprint import pprint
    pprint(Block(1))
    
  • Blog: Read a users Blog

    from steem.blog import Blog
    print(Blog("xeroc"))
    
  • Witness: Read data about a witness

    from steem.witness import Witness
    Witness("chainsquad.com")
    
  • Blockchain: Blockchain stuff

    from steem.blockchain import Blockchain
    chain = Blockchain()
    print(chain.get_current_block())
    print(chain.info())
    for block in chain.blocks():
        print(block)
        break
    for operations in chain.ops():
        print(operations)
        break
    
  • Transaction Builder: To build your own transactions and sign them

    from steem.transactionbuilder import TransactionBuilder
    from steembase.operations import Vote
    tx = TransactionBuilder()
    tx.appendOps(Vote(
        **{"voter": voter,
           "author": post_author,
           "permlink": post_permlink,
           "weight": int(weight * STEEMIT_1_PERCENT)}  # STEEMIT_1_PERCENT = 100
    ))
    tx.appendSigner("xeroc", "posting")
    tx.sign()
    tx.broadcast()
    

Howto update

pip3 install --upgrade steem

Changelog

[Amount] make None Amounts be zero
[Amount] prevent different assets from adding up
[Block] block class
[Blog] remove dead code
[GOLOS] Modifications + improved assets (#14)
[TransactionBuilder] Make sure we have a wif key to sign a tx
[Transactions] build transactions in it's own class
[account create] prevent new accounts with more than 16 chars
[account,blockchain,setup] removed dateutil dependency
[account/amount] show balances as float or string
[account] allow to obtain more than 200 followers
[account] cleanup - removed methods not catering to most users
[account] converter is now a property that is loaded when needed
[account] fix a bug in curation_stats
[account] fix imports
[account] fix minor issues with keys
[account] fixed bugs induced by Account.history return struct changes
[account] fixed imports
[account] get_blog now in a separated class
[account] improved account virtual operation return object
[account] renamed Account.export method
[account] round precision by argument
[account] simplify check_if_already_voted and rename to has_voted(post)
[amount,converter] removed redundant Converter class from amount.py, re-added caches
[amount] even more powerful
[amount] improve operations
[amount] make amount more powerful
[api.exceptions] Another exception message
[api] add 'end' to block_stream
[api] add missing posting key exception
[api] add timestamp to operations on streams
[api] allow long version for mode
[api] cleanup API module and move things to corresponding modules
[api] improve rpc.stream output structure
[api] new exception
[api] remove legacy graphene overloading
[base] move operationids outside of operations.py
[blockchain] fix class variable
[blockchain] fix get_block_from_time
[blockchain] make mode a variable of the instance
[blockchain] minor tweak
[blockchain] simplify stream and reduce load in RPC for virtual_ops only
[blockchain] stream() now uses two different api calls depending on the set of ops to filter for
[blockchain] updates of blockchain class
[blockchain] use default parameters for blocks()
[blog,post] Properly load Blog posts and fix api terminology
[blog] Blog is now an efficient iterator, implementing steemit like lazy infinite scroll
[blog] cleanup module loading
[blog] list has no item()
[converter] Commenting
[converter] can now compute with Amount objects
[converter] fix sbd_median_price
[converter] fix steem_per_mvests
[converter] move caches to .utils entirely
[depracation warning] Markets and Tickers
[dict] dictification
[docs] update of docs
[docs] update of documentation
[error] exception handling for unhandled but decodeable RPC Errors
[examples] imported examples from steemtools
[examples] updated examples
[exceptions] add Duplicate tx failed exception
[exceptions] added missing file
[exceptions] do not use BroadCastError anymore, instead reraise RPCError
[exceptions] initial work on nicer exception handling
[exceptions] setup more exceptions
[execptions] improve regular expression for error handling
[keystorage] only ask for new wallet when using keystorage
[lazyness] allow to enable lazy loading, no lazy by default
[markets]  avg_witness_price now includes quote price in its calculation
[markets] implemented weighted average function, removed dependence on numpy
[operations] comment_options
[post,steem] steem instance on post is now an optional
[post] allow to set comment options from loaded post
[post] cleaned up the Post object and its methods
[post] correction of fa48ffca06, self.refresh() is only required on @property methods
[post] fix #18
[post] fix amounts and parse 'tags'
[post] fixed regressions caused by Post refactoring
[post] imported superset methods from steemtools
[post] improve loading time
[post] legacy api compatibility
[post] make Post a dictionary and use caching
[post] make sure there us a 'tags' even for comments
[post] methods on Post cannot access 'self'' properties without calling self.refresh() first
[post] minor tweak
[post] more parseing and fixed export()
[post] payout amounts are now also parsed as Amount
[post] re-added meta helper
[rename] transaction -> transactionbuilder
[setup.py] added missing python-dateutil
[setup] linting
[steem.post] allow to define comment options
[steem.transactions] minor fixes
[steem] Remove SteemConnector
[steem] Update steem slightly
[steem] added follow api to the defaults
[steem] allow a list of ops to be signed
[steem] comment_options
[steem] fix import cycles for convenience classes such as Blockchain, Account...
[steem] get_post call
[steem] implemented some of steemtools transactions (without tests)
[steem] make use of module instead of calling rpc directly
[steem] make wallet and rpc static variables
[steem] re-add the broadcast call
[steem] reraise broadcast errors not overwrite them
[steem] use Account() frequently
[steemapi] bypass operation type filtering if rpc.stream receives falsy opNames
[steemtools] integrated Account and Converter modules
[steemtools] integrated Markets module
[steemtools] integrated the Blockchain module
[storage] make sure nonexisting keys can be updated
[tests]
[utils] improted utils from steemtools
[utils] improved dictionary filtering utilities
[utils] improved formatting
[utils] improved is_comment documentation
[utils] improved is_comment function
[utils] re-added missing functions
[utils] refactored is_comment
[utils] refactored time handling functions
[utils] remove dependence on dateutil
[utils] time_elapsed can accept strings as well as datetime objects
[wallet] do not require a wallet if not require keys
[wallet] make the keyMap a singleton
[witness] add witness class