Skip to content
Snippets Groups Projects
Commit 194ee898 authored by Moul's avatar Moul
Browse files

[mod] #396: Remove aiohttp module usage

parent 2e173c93
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import logging
from aiohttp.client_exceptions import ServerDisconnectedError
from click import INT, argument, command, progressbar
from duniterpy.api import bma
from duniterpy.api.client import Client
......@@ -89,9 +88,6 @@ def get_chunk_size(from_block, to_block, chunks_from, chunk_from):
def get_chunk(client, chunk_size, chunk_from):
try:
return client(bma.blockchain.blocks, chunk_size, chunk_from)
except ServerDisconnectedError:
logging.info("Reach BMA anti-spam protection. Waiting two seconds")
return client(bma.blockchain.blocks, chunk_size, chunk_from)
except DuniterError as error:
logging.error(error)
......
......@@ -20,9 +20,7 @@ from collections import OrderedDict
from operator import itemgetter
from os import system
import aiohttp
import jsonschema
from _socket import gaierror
from click import IntRange, argument, command, option
from duniterpy.api import bma
from pendulum import from_timestamp
......@@ -31,13 +29,8 @@ from tabulate import tabulate
from silkaj.blockchain_tools import HeadBlock
from silkaj.constants import ALL, HOUR
from silkaj.network_tools import ClientInstance, EndPoint, best_endpoint_address
from silkaj.wot_tools import identity_of
from silkaj.network_tools import (
best_endpoint_address,
EndPoint,
ClientInstance,
)
from silkaj.tools import CurrencySymbol
from silkaj.wot_tools import identity_of
@command("info", help="Display information about currency")
......@@ -103,11 +96,6 @@ def difficulties():
diffi = client(bma.blockchain.difficulties)
display_diffi(current, diffi)
client.close()
except (aiohttp.WSServerHandshakeError, ValueError) as e:
print("Websocket block {0} : {1}".format(type(e).__name__, str(e)))
except (aiohttp.ClientError, gaierror, TimeoutError) as e:
print("{0} : {1}".format(str(e), BMAS_ENDPOINT))
except jsonschema.ValidationError as e:
print("{:}:{:}".format(str(e.__class__.__name__), str(e)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment