create account

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

View this thread on: hive.blogpeakd.comecency.com
· @chainsquad ·
$206.49
Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools
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](https://streemian.com) or [piston](http://piston.rocks).

## 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](http://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 (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](https://steemsports.com) and [Streemian.com](https://streemian.com).

## Additional Modules

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

  ```python
  from steem.amount import Amount
  Amount("1 SBD") + Amount("20 SBD")
  ```

* Account: Obtaining and accounts

  ```python
  from steem.account import Account
  account = Account("xeroc")
  print(account.reputation())
  print(account.balances)
  ```

* Block: Easily read data in a Block

  ```python
  from steem.block import Block
  from pprint import pprint
  pprint(Block(1))
  ```

* Blog: Read a users Blog

  ```python
  from steem.blog import Blog
  print(Blog("xeroc"))
  ```

* Witness: Read data about a witness

  ```python
  from steem.witness import Witness
  Witness("chainsquad.com")
  ```

* Blockchain: Blockchain stuff

  ```python
  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

  ```python
  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
```
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 644 others
properties (23)
authorchainsquad
permlinkpython-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools
categorysteem
json_metadata"{"tags": ["chainsquad", "python", "release"]}"
created2017-01-18 14:35:21
last_update2017-01-18 14:35:21
depth0
children18
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value186.777 HBD
curator_payout_value19.716 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length8,263
author_reputation42,383,038,531,003
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id2,279,052
net_rshares202,020,242,526,420
author_curate_reward""
vote details (708)
@cryptofunk ·
You guys are really pushing the boat out, I don't see as much help on other blockchains! Thanks for all your efforts.
properties (22)
authorcryptofunk
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t161241526z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-18 16:12:39
last_update2017-01-18 16:12:39
depth1
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length117
author_reputation22,006,702,786,195
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,279,776
net_rshares0
@eric-boucher ·
Thanks for posting the extra goodness our way and keep us all up to date on the matters. Great job!  All for one and one for all!   Namaste   :)
👍  
properties (23)
authoreric-boucher
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t231621976z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-18 23:16:21
last_update2017-01-18 23:16:21
depth1
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length144
author_reputation68,503,601,066,539
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,282,673
net_rshares78,507,747,238
author_curate_reward""
vote details (1)
@felixxx · (edited)
>Providing Keys: Here, you can provide the keys for your accounts manually. All you need to do is add the wif keys for the accounts you want to use as a simple array using the keys parameter to Steem().

how do i provide a single key as a simple array ?

i checked steem.py to see "kwargs " and "keys" somewhere ...
I don't understand, how that's supposed to work.

I like the functions that came with steemtools. Good Work.
properties (22)
authorfelixxx
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170124t143538151z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-24 14:35:39
last_update2017-01-24 14:42:06
depth1
children8
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length424
author_reputation217,825,762,716,184
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,330,123
net_rshares0
@xeroc · (edited)
You can do like this:

```python
steem = Steem(keys=['wif1', 'wif2'])
```
👍  ,
properties (23)
authorxeroc
permlinkre-felixxx-re-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170124t145925092z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-24 14:59:24
last_update2017-01-24 14:59:36
depth2
children7
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length73
author_reputation118,819,064,085,695
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,330,280
net_rshares487,970,569,522
author_curate_reward""
vote details (2)
@felixxx · (edited)
I tried a list.

It then asks me for a passphrase to my new wallet.
It doesn't use the key/ doesn't take the argument.
properties (22)
authorfelixxx
permlinkre-xeroc-re-felixxx-re-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170124t150306186z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-24 15:03:06
last_update2017-01-24 15:03:39
depth3
children6
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation217,825,762,716,184
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,330,315
net_rshares0
@furion · (edited)
This is a pretty significant release, and due to the substantial refactoring and re-design efforts, it is not fully backwards compatible. 

If your project depends on the old version of the piston stack, I encourage you to skim trough the [documentation](http://pysteem.com/) and play with some core utilities in REPL to get a feel for underlying changes and a plethora of new features.
👍  ,
properties (23)
authorfurion
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t151251392z
categorysteem
json_metadata{"tags":["steem"],"links":["http://pysteem.com/"],"app":"steemit/0.1"}
created2017-01-18 15:12:51
last_update2017-01-18 15:13:30
depth1
children1
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length386
author_reputation116,503,940,714,958
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,279,340
net_rshares137,998,161,250
author_curate_reward""
vote details (2)
@biophil ·
> it is not fully backwards compatible.

Thanks for the heads-up.
👍  
properties (23)
authorbiophil
permlinkre-furion-re-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t200911531z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-18 20:09:12
last_update2017-01-18 20:09:12
depth2
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length65
author_reputation45,223,914,794,461
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,281,473
net_rshares12,105,170,572
author_curate_reward""
vote details (1)
@kenny-crane ·
Always great to see the work you are doing for the platform!

I JUST got a Raspberry Pi 3 Monday, and installed Piston on it.  I wrote a few test programs to interact with steem; very cool and fun!

So do I need to do
pip3 install --upgrade steem
or not?  I'm not sure! :-)
properties (22)
authorkenny-crane
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t150940245z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-18 15:09:39
last_update2017-01-18 15:09:39
depth1
children1
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length273
author_reputation235,491,861,653,057
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,279,320
net_rshares0
@xeroc ·
If all works fine, you don't *need* to. It's just a bit nicer.
You will also see a new release of `piston` quite soon.

Once you updated piston, you will probably see a couple warning messages. That is because most of piston's "library"-sh functions have been moved to python-steem. You can upgrade you code afterwards by simply replacing

    from piston.XXXXX import YYYYYY

to

    from steem.XXXXXX import YYYYY
👍  , ,
properties (23)
authorxeroc
permlinkre-kenny-crane-re-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170118t151809226z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-18 15:18:09
last_update2017-01-18 15:18:09
depth2
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length415
author_reputation118,819,064,085,695
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,279,376
net_rshares611,013,392,080
author_curate_reward""
vote details (3)
@mrfoot ·
Thanks for this kind Sir!!
properties (22)
authormrfoot
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170120t040835313z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-20 04:08:36
last_update2017-01-20 04:08:36
depth1
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length26
author_reputation13,513,881,596,920
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,293,679
net_rshares0
@reddyyeswanth ·
Cool...
properties (22)
authorreddyyeswanth
permlinkre-chainsquad-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170119t194329155z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-01-19 19:43:42
last_update2017-01-19 19:43:42
depth1
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation56,252,585,067
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,290,122
net_rshares0
@screenname ·
Re: Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools
<p>This post has been ranked within the top 10 most undervalued posts in the second half of Jan 18. We estimate that this post is undervalued by $27.35 as compared to a scenario in which every voter had an equal say.</p> 
<p>See the full rankings and details in <a href="https://steemit.com/curation/@screenname/the-daily-tribune-most-undervalued-posts-of-jan-18---part-ii">The Daily Tribune: Jan 18 - Part II</a>. You can also read about some of our methodology, data analysis and technical details in <a href="https://steemit.com/curation/@screenname/introducing-the-daily-tribune-most-undervalued-posts-of-nov-04---part-i">our initial post</a>.</p>
<p>If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.</p>
👍  , , , , , , , , , ,
properties (23)
authorscreenname
permlinkre-python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools-20170119t010446
categorysteem
json_metadata"{"replyto": "@chainsquad/python-steem-0-4-0---massive-changes-to-greatly-simplify-onboarding---merged-steemtools"}"
created2017-01-19 01:04:48
last_update2017-01-19 01:04:48
depth1
children0
last_payout2017-02-18 22:36:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length766
author_reputation46,276,338,038,330
root_title"Python STEEM 0.4.0 - Massive changes to greatly simplify onboarding - Merged Steemtools"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,283,431
net_rshares5,446,619,263
author_curate_reward""
vote details (11)