File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
from time import sleep
2
2
3
+ from web3 .exceptions import BadResponseFormat
3
4
from web3 .manager import NULL_RESPONSES
4
5
from web3 .middleware import Web3Middleware
5
6
@@ -28,6 +29,10 @@ def request_wrapper(method, params):
28
29
response = make_batch_request .__self__ .make_request (method , params )
29
30
if "error" in response and self ._w3 .should_retry :
30
31
raise Exception (response ["error" ].get ("message" ) or "Unknown RPC Error" )
32
+ if response .get ("jsonrpc" ) != "2.0" :
33
+ raise BadResponseFormat ("The response was in an unexpected format and unable to be parsed. "
34
+ "The \" jsonrpc\" field must be present with a value of \" 2.0\" . "
35
+ f"The raw response is: { response } " )
31
36
if ("eth_getBlockBy" in method and response .get ("result" ) in NULL_RESPONSES ) and self ._w3 .should_retry :
32
37
raise Exception ("Block not found" )
33
38
return response
Original file line number Diff line number Diff line change 1
1
from setuptools import setup , find_packages
2
2
3
- VERSION = '0.1.55 '
3
+ VERSION = '0.1.56 '
4
4
DESCRIPTION = 'IceCreamSwap Web3.py wrapper'
5
5
LONG_DESCRIPTION = 'IceCreamSwap Web3.py wrapper with automatic retries, multicall and other advanced functionality'
6
6
You can’t perform that action at this time.
0 commit comments