Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
693cae4
update version()
Laurentiu-Andronache Mar 5, 2019
a1a41cf
update tests for new version()
Laurentiu-Andronache Mar 5, 2019
7f45bd6
Update certifi from 2017.11.5 to 2019.3.9
pyup-bot Mar 13, 2019
5625ab7
Update idna from 2.6 to 2.8
pyup-bot Mar 13, 2019
0cbcafa
Update pyblake2 from 1.1.0 to 1.1.2
pyup-bot Mar 13, 2019
d05cf26
Update requests from 2.18.4 to 2.21.0
pyup-bot Mar 13, 2019
2b07a0b
Update six from 1.11.0 to 1.12.0
pyup-bot Mar 13, 2019
91d7fcd
Update urllib3 from 1.22 to 1.24.1
pyup-bot Mar 13, 2019
d962378
Merge pull request #11 from Laurentiu-Andronache/pyup-update-certifi-…
Laurentiu-Andronache Mar 13, 2019
d4151ff
Merge pull request #13 from Laurentiu-Andronache/pyup-update-pyblake2…
Laurentiu-Andronache Mar 13, 2019
b93bc8e
Merge pull request #15 from Laurentiu-Andronache/pyup-update-six-1.11…
Laurentiu-Andronache Mar 13, 2019
2236a6f
Merge branch 'master' into pyup-update-requests-2.18.4-to-2.21.0
Laurentiu-Andronache Mar 13, 2019
e8b9ad8
Merge pull request #14 from Laurentiu-Andronache/pyup-update-requests…
Laurentiu-Andronache Mar 13, 2019
4fd158a
Merge branch 'master' into pyup-update-urllib3-1.22-to-1.24.1
Laurentiu-Andronache Mar 13, 2019
c6921f8
Merge pull request #16 from Laurentiu-Andronache/pyup-update-urllib3-…
Laurentiu-Andronache Mar 13, 2019
be014df
Merge branch 'master' into pyup-update-idna-2.6-to-2.8
Laurentiu-Andronache Mar 13, 2019
cf0391b
Merge pull request #12 from Laurentiu-Andronache/pyup-update-idna-2.6…
Laurentiu-Andronache Mar 13, 2019
a9e0293
pyup.io config file
Laurentiu-Andronache Mar 13, 2019
53dddd5
fix error in "code-block" directive
Laurentiu-Andronache Mar 13, 2019
2d851dd
add make for Windows
Laurentiu-Andronache Mar 13, 2019
8a964c0
fix links that were permanent redirects
Laurentiu-Andronache Mar 13, 2019
fa2bcb7
Kenneth Reitz recommends not to pin certifi, source: https://snyk.io/…
Laurentiu-Andronache Mar 13, 2019
538e939
use `secrets` instead of `random`, in order to access the most secure…
Laurentiu-Andronache Mar 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 7 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
{
Expand All @@ -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'])
Expand Down
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions docs/rpc/methods/node.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 6 additions & 6 deletions requirements.pip
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/nano/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
12 changes: 7 additions & 5 deletions src/nano/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
"""

Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/rpc/version.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
5 changes: 3 additions & 2 deletions tests/test_mock_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down