diff --git a/plugins/currency/bitcoin/bitcoind_ b/plugins/currency/bitcoin/bitcoind_ index 369fbc63..48de665c 100755 --- a/plugins/currency/bitcoin/bitcoind_ +++ b/plugins/currency/bitcoin/bitcoind_ @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """=cut =head1 NAME @@ -48,12 +48,13 @@ Copyright (C) 2012 Mike Koss =cut""" +import json import os +import re import sys import time -import re -import urllib2 -import json +import urllib.error +import urllib.request DEBUG = False @@ -222,15 +223,15 @@ class Proxy(object): 'params': args, 'id': self.id, } - request = urllib2.Request(self.service.url, json.dumps(data)) + request = urllib.request.Request(self.service.url, json.dumps(data)) if self.service.username: # Strip the newline from the b64 encoding! b64 = ('%s:%s' % (self.service.username, self.service.password)).encode('base64')[:-1] request.add_header('Authorization', 'Basic %s' % b64) try: - body = urllib2.urlopen(request).read() - except urllib2.URLError as e: + body = urllib.request.urlopen(request).read() + except urllib.error.URLError as e: return (None, e) if DEBUG: @@ -245,8 +246,8 @@ class Proxy(object): def get_json_url(url): - request = urllib2.Request(url) - body = urllib2.urlopen(request).read() + request = urllib.request.Request(url) + body = urllib.request.urlopen(request).read() data = json.loads(body) return data