electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 168326e184cc6251c1c27e003dc1127503b579a9
parent c8a2ff15b881310d653d754e60566cf7993d282f
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 13 Nov 2017 05:18:30 +0100

Merge pull request #3282 from JustinTArthur/fix-broken-commands

Fixes to signing, notify commands and command exception handling.
Diffstat:
Mlib/commands.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/commands.py b/lib/commands.py @@ -40,9 +40,10 @@ from functools import wraps from decimal import Decimal from .import util -from .util import print_msg, format_satoshis, print_stderr +from .util import bfh, bh2u, format_satoshis from .import bitcoin from .bitcoin import is_address, hash_160, COIN, TYPE_ADDRESS +from .i18n import _ from .transaction import Transaction from .import paymentrequest from .paymentrequest import PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED @@ -658,12 +659,12 @@ class Commands: def notify(self, address, URL): """Watch an address. Everytime the address changes, a http POST is sent to the URL.""" def callback(x): - import urllib2 + import urllib.request headers = {'content-type':'application/json'} data = {'address':address, 'status':x.get('result')} try: - req = urllib2.Request(URL, json.dumps(data), headers) - response_stream = urllib2.urlopen(req, timeout=5) + req = urllib.request.Request(URL, json.dumps(data), headers) + response_stream = urllib.request.urlopen(req, timeout=5) util.print_error('Got Response for %s' % address) except BaseException as e: util.print_error(str(e))