From 9d0ae2f95b0040312ffe5430a59c7ddbaf8e27d3 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 10 Dec 2019 22:55:11 +0100 Subject: [PATCH] adapt to aiohttp 4.0 related: #5753 --- electrum/daemon.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/electrum/daemon.py b/electrum/daemon.py index 088f0f83a..960dedd91 100644 --- a/electrum/daemon.py +++ b/electrum/daemon.py @@ -30,11 +30,11 @@ import traceback import sys import threading from typing import Dict, Optional, Tuple -import aiohttp -from aiohttp import web from base64 import b64decode from collections import defaultdict +import aiohttp +from aiohttp import web, client_exceptions import jsonrpcclient import jsonrpcserver from jsonrpcserver import response @@ -54,6 +54,7 @@ from .logging import get_logger, Logger _logger = get_logger(__name__) + class DaemonNotRunning(Exception): pass @@ -100,7 +101,7 @@ def request(config: SimpleConfig, endpoint, args=(), timeout=60): auth = aiohttp.BasicAuth(login=rpc_user, password=rpc_password) loop = asyncio.get_event_loop() async def request_coroutine(): - async with aiohttp.ClientSession(auth=auth, loop=loop) as session: + async with aiohttp.ClientSession(auth=auth) as session: server = AiohttpClient(session, server_url) f = getattr(server, endpoint) response = await f(*args)