Skip to content

Commit 41bcd28

Browse files
authored
Merge pull request #36 from lgrahl/aiohttp2
Migrate to aiohttp 2
2 parents 5b0ef8e + 5ae21e7 commit 41bcd28

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def read(file):
5858
'logbook>=1.1.0,<2',
5959
'libnacl>=1.5.2,<2',
6060
'click>=6.7,<7', # doesn't seem to follow semantic versioning
61-
'aiohttp>=1.3.5,<2',
61+
'aiohttp>=2.2.5,<3',
6262
'wrapt>=1.10.10,<2',
6363
],
6464
tests_require=tests_require,

tests/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ def api_server_port():
377377
@pytest.fixture(scope='module')
378378
def api_server(request, event_loop, api_server_port, server):
379379
port = api_server_port
380-
app = web.Application(loop=event_loop, router=server.router)
380+
app = web.Application(
381+
loop=event_loop, router=server.router, client_max_size=100 * (2**20))
381382
handler = app.make_handler()
382383

383384
# Set up server

threema/gateway/bin/gateway_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def main():
463463
exc = None
464464
try:
465465
cli()
466-
except aiohttp.FingerprintMismatch:
466+
except aiohttp.client_exceptions.ServerFingerprintMismatch:
467467
error = 'Fingerprints did not match!'
468468
except Exception as exc_:
469469
error = str(exc_)

threema/gateway/e2e.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ def create_router(self):
167167

168168
# noinspection PyMethodMayBeStatic
169169
def create_application(self, router, loop):
170-
return web.Application(router=router, loop=loop)
170+
# A box can contain up to 4000 bytes, so this should be sufficient.
171+
# The remaining POST parameters aren't that big.
172+
# See: https://gateway.threema.ch/en/developer/api
173+
request_size_max = 8192
174+
return web.Application(router=router, loop=loop, client_max_size=request_size_max)
171175

172176
def create_handler(self):
173177
return self.application.make_handler()

0 commit comments

Comments
 (0)