Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: holgern/beem
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.22.13
Choose a base ref
...
head repository: holgern/beem
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.22.14
Choose a head ref

Commits on Apr 7, 2020

  1. add click_shell

    * add click_shell to turn beempy into a shell utility with autocompletion
    * new click_shell added as requirements
    holgern committed Apr 7, 2020
    Copy the full SHA
    58c2fcb View commit details
  2. Fix package name

    holgern committed Apr 7, 2020
    Copy the full SHA
    3b4a489 View commit details
  3. Fix pyinstaller

    holgern committed Apr 7, 2020
    Copy the full SHA
    2c9dd67 View commit details
  4. Copy the full SHA
    26c9b1d View commit details
  5. Fix ci and installer

    holgern committed Apr 7, 2020
    Copy the full SHA
    603c94f View commit details
  6. fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    26b01eb View commit details
  7. Add nsis installer

    holgern committed Apr 7, 2020
    Copy the full SHA
    68fd11c View commit details
  8. fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    dc7839e View commit details
  9. Try to fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    0e8b70f View commit details
  10. fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    c6a0d8c View commit details
  11. fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    04e6abd View commit details
  12. try to fix

    holgern committed Apr 7, 2020
    Copy the full SHA
    afab3ac View commit details
  13. next try

    holgern committed Apr 7, 2020
    Copy the full SHA
    09912cd View commit details
  14. fix ci

    holgern committed Apr 7, 2020
    Copy the full SHA
    f04b6ff View commit details
  15. fix typo

    holgern committed Apr 7, 2020
    Copy the full SHA
    a3ec6bb View commit details

Commits on Apr 8, 2020

  1. Fix path

    holgern committed Apr 8, 2020
    Copy the full SHA
    a920d66 View commit details
  2. add deploy to appveyor

    holgern committed Apr 8, 2020
    Copy the full SHA
    deb46bf View commit details
  3. fix deploy

    holgern committed Apr 8, 2020
    Copy the full SHA
    fd87243 View commit details
  4. Copy the full SHA
    b0cd21d View commit details
  5. Copy the full SHA
    963c348 View commit details
  6. Add default_chain to storage

    * Add get_blockchain_name to Steem, returns either steem or hive
    * Add switch_blockchain to Steem, can be used to switch between hive and steem
    * Storage has now a new config "default_chain", can be either hive or steem
    * updatenode --hive switches to hive and use hive nodes
    * updatenode --steem switches to steem and use steem nodes
    holgern committed Apr 8, 2020
    Copy the full SHA
    0fda10d View commit details
  7. Add more unit tests

    holgern committed Apr 8, 2020
    Copy the full SHA
    5d22500 View commit details
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ before_install:
# Set numpy version first, other packages link against it
- pip install six nose coverage codecov pytest pytest-cov coveralls codacy-coverage parameterized secp256k1prp cryptography scrypt
- pip install pycryptodomex pyyaml appdirs pylibscrypt tox
- pip install ecdsa requests future websocket-client pytz six Click events prettytable
- pip install ecdsa requests future websocket-client pytz six Click events prettytable click_shell

script:
- tox
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
Changelog
=========
0.22.14
-------
* add click_shell to turn beempy into a shell utility with autocompletion
* new click_shell added as requirements
* Installer added for beempy on windows
* Add get_hive_nodes and get_steem_nodes functions to NodeList
* beempy command resteem renamed to reblog
* When using in shell mode, beempy walletinfo --unlock can be used to unlock the wallet and walletinfo --lock to unlock it again
* Add get_blockchain_name to Steem, returns either steem or hive
* Add switch_blockchain to Steem, can be used to switch between hive and steem
* Storage has now a new config "default_chain", can be either hive or steem
* updatenode --hive switches to hive and use hive nodes
* updatenode --steem switches to steem and use steem nodes

0.22.13
-------
* HiveSigner support added
38 changes: 31 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -24,11 +24,13 @@ install:
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
$env:BUILD = "beempy-{0}-{1}-{2}_win64.zip" -f $env:COMM_TAG, $env:COMM_HASH, $env:COMM_PY
$env:BUILD2 = "beempy-onefile-{0}-{1}-{2}_win64.zip" -f $env:COMM_TAG, $env:COMM_HASH, $env:COMM_PY
$env:BUILD3 = "BeempySetup-{0}-{1}-{2}_win64.exe" -f $env:COMM_TAG, $env:COMM_HASH, $env:COMM_PY
$env:AVVER = "{0}-{1}" -f $env:COMM_TAG.TrimStart("v"), $env:COMM_HASH
}
else {
$env:BUILD = "beempy-{0}-{1}-{2}-{3}_win64.zip" -f $env:COMM_TAG, $env:COMM_COUNT, $env:COMM_HASH, $env:COMM_PY
$env:BUILD2 = "beempy-onefile-{0}-{1}-{2}-{3}_win64.zip" -f $env:COMM_TAG, $env:COMM_COUNT, $env:COMM_HASH, $env:COMM_PY
$env:BUILD3 = "BeempySetup-{0}-{1}-{2}-{3}_win64.exe" -f $env:COMM_TAG, $env:COMM_COUNT, $env:COMM_HASH, $env:COMM_PY
$env:AVVER = "{0}-{1}" -f $env:COMM_TAG.TrimStart("v"), $env:COMM_COUNT
}
@@ -50,7 +52,7 @@ install:
- cmd: conda install --yes conda-build setuptools pip parameterized cryptography
- cmd: conda install --yes pycryptodomex pyyaml pytest pytest-mock coverage mock appdirs pylibscrypt
- cmd: pip install scrypt -U
- cmd: conda install --yes ecdsa requests future websocket-client pytz six Click events prettytable pyinstaller
- cmd: conda install --yes ecdsa requests future websocket-client pytz six Click events prettytable pyinstaller click-shell


build_script:
@@ -65,8 +67,8 @@ test_script:

after_test:
# If tests are successful, create binary packages for the project.
- cmd: pyinstaller beempy-onedir.spec
- cmd: pyinstaller beempy-onefile.spec
- cmd: pyinstaller pyinstaller\beempy-onedir.spec
- cmd: pyinstaller pyinstaller\beempy-onefile.spec

# package artifacts
- cmd: copy /Y C:\OpenSSL-v111-Win64\bin\libcrypto-1_1-x64.dll dist\beempy
@@ -77,12 +79,16 @@ after_test:
#- ps: 7z a -m0=LZMA2 -mx9 $env:BUILD .\dist\beempy
- ps: 7z a $env:BUILD .\dist\beempy
- ps: 7z a $env:BUILD2 .\dist\beempy.exe
- cmd: makensis.exe /V4 pyinstaller\windows_installer.nsi
- ps: Copy-Item .\pyinstaller\BeempySetup.exe -Destination $env:BUILD3

- ps: | # generate sha256 hashes
(get-filehash $env:BUILD -algorithm SHA256).Hash | out-file ("{0}.sha256" -f $env:BUILD) -encoding ascii
type ("{0}.sha256" -f $env:BUILD)
(get-filehash $env:BUILD2 -algorithm SHA256).Hash | out-file ("{0}.sha256" -f $env:BUILD2) -encoding ascii
type ("{0}.sha256" -f $env:BUILD2)
(get-filehash $env:BUILD3 -algorithm SHA256).Hash | out-file ("{0}.sha256" -f $env:BUILD3) -encoding ascii
type ("{0}.sha256" -f $env:BUILD3)
#(get-filehash beempy.zip -algorithm SHA256).Hash | out-file "beempy.zip.sha256" -encoding ascii

@@ -91,16 +97,34 @@ artifacts:
- path: $(BUILD)
name: beempy
- path: $(BUILD).sha256
name: beempy sha256 hash
name: beempy_sha256
- path: $(BUILD2)
name: beempy onefile
name: beempy_onefile
- path: $(BUILD2).sha256
name: beempy onefile sha256 hash
name: beempy_onefile_sha256
- path: $(BUILD3)
name: beempy_installer
- path: $(BUILD3).sha256
name: beempy_installer_sha256
#- path: beempy.zip
# name: beempy_zip
#- path: beempy.zip.sha256
# name: beempy_zip sha256 hash

on_finish:
- ps: | # update appveyor build version, done last to prevent webhook breakage
update-appveyorbuild -version $env:AVVER
update-appveyorbuild -version $env:AVVER
deploy:
provider: GitHub
auth_token:
secure: 0/vpfUG++7riJDu6Zc0smoTJJJm1t9/qiOzY/IR5vtaFNZNVYmRbEt8jS8LxpnFW
artifact: beempy, beempy_sha256, beempy_onefile, beempy_onefile_sha256, beempy_installer, beempy_installer_sha256
draft: true
prerelease: true
description: "standalone executable of beempy for windows"
tag: $(APPVEYOR_REPO_TAG_NAME) # will not work until tag is pushed
on:
# configuration: Release # Debug contains non-redist MS DLLs
APPVEYOR_REPO_TAG: true # deploy on tag push only
branch: master # release from master branch only
90 changes: 64 additions & 26 deletions beem/cli.py
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import random
import logging
import click
from click_shell import shell
import yaml
import re
from beem.instance import set_shared_steem_instance, shared_steem_instance
@@ -100,9 +101,11 @@ def prompt_flag_callback(ctx, param, value):
ctx.abort()


def unlock_wallet(stm, password=None):
def unlock_wallet(stm, password=None, allow_wif=True):
if stm.unsigned and stm.nobroadcast:
return True
if not stm.wallet.locked():
return True
password_storage = stm.config["password_storage"]
if not password and KEYRING_AVAILABLE and password_storage == "keyring":
password = keyring.get_password("beem", "wallet")
@@ -111,7 +114,10 @@ def unlock_wallet(stm, password=None):
if bool(password):
stm.wallet.unlock(password)
else:
password = click.prompt("Password to unlock wallet or posting/active wif", confirmation_prompt=False, hide_input=True)
if allow_wif:
password = click.prompt("Password to unlock wallet or posting/active wif", confirmation_prompt=False, hide_input=True)
else:
password = click.prompt("Password to unlock wallet", confirmation_prompt=False, hide_input=True)
try:
stm.wallet.unlock(password)
except:
@@ -120,7 +126,10 @@ def unlock_wallet(stm, password=None):
print("Wif accepted!")
return True
except:
raise exceptions.WrongMasterPasswordException("entered password is not a valid password/wif")
if allow_wif:
raise exceptions.WrongMasterPasswordException("entered password is not a valid password/wif")
else:
raise exceptions.WrongMasterPasswordException("entered password is not a valid password")

if stm.wallet.locked():
if password_storage == "keyring" or password_storage == "environment":
@@ -152,8 +161,8 @@ def node_answer_time(node):
rpc_answer_time = float("inf")
return rpc_answer_time


@click.group(chain=True)
@shell(prompt='beempy> ', intro='Starting beempy... (use help to list all commands)', chain=True)
# @click.group(chain=True)
@click.option(
'--node', '-n', default="", help="URL for public Steem API (e.g. https://api.steemit.com)")
@click.option(
@@ -248,6 +257,8 @@ def set(key, value):
stm.set_default_nodes(value)
else:
stm.set_default_nodes("")
elif key == "default_chain":
stm.config["default_chain"] = value
elif key == "password_storage":
stm.config["password_storage"] = value
if KEYRING_AVAILABLE and value == "keyring":
@@ -409,7 +420,7 @@ def currentnode(version, url):
t.add_row(["Node-Url", node[0]])
if not offline:
t.add_row(["Version", stm.get_blockchain_version()])
t.add_row(["HIVE", stm.is_hive])
t.add_row(["Chain", stm.get_blockchain_name()])
else:
t.add_row(["Version", "steempy is in offline mode..."])
print(t)
@@ -421,7 +432,10 @@ def currentnode(version, url):
help="Prints the updated nodes")
@click.option(
'--hive', '-h', is_flag=True, default=False,
help="Use only HIVE nodes, when set to true.")
help="Switch to HIVE blockchain, when set to true.")
@click.option(
'--steem', '-e', is_flag=True, default=False,
help="Switch to STEEM nodes, when set to true.")
@click.option(
'--test', '-t', is_flag=True, default=False,
help="Do change the node list, only print the newest nodes setup.")
@@ -431,23 +445,37 @@ def currentnode(version, url):
@click.option(
'--only-wss', '-w', is_flag=True, default=False,
help="Use only websocket nodes.")
@click.option(
'--only-appbase', '-a', is_flag=True, default=False,
help="Use only appbase nodes")
@click.option(
'--only-non-appbase', '-n', is_flag=True, default=False,
help="Use only non-appbase nodes")
def updatenodes(show, hive, test, only_https, only_wss, only_appbase, only_non_appbase):
def updatenodes(show, hive, steem, test, only_https, only_wss):
""" Update the nodelist from @fullnodeupdate
"""
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
if steem and hive:
print("hive and steem cannot be active both")
return
t = PrettyTable(["node", "Version", "score"])
t.align = "l"
if steem:
blockchain = "steem"
elif hive:
blockchain = "hive"
else:
blockchain = stm.config["default_chain"]
nodelist = NodeList()
nodelist.update_nodes(steem_instance=stm)
nodes = nodelist.get_nodes(hive=hive, exclude_limited=False, normal=not only_appbase, appbase=not only_non_appbase, wss=not only_https, https=not only_wss)
if hive:
nodes = nodelist.get_hive_nodes(wss=not only_https, https=not only_wss)
if stm.config["default_chain"] == "steem":
stm.config["default_chain"] = "hive"
elif steem:
nodes = nodelist.get_steem_nodes(wss=not only_https, https=not only_wss)
if stm.config["default_chain"] == "hive":
stm.config["default_chain"] = "steem"
elif stm.config["default_chain"] == "steem":
nodes = nodelist.get_steem_nodes(wss=not only_https, https=not only_wss)
else:
nodes = nodelist.get_hive_nodes(wss=not only_https, https=not only_wss)
if show or test:
sorted_nodes = sorted(nodelist, key=lambda node: node["score"], reverse=True)
for node in sorted_nodes:
@@ -471,7 +499,9 @@ def config():
if key in availableConfigurationKeys and key != "nodes" and key != "node":
t.add_row([key, stm.config[key]])
node = stm.get_default_nodes()
blockchain = stm.config["default_chain"]
nodes = json.dumps(node, indent=4)
t.add_row(["default_chain", blockchain])
t.add_row(["nodes", nodes])
if "password_storage" not in availableConfigurationKeys:
t.add_row(["password_storage", stm.config["password_storage"]])
@@ -512,13 +542,19 @@ def createwallet(wipe):


@cli.command()
@click.option('--test-unlock', is_flag=True, default=False, help='test if unlock is sucessful')
def walletinfo(test_unlock):
@click.option('--unlock', '-u', is_flag=True, default=False, help='Unlock wallet')
@click.option('--lock', '-l', is_flag=True, default=False, help='Lock wallet')
def walletinfo(unlock, lock):
""" Show info about wallet
"""
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
stm.rpc.rpcconnect()
if lock:
stm.wallet.lock()
elif unlock:
unlock_wallet(stm, allow_wif=False)

t = PrettyTable(["Key", "Value"])
t.align = "l"
t.add_row(["created", stm.wallet.created()])
@@ -536,8 +572,10 @@ def walletinfo(test_unlock):
t.add_row(["keyring installed", "yes"])
else:
t.add_row(["keyring installed", "no"])
if test_unlock:
if unlock_wallet(stm):


if unlock:
if unlock_wallet(stm, allow_wif=False):
t.add_row(["Wallet unlock", "successful"])
else:
t.add_row(["Wallet unlock", "not working"])
@@ -594,7 +632,7 @@ def addkey(unsafe_import_key):
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
if not unlock_wallet(stm):
if not unlock_wallet(stm, allow_wif=False):
return
if not unsafe_import_key:
unsafe_import_key = click.prompt("Enter private key", confirmation_prompt=False, hide_input=True)
@@ -617,7 +655,7 @@ def delkey(confirm, pub):
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
if not unlock_wallet(stm):
if not unlock_wallet(stm, allow_wif=False):
return
stm.wallet.removePrivateKeyFromPublicKey(pub)
set_shared_steem_instance(stm)
@@ -1031,7 +1069,7 @@ def changewalletpassphrase():
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
if not unlock_wallet(stm):
if not unlock_wallet(stm, allow_wif=False):
return
newpassword = None
newpassword = click.prompt("New wallet password", confirmation_prompt=True, hide_input=True)
@@ -2206,9 +2244,9 @@ def openorders(account):

@cli.command()
@click.argument('identifier', nargs=1)
@click.option('--account', '-a', help='Resteem as this user')
def resteem(identifier, account):
"""Resteem an existing post"""
@click.option('--account', '-a', help='Reblog as this user')
def reblog(identifier, account):
"""Reblog an existing post"""
stm = shared_steem_instance()
if stm.rpc is not None:
stm.rpc.rpcconnect()
9 changes: 6 additions & 3 deletions beem/discussions.py
Original file line number Diff line number Diff line change
@@ -852,9 +852,12 @@ def __init__(self, discussion_query, lazy=False, use_appbase=False, raw_data=Fal
self.steem = steem_instance or shared_steem_instance()
self.steem.rpc.set_next_node_on_empty_reply(self.steem.rpc.get_use_appbase() and use_appbase)
if self.steem.rpc.get_use_appbase() and use_appbase:
posts = self.steem.rpc.get_replies_by_last_update(discussion_query, api="tags")
if 'discussions' in posts:
posts = posts['discussions']
try:
posts = self.steem.rpc.get_replies_by_last_update(discussion_query, api="tags")
if 'discussions' in posts:
posts = posts['discussions']
except:
posts = self.steem.rpc.get_replies_by_last_update(discussion_query["start_author"], discussion_query["start_permlink"], discussion_query["limit"])
else:
posts = self.steem.rpc.get_replies_by_last_update(discussion_query["start_author"], discussion_query["start_permlink"], discussion_query["limit"])
if posts is None:
2 changes: 1 addition & 1 deletion beem/imageuploader.py
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ def __init__(
self.base_url = base_url
self.steem = steem_instance or shared_steem_instance()
if self.steem.is_hive and base_url == "https://steemitimages.com":
base_url = "https://images.hive.blog"
self.base_url = "https://images.hive.blog"

def upload(self, image, account, image_name=None):
""" Uploads an image
Loading