[Python-modules-commits] [aioxmlrpc] 02/04: Import aioxmlrpc_0.3.orig.tar.gz
Piotr Ożarowski
piotr at moszumanska.debian.org
Mon Jul 18 20:16:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
piotr pushed a commit to branch master
in repository aioxmlrpc.
commit 48b18414377b2bdfee470325b612061467548e99
Author: Piotr Ożarowski <piotr at debian.org>
Date: Mon Jul 18 22:10:16 2016 +0200
Import aioxmlrpc_0.3.orig.tar.gz
---
CHANGES.rst | 20 ++++++++++++++++++--
LICENSE | 2 +-
PKG-INFO | 33 +++++++++++++++++++++++++++------
README.rst | 6 +++++-
aioxmlrpc.egg-info/PKG-INFO | 33 +++++++++++++++++++++++++++------
aioxmlrpc.egg-info/requires.txt | 2 +-
aioxmlrpc/__init__.py | 2 +-
aioxmlrpc/client.py | 29 +++++++++++++++++++----------
aioxmlrpc/tests/test_client.py | 36 ++++++++++++++++++++++++++++++++----
setup.py | 7 ++++---
10 files changed, 135 insertions(+), 35 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index dd9fbfe..1c2a657 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,5 +1,21 @@
-Changelist
-==========
+Changelog
+=========
+
+0.3 released on 2016-06-16
+--------------------------
+
+ * Fix socket closing issue
+
+
+0.2 released on 2016-05-26
+--------------------------
+
+ * Update compatibility for aiohttp >= 0.20
+
+ .. important::
+
+ This break the compatibility of python 3.3
+
0.1 released on 2014-05-17
--------------------------
diff --git a/LICENSE b/LICENSE
index 3220874..a70b345 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014, Guillaume Gauvrit and Contibutors
+Copyright (c) 2014-2016, Guillaume Gauvrit and Contibutors
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/PKG-INFO b/PKG-INFO
index 8fe7ce7..77385e1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,7 +1,7 @@
Metadata-Version: 1.1
Name: aioxmlrpc
-Version: 0.1
-Summary: XML-RPC for asyncio
+Version: 0.3
+Summary: XML-RPC client for asyncio
Home-page: https://github.com/mardiros/aioxmlrpc
Author: Guillaume Gauvrit
Author-email: guillaume at gauvr.it
@@ -38,7 +38,7 @@ Description: =========
pip install aioxmlrpc
- Exemple of usage
+ Example of usage
----------------
This example show how to print the current version of the Gandi XML-RPC api.
@@ -46,6 +46,10 @@ Description: =========
::
+ import asyncio
+ from aioxmlrpc.client import ServerProxy
+
+
@asyncio.coroutine
def print_gandi_api_version():
api = ServerProxy('https://rpc.gandi.net/xmlrpc/')
@@ -58,19 +62,36 @@ Description: =========
loop.stop()
- Changelist
- ==========
+ Changelog
+ =========
+
+ 0.3 released on 2016-06-16
+ --------------------------
+
+ * Fix socket closing issue
+
+
+ 0.2 released on 2016-05-26
+ --------------------------
+
+ * Update compatibility for aiohttp >= 0.20
+
+ .. important::
+
+ This break the compatibility of python 3.3
+
0.1 released on 2014-05-17
--------------------------
* Initial version implementing ``aioxmlrpc.client``
-Keywords: asyncaio xml-rpc rpc
+Keywords: asyncio xml-rpc rpc
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
diff --git a/README.rst b/README.rst
index 45b2105..9e1cd22 100644
--- a/README.rst
+++ b/README.rst
@@ -30,7 +30,7 @@ Installation
pip install aioxmlrpc
-Exemple of usage
+Example of usage
----------------
This example show how to print the current version of the Gandi XML-RPC api.
@@ -38,6 +38,10 @@ This example show how to print the current version of the Gandi XML-RPC api.
::
+ import asyncio
+ from aioxmlrpc.client import ServerProxy
+
+
@asyncio.coroutine
def print_gandi_api_version():
api = ServerProxy('https://rpc.gandi.net/xmlrpc/')
diff --git a/aioxmlrpc.egg-info/PKG-INFO b/aioxmlrpc.egg-info/PKG-INFO
index 8fe7ce7..77385e1 100644
--- a/aioxmlrpc.egg-info/PKG-INFO
+++ b/aioxmlrpc.egg-info/PKG-INFO
@@ -1,7 +1,7 @@
Metadata-Version: 1.1
Name: aioxmlrpc
-Version: 0.1
-Summary: XML-RPC for asyncio
+Version: 0.3
+Summary: XML-RPC client for asyncio
Home-page: https://github.com/mardiros/aioxmlrpc
Author: Guillaume Gauvrit
Author-email: guillaume at gauvr.it
@@ -38,7 +38,7 @@ Description: =========
pip install aioxmlrpc
- Exemple of usage
+ Example of usage
----------------
This example show how to print the current version of the Gandi XML-RPC api.
@@ -46,6 +46,10 @@ Description: =========
::
+ import asyncio
+ from aioxmlrpc.client import ServerProxy
+
+
@asyncio.coroutine
def print_gandi_api_version():
api = ServerProxy('https://rpc.gandi.net/xmlrpc/')
@@ -58,19 +62,36 @@ Description: =========
loop.stop()
- Changelist
- ==========
+ Changelog
+ =========
+
+ 0.3 released on 2016-06-16
+ --------------------------
+
+ * Fix socket closing issue
+
+
+ 0.2 released on 2016-05-26
+ --------------------------
+
+ * Update compatibility for aiohttp >= 0.20
+
+ .. important::
+
+ This break the compatibility of python 3.3
+
0.1 released on 2014-05-17
--------------------------
* Initial version implementing ``aioxmlrpc.client``
-Keywords: asyncaio xml-rpc rpc
+Keywords: asyncio xml-rpc rpc
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
diff --git a/aioxmlrpc.egg-info/requires.txt b/aioxmlrpc.egg-info/requires.txt
index ce23571..e1cb557 100644
--- a/aioxmlrpc.egg-info/requires.txt
+++ b/aioxmlrpc.egg-info/requires.txt
@@ -1 +1 @@
-aiohttp
\ No newline at end of file
+aiohttp >= 0.20
diff --git a/aioxmlrpc/__init__.py b/aioxmlrpc/__init__.py
index 310e06a..cdbaacb 100644
--- a/aioxmlrpc/__init__.py
+++ b/aioxmlrpc/__init__.py
@@ -2,4 +2,4 @@
XML-RPC Protocol for ``asyncio``
"""
-__version__ = '0.1'
+__version__ = '0.3'
diff --git a/aioxmlrpc/client.py b/aioxmlrpc/client.py
index 7d23c25..f75f353 100644
--- a/aioxmlrpc/client.py
+++ b/aioxmlrpc/client.py
@@ -44,13 +44,13 @@ class AioTransport(xmlrpc.Transport):
"""
user_agent = 'python/aioxmlrpc'
-
- def __init__(self, use_https, use_datetime=False,
- use_builtin_types=False):
+ def __init__(self, use_https, *, use_datetime=False,
+ use_builtin_types=False, loop):
super().__init__(use_datetime, use_builtin_types)
self.use_https = use_https
-
+ self._loop = loop
+ self._connector = aiohttp.TCPConnector(loop=self._loop)
@asyncio.coroutine
def request(self, host, handler, request_body, verbose):
@@ -66,10 +66,10 @@ class AioTransport(xmlrpc.Transport):
url = self._build_url(host, handler)
response = None
try:
- response = yield from aiohttp.request('POST', url,
- headers=headers,
- data=request_body)
- body = yield from response.read_and_close()
+ response = yield from aiohttp.request(
+ 'POST', url, headers=headers, data=request_body,
+ connector=self._connector, loop=self._loop)
+ body = yield from response.text()
if response.status != 200:
raise ProtocolError(url, response.status,
body, response.headers)
@@ -98,6 +98,9 @@ class AioTransport(xmlrpc.Transport):
scheme = 'https' if self.use_https else 'http'
return '%s://%s%s' % (scheme, host, handler)
+ def close(self):
+ self._connector.close()
+
class ServerProxy(xmlrpc.ServerProxy):
"""
@@ -105,9 +108,12 @@ class ServerProxy(xmlrpc.ServerProxy):
"""
def __init__(self, uri, transport=None, encoding=None, verbose=False,
- allow_none=False, use_datetime=False,use_builtin_types=False):
+ allow_none=False, use_datetime=False,use_builtin_types=False,
+ loop=None):
+ self._loop = loop or asyncio.get_event_loop()
if not transport:
- transport = AioTransport(uri.startswith('https://'))
+ transport = AioTransport(uri.startswith('https://'),
+ loop=self._loop)
super().__init__(uri, transport, encoding, verbose, allow_none,
use_datetime, use_builtin_types)
@@ -129,5 +135,8 @@ class ServerProxy(xmlrpc.ServerProxy):
return response
+ def close(self):
+ self.__transport.close()
+
def __getattr__(self, name):
return _Method(self.__request, name)
diff --git a/aioxmlrpc/tests/test_client.py b/aioxmlrpc/tests/test_client.py
index b81bf73..304045d 100644
--- a/aioxmlrpc/tests/test_client.py
+++ b/aioxmlrpc/tests/test_client.py
@@ -55,7 +55,7 @@ def dummy_response(method, url, **kwargs):
self.headers = {}
@asyncio.coroutine
- def read_and_close(self):
+ def text(self):
return self.body
return Response()
@@ -79,15 +79,17 @@ class ServerProxyTestCase(TestCase):
def test_xmlrpc_ok(self):
from aioxmlrpc.client import ServerProxy
- client = ServerProxy('http://localhost/test_xmlrpc_ok')
+ client = ServerProxy('http://localhost/test_xmlrpc_ok', loop=self.loop)
response = self.loop.run_until_complete(
client.name.space.proxfyiedcall()
)
self.assertEqual(response, 1)
+ self.assertIs(self.loop, client._loop)
def test_xmlrpc_fault(self):
from aioxmlrpc.client import ServerProxy, Fault
- client = ServerProxy('http://localhost/test_xmlrpc_fault')
+ client = ServerProxy('http://localhost/test_xmlrpc_fault',
+ loop=self.loop)
self.assertRaises(Fault,
self.loop.run_until_complete,
client.name.space.proxfyiedcall()
@@ -95,8 +97,34 @@ class ServerProxyTestCase(TestCase):
def test_http_500(self):
from aioxmlrpc.client import ServerProxy, ProtocolError
- client = ServerProxy('http://localhost/test_http_500')
+ client = ServerProxy('http://localhost/test_http_500', loop=self.loop)
self.assertRaises(ProtocolError,
self.loop.run_until_complete,
client.name.space.proxfyiedcall()
)
+
+ def test_xmlrpc_ok_global_loop(self):
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ from aioxmlrpc.client import ServerProxy
+ client = ServerProxy('http://localhost/test_xmlrpc_ok')
+ response = self.loop.run_until_complete(
+ client.name.space.proxfyiedcall()
+ )
+ self.assertIs(loop, client._loop)
+ self.assertEqual(response, 1)
+
+ def test_close_transport(self):
+ from aioxmlrpc.client import ServerProxy, AioTransport
+
+ transp = AioTransport(use_https=False, loop=self.loop)
+ transp._connector.close = mock.Mock()
+ client = ServerProxy('http://localhost/test_xmlrpc_ok',
+ loop=self.loop, transport=transp)
+ response = self.loop.run_until_complete(
+ client.name.space.proxfyiedcall()
+ )
+ client.close()
+ self.assertEqual(response, 1)
+ self.assertIs(self.loop, client._loop)
+ self.assertTrue(transp._connector.close.called)
diff --git a/setup.py b/setup.py
index 4ed806e..8c29b6b 100644
--- a/setup.py
+++ b/setup.py
@@ -20,19 +20,20 @@ with open(os.path.join(here, NAME, '__init__.py')) as version:
re.S).match(version.read()).group(1)
-requires = ['aiohttp']
+requires = ['aiohttp >= 0.20']
if py_version < (3, 4):
requires.append('asyncio')
setup(name=NAME,
version=VERSION,
- description='XML-RPC for asyncio',
+ description='XML-RPC client for asyncio',
long_description=README + '\n\n' + CHANGES,
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License'
@@ -40,7 +41,7 @@ setup(name=NAME,
author='Guillaume Gauvrit',
author_email='guillaume at gauvr.it',
url='https://github.com/mardiros/aioxmlrpc',
- keywords='asyncaio xml-rpc rpc',
+ keywords='asyncio xml-rpc rpc',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/aioxmlrpc.git
More information about the Python-modules-commits
mailing list