diff --git a/.pyup.yml b/.pyup.yml new file mode 100644 index 0000000..c06bdc9 --- /dev/null +++ b/.pyup.yml @@ -0,0 +1,21 @@ +# update schedule +# default: empty +# allowed: "every day", "every week", .. +schedule: "every day" + +# search for requirement files +# default: True +# allowed: True, False +search: False + +# Specify requirement files by hand, default is empty +# default: empty +# allowed: list +requirements: + - requirements.pip: + # update all dependencies and pin them + update: all + pin: True + - requirements-dev.pip: + # don't update dependencies, use global 'pin' default + update: False diff --git a/README.rst b/README.rst index 397ae41..f745c15 100644 --- a/README.rst +++ b/README.rst @@ -9,17 +9,17 @@ Nano (RaiBlocks) Python Library :target: https://travis-ci.org/dourvaris/nano-python .. image:: https://readthedocs.org/projects/nano-python/badge/?version=latest - :target: http://nano-python.readthedocs.io/en/latest/?badge=latest + :target: https://nano-python.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status .. image:: https://github.com/dourvaris/nano-python/raw/master/coverage.svg?sanitize=true :target: https://travis-ci.org/dourvaris/nano-python .. image:: https://img.shields.io/pypi/pyversions/nano-python.svg?style=flat-square - :target: https://pypi.python.org/pypi/nano-python + :target: https://pypi.org/project/nano-python/ .. image:: https://img.shields.io/pypi/v/nano-python.svg - :target: https://pypi.python.org/pypi/nano-python + :target: https://pypi.org/project/nano-python/ This library contains a python wrapper for the Nano (RaiBlocks) RPC server which tries to make it a little easier to work with by converting RPC responses @@ -63,8 +63,9 @@ for examples of usage. >>> rpc.version() { 'rpc_version': 1, - 'store_version': 10, - 'node_vendor': 'RaiBlocks 9.0' + 'store_version': 13, + 'protocol_version': 16, + 'node_vendor': 'Nano 18.0' } >>> rpc.peers() { @@ -76,6 +77,7 @@ Crypto/Accounts =============== .. code-block:: python + >>> from nano import generate_account, verify_signature, sign_message >>> account = generate_account(seed='someseed') >>> signature = sign_message(b'this', account['private_key_bytes']) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..7893348 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/rpc/methods/node.rst b/docs/rpc/methods/node.rst index 00793b2..2ca563b 100644 --- a/docs/rpc/methods/node.rst +++ b/docs/rpc/methods/node.rst @@ -308,6 +308,7 @@ Returns the node's RPC version >>> rpc.version() { "rpc_version": 1, - "store_version": 10, - "node_vendor": "RaiBlocks 9.0" + "store_version": 13, + "protocol_version": 16, + "node_vendor": "Nano 18.0" } diff --git a/requirements.pip b/requirements.pip index c54d50a..0fe49e4 100644 --- a/requirements.pip +++ b/requirements.pip @@ -1,7 +1,7 @@ -certifi==2017.11.5 +certifi chardet==3.0.4 -idna==2.6 -pyblake2==1.1.0 -requests==2.18.4 -six==1.11.0 -urllib3==1.22 +idna==2.8 +pyblake2==1.1.2 +requests==2.21.0 +six==1.12.0 +urllib3==1.24.1 diff --git a/src/nano/accounts.py b/src/nano/accounts.py index 1f6c62e..c8f539b 100644 --- a/src/nano/accounts.py +++ b/src/nano/accounts.py @@ -13,7 +13,7 @@ """ -import random +import secrets from binascii import hexlify, unhexlify from .crypto import b32xrb_encode, b32xrb_decode, address_checksum, keypair_from_seed @@ -129,7 +129,7 @@ def generate_account(seed=None, index=0): """ if not seed: - seed = unhexlify(''.join(random.choice('0123456789ABCDEF') for i in range(64))) + seed = unhexlify(''.join(secrets.choice('0123456789ABCDEF') for i in range(64))) pair = keypair_from_seed(seed, index=index) result = { diff --git a/src/nano/rpc.py b/src/nano/rpc.py index bdd2ed3..af37604 100644 --- a/src/nano/rpc.py +++ b/src/nano/rpc.py @@ -30,8 +30,9 @@ class Client(object): >>> rpc.version() { 'rpc_version': 1, - 'store_version': 10, - 'node_vendor': 'RaiBlocks 9.0' + 'store_version': 13, + 'protocol_version': 16, + 'node_vendor': 'Nano 18.0' } """ @@ -3356,15 +3357,16 @@ def version(self): >>> rpc.version() { "rpc_version": 1, - "store_version": 10, - "node_vendor": "RaiBlocks 9.0" + "store_version": 13, + "protocol_version": 16, + "node_vendor": "Nano 18.0" } """ resp = self.call('version') - for key in ('rpc_version', 'store_version'): + for key in ('rpc_version', 'store_version', 'protocol_version'): resp[key] = int(resp[key]) return resp diff --git a/tests/fixtures/rpc/version.json b/tests/fixtures/rpc/version.json index a4dbd27..e8ce442 100644 --- a/tests/fixtures/rpc/version.json +++ b/tests/fixtures/rpc/version.json @@ -1,17 +1,19 @@ [ { "expected": { - "node_vendor": "RaiBlocks 9.0", + "node_vendor": "Nano 18.0", + "protocol_version": 16, "rpc_version": 1, - "store_version": 10 + "store_version": 13 }, "request": { "action": "version" }, "response": { - "node_vendor": "RaiBlocks 9.0", + "node_vendor": "Nano 18.0", + "protocol_version": "16", "rpc_version": "1", - "store_version": "10" + "store_version": "13" } } ] diff --git a/tests/test_mock_rpc.py b/tests/test_mock_rpc.py index 2689f81..60b2708 100644 --- a/tests/test_mock_rpc.py +++ b/tests/test_mock_rpc.py @@ -10,8 +10,9 @@ def test_existing_request(self, mock_rpc_session): ) assert resp.json() == { "rpc_version": "1", - "store_version": "10", - "node_vendor": "RaiBlocks 9.0", + "store_version": "13", + "protocol_version": "16", + "node_vendor": "Nano 18.0", } def test_missing_request(self, mock_rpc_session): diff --git a/tests/test_rpc.py b/tests/test_rpc.py index e389f3c..3135c88 100644 --- a/tests/test_rpc.py +++ b/tests/test_rpc.py @@ -24,8 +24,9 @@ def test_create(self, arguments): def test_call_valid_action(self, rpc): assert rpc.call('version') == { "rpc_version": "1", - "store_version": "10", - "node_vendor": "RaiBlocks 9.0", + "store_version": "13", + "protocol_version": "16", + "node_vendor": "Nano 18.0", } def test_call_invalid_action(self, rpc):