aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2014-03-15 13:20:13 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2014-03-15 13:20:13 -0700
commitda0b9d454edcacb67e1abe699b72477d7f4e59d0 (patch)
treefb522bd4740e0df912b3a3f8a738ac6c09764041
parentcb0c42e7dad3d92276cfa62c66e6f298ea33c78a (diff)
Revert "Squashed 'qa/rpc-tests/python-bitcoinrpc/' content from commit e484743"
This reverts commit 260cf5c0a4754be39b05f6a247b8a354de7eced6.
-rw-r--r--README21
-rw-r--r--bitcoinrpc/.gitignore2
-rw-r--r--bitcoinrpc/__init__.py0
-rw-r--r--bitcoinrpc/authproxy.py140
-rw-r--r--jsonrpc/__init__.py2
-rw-r--r--jsonrpc/authproxy.py3
-rw-r--r--jsonrpc/json.py9
-rw-r--r--jsonrpc/proxy.py1
-rw-r--r--setup.py15
9 files changed, 0 insertions, 193 deletions
diff --git a/README b/README
deleted file mode 100644
index 9edd5a2121..0000000000
--- a/README
+++ /dev/null
@@ -1,21 +0,0 @@
-AuthServiceProxy is an improved version of python-jsonrpc.
-
-It includes the following generic improvements:
-
-- HTTP connections persist for the life of the AuthServiceProxy object
-- sends protocol 'version', per JSON-RPC 1.1
-- sends proper, incrementing 'id'
-- uses standard Python json lib
-
-It also includes the following bitcoin-specific details:
-
-- sends Basic HTTP authentication headers
-- parses all JSON numbers that look like floats as Decimal
-
-Installation:
-
-- change the first line of setup.py to point to the directory of your installation of python 2.*
-- run setup.py
-
-Note: This will only install bitcoinrpc. If you also want to install jsonrpc to preserve
-backwards compatibility, you have to replace 'bitcoinrpc' with 'jsonrpc' in setup.py and run it again.
diff --git a/bitcoinrpc/.gitignore b/bitcoinrpc/.gitignore
deleted file mode 100644
index 2f78cf5b66..0000000000
--- a/bitcoinrpc/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.pyc
-
diff --git a/bitcoinrpc/__init__.py b/bitcoinrpc/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/bitcoinrpc/__init__.py
+++ /dev/null
diff --git a/bitcoinrpc/authproxy.py b/bitcoinrpc/authproxy.py
deleted file mode 100644
index 2914477170..0000000000
--- a/bitcoinrpc/authproxy.py
+++ /dev/null
@@ -1,140 +0,0 @@
-
-"""
- Copyright 2011 Jeff Garzik
-
- AuthServiceProxy has the following improvements over python-jsonrpc's
- ServiceProxy class:
-
- - HTTP connections persist for the life of the AuthServiceProxy object
- (if server supports HTTP/1.1)
- - sends protocol 'version', per JSON-RPC 1.1
- - sends proper, incrementing 'id'
- - sends Basic HTTP authentication headers
- - parses all JSON numbers that look like floats as Decimal
- - uses standard Python json lib
-
- Previous copyright, from python-jsonrpc/jsonrpc/proxy.py:
-
- Copyright (c) 2007 Jan-Klaas Kollhof
-
- This file is part of jsonrpc.
-
- jsonrpc is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this software; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-try:
- import http.client as httplib
-except ImportError:
- import httplib
-import base64
-import json
-import decimal
-try:
- import urllib.parse as urlparse
-except ImportError:
- import urlparse
-
-USER_AGENT = "AuthServiceProxy/0.1"
-
-HTTP_TIMEOUT = 30
-
-
-class JSONRPCException(Exception):
- def __init__(self, rpc_error):
- Exception.__init__(self)
- self.error = rpc_error
-
-
-class AuthServiceProxy(object):
- def __init__(self, service_url, service_name=None, timeout=HTTP_TIMEOUT, connection=None):
- self.__service_url = service_url
- self.__service_name = service_name
- self.__url = urlparse.urlparse(service_url)
- if self.__url.port is None:
- port = 80
- else:
- port = self.__url.port
- self.__id_count = 0
- (user, passwd) = (self.__url.username, self.__url.password)
- try:
- user = user.encode('utf8')
- except AttributeError:
- pass
- try:
- passwd = passwd.encode('utf8')
- except AttributeError:
- pass
- authpair = user + b':' + passwd
- self.__auth_header = b'Basic ' + base64.b64encode(authpair)
-
- if connection:
- # Callables re-use the connection of the original proxy
- self.__conn = connection
- elif self.__url.scheme == 'https':
- self.__conn = httplib.HTTPSConnection(self.__url.hostname, port,
- None, None, False,
- timeout)
- else:
- self.__conn = httplib.HTTPConnection(self.__url.hostname, port,
- False, timeout)
-
- def __getattr__(self, name):
- if name.startswith('__') and name.endswith('__'):
- # Python internal stuff
- raise AttributeError
- if self.__service_name is not None:
- name = "%s.%s" % (self.__service_name, name)
- return AuthServiceProxy(self.__service_url, name, connection=self.__conn)
-
- def __call__(self, *args):
- self.__id_count += 1
-
- postdata = json.dumps({'version': '1.1',
- 'method': self.__service_name,
- 'params': args,
- 'id': self.__id_count})
- self.__conn.request('POST', self.__url.path, postdata,
- {'Host': self.__url.hostname,
- 'User-Agent': USER_AGENT,
- 'Authorization': self.__auth_header,
- 'Content-type': 'application/json'})
-
- response = self._get_response()
- if response['error'] is not None:
- raise JSONRPCException(response['error'])
- elif 'result' not in response:
- raise JSONRPCException({
- 'code': -343, 'message': 'missing JSON-RPC result'})
- else:
- return response['result']
-
- def _batch(self, rpc_call_list):
- postdata = json.dumps(list(rpc_call_list))
- self.__conn.request('POST', self.__url.path, postdata,
- {'Host': self.__url.hostname,
- 'User-Agent': USER_AGENT,
- 'Authorization': self.__auth_header,
- 'Content-type': 'application/json'})
-
- return self._get_response()
-
- def _get_response(self):
- http_response = self.__conn.getresponse()
- if http_response is None:
- raise JSONRPCException({
- 'code': -342, 'message': 'missing HTTP response from server'})
-
- return json.loads(http_response.read().decode('utf8'),
- parse_float=decimal.Decimal)
diff --git a/jsonrpc/__init__.py b/jsonrpc/__init__.py
deleted file mode 100644
index 8441fa3120..0000000000
--- a/jsonrpc/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .json import loads, dumps, JSONEncodeException, JSONDecodeException
-from jsonrpc.proxy import ServiceProxy, JSONRPCException
diff --git a/jsonrpc/authproxy.py b/jsonrpc/authproxy.py
deleted file mode 100644
index e90ef361d0..0000000000
--- a/jsonrpc/authproxy.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
-
-__all__ = ['AuthServiceProxy', 'JSONRPCException']
diff --git a/jsonrpc/json.py b/jsonrpc/json.py
deleted file mode 100644
index 95398630f7..0000000000
--- a/jsonrpc/json.py
+++ /dev/null
@@ -1,9 +0,0 @@
-_json = __import__('json')
-loads = _json.loads
-dumps = _json.dumps
-if hasattr(_json, 'JSONEncodeException'):
- JSONEncodeException = _json.JSONEncodeException
- JSONDecodeException = _json.JSONDecodeException
-else:
- JSONEncodeException = TypeError
- JSONDecodeException = ValueError
diff --git a/jsonrpc/proxy.py b/jsonrpc/proxy.py
deleted file mode 100644
index 0d2be1e93b..0000000000
--- a/jsonrpc/proxy.py
+++ /dev/null
@@ -1 +0,0 @@
-from bitcoinrpc.authproxy import AuthServiceProxy as ServiceProxy, JSONRPCException
diff --git a/setup.py b/setup.py
deleted file mode 100644
index b5a217bf93..0000000000
--- a/setup.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python
-
-from distutils.core import setup
-
-setup(name='python-bitcoinrpc',
- version='0.1',
- description='Enhanced version of python-jsonrpc for use with Bitcoin',
- long_description=open('README').read(),
- author='Jeff Garzik',
- author_email='<jgarzik@exmulti.com>',
- maintainer='Jeff Garzik',
- maintainer_email='<jgarzik@exmulti.com>',
- url='http://www.github.com/jgarzik/python-bitcoinrpc',
- packages=['bitcoinrpc'],
- classifiers=['License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'Operating System :: OS Independent'])