From fac7c6eca69f4b516fd35af017bd9566740d9874 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Sat, 11 Nov 2017 00:54:13 +0100 Subject: [PATCH 1/7] Updates for aiobotocore and aiohttp --- requirements.txt | 6 +++--- setup.py | 6 +++--- tests/test_http_service.py | 20 ++++++++++++++++---- tomodachi/transport/http.py | 10 +++++----- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/requirements.txt b/requirements.txt index 97f8e0165..99d53117e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ aioamqp==0.10.0 -aiobotocore==0.4.5 -aiohttp==2.2.5 +aiobotocore==0.5.0 +aiohttp==2.3.2 async-timeout==2.0.0 -botocore==1.7.5 +botocore==1.7.40 chardet==3.0.4 codecov==2.0.9 coverage==4.4.2 diff --git a/setup.py b/setup.py index 564819eb0..43f7a0db6 100644 --- a/setup.py +++ b/setup.py @@ -7,10 +7,10 @@ install_requires = [ 'aioamqp>=0.10.0', 'ujson>=1.35', - 'uvloop>=0.8.0', - 'aiobotocore>=0.3.1', + 'uvloop>=0.8.1', + 'aiobotocore>=0.5.0', 'tzlocal>=1.4', - 'aiohttp<=2.2.5' + 'aiohttp==2.3.2' ] PY_VER = sys.version_info diff --git a/tests/test_http_service.py b/tests/test_http_service.py index 8bcf3f981..a57795d78 100644 --- a/tests/test_http_service.py +++ b/tests/test_http_service.py @@ -281,15 +281,27 @@ async def _async(loop: Any) -> None: await client.get('http://127.0.0.1:{}/test'.format(port)) with open(log_path) as file: content = file.read() - assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content - assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' not in content + assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content + assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' not in content async with aiohttp.ClientSession(loop=loop) as client: await client.get('http://127.0.0.1:{}/404'.format(port)) with open(log_path) as file: content = file.read() - assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content - assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' in content + assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content + assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' in content + + async with aiohttp.ClientSession(loop=loop) as client: + await client.post('http://127.0.0.1:{}/zero-post'.format(port), data=b'') + with open(log_path) as file: + content = file.read() + assert '[http] [404] 127.0.0.1 - "POST /zero-post HTTP/1.1" 8 0' in content + + async with aiohttp.ClientSession(loop=loop) as client: + await client.post('http://127.0.0.1:{}/post'.format(port), data=b'RANDOMDATA') + with open(log_path) as file: + content = file.read() + assert '[http] [404] 127.0.0.1 - "POST /post HTTP/1.1" 8 10' in content with open(log_path) as file: content = file.read() diff --git a/tomodachi/transport/http.py b/tomodachi/transport/http.py index 68e4e80cc..867f2d325 100644 --- a/tomodachi/transport/http.py +++ b/tomodachi/transport/http.py @@ -97,10 +97,11 @@ def __call__(self) -> RequestHandler: class DynamicResource(web_urldispatcher.DynamicResource): - def __init__(self, pattern: Any, formatter: str, *, name: Optional[str]=None) -> None: - super().__init__(re.compile('\\/'), '/', name=name) + def __init__(self, pattern: Any, *, name: Optional[str]=None) -> None: + self._routes = [] + self._name = name self._pattern = pattern - self._formatter = formatter + self._formatter = '' class UrlDispatcher(web_urldispatcher.UrlDispatcher): @@ -110,8 +111,7 @@ def add_pattern_route(self, method: str, pattern: str, handler: Callable, *, nam except re.error as exc: raise ValueError( "Bad pattern '{}': {}".format(pattern, exc)) from None - formatter = '' - resource = DynamicResource(compiled_pattern, formatter, name=name) + resource = DynamicResource(compiled_pattern, name=name) self.register_resource(resource) if method == 'GET': resource.add_route('HEAD', handler, expect_handler=expect_handler) From 512892bd0be8369ce01f11fa7bfa57c5459f0423 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Mon, 13 Nov 2017 00:35:16 +0100 Subject: [PATCH 2/7] Fixed missing type hinting --- tomodachi/transport/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tomodachi/transport/http.py b/tomodachi/transport/http.py index 867f2d325..5f0cad8f8 100644 --- a/tomodachi/transport/http.py +++ b/tomodachi/transport/http.py @@ -98,7 +98,7 @@ def __call__(self) -> RequestHandler: class DynamicResource(web_urldispatcher.DynamicResource): def __init__(self, pattern: Any, *, name: Optional[str]=None) -> None: - self._routes = [] + self._routes = [] # type: List self._name = name self._pattern = pattern self._formatter = '' From 454ea50e1d76f1a9a9b02b3ed1bbb81070a0e4d0 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Mon, 13 Nov 2017 00:40:51 +0100 Subject: [PATCH 3/7] Updated yarl dependency --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 99d53117e..49b1b9d37 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,4 @@ six==1.11.0 tzlocal==1.4 ujson==1.35 uvloop==0.8.1 -yarl==0.13.0 +yarl==0.14.0 From 3bbce74ba2d21c6a1fff2ef8406e042c7d47a43b Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Tue, 14 Nov 2017 07:38:09 +0100 Subject: [PATCH 4/7] Updated yarl dependency --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 49b1b9d37..c30995364 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,4 @@ six==1.11.0 tzlocal==1.4 ujson==1.35 uvloop==0.8.1 -yarl==0.14.0 +yarl==0.14.1 From 37478b05cb6e1cc0f71cfe9568a86e3ff3e3c1c2 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Tue, 14 Nov 2017 07:38:29 +0100 Subject: [PATCH 5/7] Set more strict versions for required packages --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 43f7a0db6..e48826027 100644 --- a/setup.py +++ b/setup.py @@ -5,12 +5,12 @@ import tomodachi.__version__ install_requires = [ - 'aioamqp>=0.10.0', + 'aioamqp>=0.10.0, <0.11.0', 'ujson>=1.35', 'uvloop>=0.8.1', - 'aiobotocore>=0.5.0', + 'aiobotocore>=0.5.0, <0.6.0', 'tzlocal>=1.4', - 'aiohttp==2.3.2' + 'aiohttp==2.3.2, <2.4.0' ] PY_VER = sys.version_info From d0dc3e0bafaed438376dc3cbac9c1c2a7feb2718 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Tue, 14 Nov 2017 12:27:00 +0100 Subject: [PATCH 6/7] Updated yarl to 0.14.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c30995364..87b243ce5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,4 +23,4 @@ six==1.11.0 tzlocal==1.4 ujson==1.35 uvloop==0.8.1 -yarl==0.14.1 +yarl==0.14.2 From 68ef0f17cd6ee4ab4fcc613d96057f9fc5e2fa63 Mon Sep 17 00:00:00 2001 From: Carl Oscar Aaro Date: Wed, 15 Nov 2017 10:29:20 +0100 Subject: [PATCH 7/7] Updated aiobotocore to 0.5.1 which solves gzipped response issue --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 87b243ce5..6ab7f05b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ aioamqp==0.10.0 -aiobotocore==0.5.0 +aiobotocore==0.5.1 aiohttp==2.3.2 async-timeout==2.0.0 botocore==1.7.40 diff --git a/setup.py b/setup.py index e48826027..eddeb0518 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ 'aioamqp>=0.10.0, <0.11.0', 'ujson>=1.35', 'uvloop>=0.8.1', - 'aiobotocore>=0.5.0, <0.6.0', + 'aiobotocore>=0.5.1, <0.6.0', 'tzlocal>=1.4', 'aiohttp==2.3.2, <2.4.0' ]